Score.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 SCORE_H
00023 #define SCORE_H
00024 #include "Platform.hpp"
00025 #ifdef SWIG
00026 %module CsoundAC
00027 %{
00028 #include "Event.hpp"
00029 #include "Midifile.hpp"
00030 #include <iostream>
00031 #include <vector>
00032   %}
00033 %include "std_string.i"
00034 %include "std_vector.i"
00035 #else
00036 #include "Event.hpp"
00037 #include "Midifile.hpp"
00038 #include <iostream>
00039 #include <vector>
00040 #endif
00041 
00042 namespace csound
00043 {
00051   class Score :
00052     public std::vector<csound::Event>
00053   {
00054   protected:
00055     void createMusicModel();
00056   public:
00057     Event scaleTargetMinima;
00058     std::vector<bool> rescaleMinima;
00059     Event scaleTargetRanges;
00060     std::vector<bool> rescaleRanges;
00061     Event scaleActualMinima;
00062     Event scaleActualRanges;
00063     MidiFile midifile;
00064     std::map<int, double> reassignments;
00065     std::map<int, double> gains;
00066     std::map<int, double> pans;
00067     Score();
00068     virtual ~Score();
00069     virtual void initialize();
00070     virtual void append(Event event);
00071     virtual void append(double time, double duration, double status, double channel, double key, double velocity, double phase=0, double pan=0, double depth=0, double height=0, double pitches=4095);
00072     virtual void load(std::string filename);
00073     virtual void load(std::istream &stream);
00074     virtual void load(MidiFile &midiFile);
00078     virtual void save(std::string filename);
00082     virtual void save(std::ostream &stream);
00086     virtual void save(MidiFile &midiFile);
00087     static void getScale(std::vector<Event> &score, int dimension, size_t beginAt, size_t endAt, double &minimum, double &range);
00088     static void setScale(std::vector<Event> &score, int dimension, bool rescaleMinimum, bool rescaleRange, size_t beginAt, size_t endAt, double targetMinimum, double targetRange);
00089     virtual void findScale();
00090     virtual void rescale();
00091     virtual void rescale(Event &event);
00096     virtual void sort();
00097     virtual void dump(std::ostream &stream);
00098     virtual std::string toString();
00099     virtual double getDuration();
00100     virtual void rescale(int dimension, bool rescaleMinimum, double minimum, bool rescaleRange = false, double range = 0.0);
00109     virtual std::string getCsoundScore(double tonesPerOctave = 12.0, bool conformPitches = false);
00113     virtual void arrange(int oldInstrumentNumber, int newInstrumentNumber);
00117     virtual void arrange(int oldInstrumentNumber, int newInstrumentNumber, double gain);
00121     virtual void arrange(int oldInstrumentNumber, int newInstrumentNumber, double gain, double pan);
00125     virtual void removeArrangement();
00130     virtual std::vector<double> getPitches(size_t begin,
00131                                            size_t end,
00132                                            size_t divisionsPerOctave = 12) const;
00138     virtual void setPitches(size_t begin,
00139                             size_t end,
00140                             const std::vector<double> &pitches);
00146     virtual void setPitchClassSet(size_t begin,
00147                                   size_t end,
00148                                   const std::vector<double> &pcs,
00149                                   size_t divisionsPerOctave = 12);
00158     virtual std::vector<double> getPTV(size_t begin,
00159                                        size_t end,
00160                                        double lowest,
00161                                        double range,
00162                                        size_t divisionsPerOctave = 12) const;
00171     virtual void setPTV(size_t begin,
00172                         size_t end,
00173                         double prime,
00174                         double transposition,
00175                         double voicing,
00176                         double lowest,
00177                         double range,
00178                         size_t divisionsPerOctave = 12);
00186     virtual std::vector<double> getPT(size_t begin,
00187                       size_t end,
00188                       double lowest,
00189                       double range,
00190                       size_t divisionsPerOctave = 12) const;
00198     virtual void setPT(size_t begin,
00199                size_t end,
00200                double prime,
00201                double transposition,
00202                double lowest,
00203                double range,
00204                size_t divisionsPerOctave = 12);
00218     virtual void voicelead(size_t beginSource,
00219                size_t endSource,
00220                size_t beginTarget,
00221                size_t endTarget,
00222                double lowest,
00223                double range,
00224                bool avoidParallelFifths,
00225                size_t divisionsPerOctave = 12);
00240     virtual void voicelead(size_t beginSource,
00241                size_t endSource,
00242                size_t beginTarget,
00243                size_t endTarget,
00244                const std::vector<double> &targetPitches,
00245                double lowest,
00246                double range,
00247                bool avoidParallelFifths,
00248                size_t divisionsPerOctave = 12);
00257     virtual int indexAtTime(double time);
00266     virtual int indexAfterTime(double time);
00271     virtual double indexToTime(size_t index);
00280     virtual std::vector<double> getVoicing(size_t begin, size_t end, size_t divisionsPerOctave = 12) const;
00288     virtual void setVoicing(size_t begin, size_t end, const std::vector<double> &voicing, double range, size_t divisionsPerOctave = 12);
00293     virtual void setDuration(double targetDuration);
00294   };
00295 }
00296 #endif

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