Random.hpp

Go to the documentation of this file.
00001 /*
00002  * C S O U N D   V S T
00003  *
00004  * A VST plugin version of Csound, with Python scripting.
00005  *
00006  * L I C E N S E
00007  *
00008  * This software is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * This software is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this software; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 #ifndef RANDOM_H
00023 #define RANDOM_H
00024 
00025 #include "Platform.hpp"
00026 #ifdef SWIG
00027 %module CsoundAC
00028 %{
00029 #include "Node.hpp"
00030   %}
00031 #else
00032 #include "Node.hpp"
00033 #include <boost/random.hpp>
00034 #include <boost/random/variate_generator.hpp>
00035 #include <cmath>
00036 using namespace boost::numeric;
00037 #endif
00038 
00039 namespace csound
00040 {
00041 
00052   class Random :
00053     public Node
00054   {
00055   protected:
00056 #if !defined(SWIG)
00057     void *generator_;
00058     boost::variate_generator<boost::mt19937, boost::uniform_smallint<> > *uniform_smallint_generator;
00059     boost::variate_generator<boost::mt19937, boost::uniform_int<> > *uniform_int_generator;
00060     boost::variate_generator<boost::mt19937, boost::uniform_real<> > *uniform_real_generator;
00061     boost::variate_generator<boost::mt19937, boost::bernoulli_distribution<> > *bernoulli_distribution_generator;
00062     boost::variate_generator<boost::mt19937, boost::geometric_distribution<> > *geometric_distribution_generator;
00063     boost::variate_generator<boost::mt19937, boost::triangle_distribution<> > *triangle_distribution_generator;
00064     boost::variate_generator<boost::mt19937, boost::exponential_distribution<> > *exponential_distribution_generator;
00065     boost::variate_generator<boost::mt19937, boost::normal_distribution<> > *normal_distribution_generator;
00066     boost::variate_generator<boost::mt19937, boost::lognormal_distribution<> > *lognormal_distribution_generator;
00067   public:
00068     static boost::mt19937 mersenneTwister;
00069 #endif
00070   public:
00071     std::string distribution;
00072     int row;
00073     int column;
00074     int eventCount;
00075     bool incrementTime;
00076     double minimum;
00077     double maximum;
00078     double q;
00079     double a;
00080     double b;
00081     double c;
00082     double Lambda;
00083     double mean;
00084     double sigma;
00085     Random();
00086     virtual ~Random();
00087     virtual double sample() const;
00088     virtual ublas::matrix<double> getLocalCoordinates() const;
00089     virtual void createDistribution(std::string distribution);
00090     virtual void produceOrTransform(Score &score, size_t beginAt, size_t endAt, const ublas::matrix<double> &globalCoordinates);
00091     static void seed(int s);
00092   };
00093 }
00094 #endif

Generated on Sun Nov 9 00:04:52 2008 for Csound and CsoundAC by  doxygen 1.5.6