Lindenmayer.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 LINDENMAYER_TO_SOUND_H
00023 #define LINDENMAYER_TO_SOUND_H
00024 
00025 #include "Platform.hpp"
00026 #ifdef SWIG
00027 %module CsoundAC
00028 %include "std_string.i"
00029 %include "std_vector.i"
00030 %{
00031 #include "Silence.hpp"
00032 #include <stack>
00033 #include <string>
00034 #include <map>
00035 #include <vector>
00036 #include <boost/numeric/ublas/vector.hpp>
00037 #include <boost/numeric/ublas/matrix.hpp>
00038   %}
00039 #else
00040 #include "Silence.hpp"
00041 #include <stack>
00042 #include <string>
00043 #include <map>
00044 #include <vector>
00045 #include <boost/numeric/ublas/vector.hpp>
00046 #include <boost/numeric/ublas/matrix.hpp>
00047 using namespace boost::numeric;
00048 #endif
00049 
00050 namespace csound
00051 {
00078   class Lindenmayer :
00079     public ScoreNode
00080   {
00081   protected:
00082     int iterationCount;
00083     double angle;
00084     std::string axiom;
00085     Event turtle;
00086     Event turtleStep;
00087     Event turtleOrientation;
00088     std::map<std::string, std::string> rules;
00089     std::stack<Event> turtleStack;
00090     std::stack<Event> turtleStepStack;
00091     std::stack<Event> turtleOrientationStack;
00092     clock_t beganAt;
00093     clock_t endedAt;
00094     clock_t elapsed;
00095     virtual void interpret(std::string command, bool render);
00096     virtual int getDimension (char dimension) const;
00097     virtual void rewrite();
00098     virtual ublas::matrix<double> createRotation (int dimension1, int dimension2, double angle) const;
00099     virtual void updateActual(Event &event);
00100     virtual void initialize();
00101   public:
00102     Lindenmayer();
00103     virtual ~Lindenmayer();
00104     virtual int getIterationCount() const;
00105     virtual void setIterationCount(int count);
00106     virtual double getAngle() const;
00107     virtual void setAngle(double angle);
00108     virtual std::string getAxiom() const;
00109     virtual void setAxiom(std::string axiom);
00110     virtual void addRule(std::string command, std::string replacement);
00111     virtual std::string getReplacement(std::string command);
00112     virtual void generate();
00113     virtual void clear();
00114   };
00115 }
00116 #endif

Generated on Tue Apr 14 11:00:49 2009 for Csound and CsoundAC by  doxygen 1.5.8