Event.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 EVENT_H
00023 #define EVENT_H
00024 #include "Platform.hpp"
00025 #ifdef SWIG
00026 %module CsoundAC
00027 %{
00028 #include "Conversions.hpp"
00029 #include <map>
00030 #include <string>
00031 #include <vector>
00032 #include <iostream>
00033 #include <sstream>
00034 #include <algorithm>
00035 #include <utility>
00036 #include <boost/numeric/ublas/vector.hpp>
00037   %}
00038 %include "std_string.i"
00039 %include "std_vector.i"
00040 %template(EventVector) std::vector<csound::Event>;
00041 #else
00042 #include "Conversions.hpp"
00043 #include "Midifile.hpp"
00044 #include <map>
00045 #include <string>
00046 #include <iostream>
00047 #include <sstream>
00048 #include <algorithm>
00049 #include <utility>
00050 #include <boost/numeric/ublas/vector.hpp>
00051 using namespace boost::numeric;
00052 #endif
00053 
00054 namespace csound
00055 {
00074   class Event :
00075     public ublas::vector<double>
00076   {
00077   public:
00078     typedef enum
00079       {
00080         TIME = 0,
00081         DURATION,
00082         STATUS,
00083         INSTRUMENT,
00084         KEY,
00085         VELOCITY,
00086         PHASE,
00087         PAN,
00088         DEPTH,
00089         HEIGHT,
00090         PITCHES,
00091         HOMOGENEITY,
00092         ELEMENT_COUNT
00093       } Dimensions;
00094     enum
00095       {
00096         INDEFINITE = 16384
00097       };
00098     std::map<std::string,std::string> properties;
00099     Event();
00100     Event(const Event &a);
00101     Event(std::string text);
00102     Event(const ublas::vector<double, ublas::unbounded_array<double> > &a);
00103     Event(double time, double duration, double status, double instrument, double key, double velocity, double phase, double pan, double depth, double height, double pitches);
00104     Event(const std::vector<double> &v);
00105     virtual ~Event();
00106     virtual void initialize();
00107     virtual bool isMidiEvent() const;
00108     virtual bool isNoteOn() const;
00109     virtual bool isNoteOff() const;
00110     virtual bool isNote() const;
00111     virtual bool isMatchingNoteOff(const Event& event) const;
00112     virtual bool isMatchingEvent(const Event& event) const;
00113     virtual void set(double time, double duration, double status, double instrument, double key, double velocity, double phase=0, double pan=0, double depth=0, double height=0, double pitches=4095);
00114     virtual void setMidi(double time, char status, char key, char velocity);
00115     virtual int getMidiStatus() const;
00116     virtual int getStatusNumber() const;
00117     virtual double getStatus() const;
00118     virtual void setStatus(double status);
00119     virtual int getChannel() const;
00120     virtual double getInstrument() const;
00121     virtual void setInstrument(double instrument);
00122     virtual double getTime() const;
00123     virtual void setTime(double time);
00124     virtual double getDuration() const;
00125     virtual void setDuration(double duration);
00126     virtual double getOffTime() const;
00127     virtual int getKeyNumber() const;
00128     virtual double getKey() const;
00129     virtual double getKey(double tonesPerOctave) const;
00130     virtual void setKey(double key);
00131     virtual double getFrequency() const;
00132     virtual void setFrequency(double frequency);
00133     virtual int getVelocityNumber() const;
00134     virtual double getVelocity() const;
00135     virtual void setVelocity(double velocity);
00136     virtual double getGain() const;
00137     virtual double getPan() const;
00138     virtual void setPan(double pan);
00139     virtual double getDepth() const;
00140     virtual void setDepth(double depth);
00141     virtual double getHeight() const;
00142     virtual void setHeight(double height);
00143     virtual double getPitches() const;
00144     virtual void setPitches(double pitches);
00145     virtual double getAmplitude() const;
00146     virtual void setAmplitude(double amplitude);
00147     virtual double getPhase() const;
00148     virtual void setPhase(double phase);
00149     virtual double getLeftGain() const;
00150     virtual double getRightGain() const;
00151     virtual void dump(std::ostream &stream);
00152     virtual std::string toString() const;
00153     virtual std::string toCsoundIStatement(double tempering = 12.0) const;
00154     virtual std::string toCsoundIStatementHeld(int tag, double tempering = 12.0) const;
00155     virtual std::string toCsoundIStatementRelease(int tag, double tempering = 12.0) const;
00156     virtual void conformToPitchClassSet();
00157     virtual void temper(double divisionsPerOctave);
00158     virtual std::string getProperty(std::string name);
00159     virtual void setProperty(std::string name, std::string value);
00160     virtual void removeProperty(std::string nameO);
00161     virtual void clearProperties();
00162     virtual void createNoteOffEvent(Event &event) const;
00163     virtual Event &operator = (const Event &a);
00164     virtual Event &operator = (const ublas::vector<double> &a);
00165 #ifndef SWIG
00166     static int SORT_ORDER[];
00167     static const char *labels[];
00168 #endif
00169   };
00170 
00171   bool operator < (const Event& a, const Event &b);
00172 }
00173 #endif

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