CsoundFile.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 CSOUNDFILE_H
00023 #define CSOUNDFILE_H
00024 
00025 #undef MYFLT
00026 #ifdef USE_DOUBLE
00027 #define MYFLT double
00028 #else
00029 #define MYFLT float
00030 #endif
00031 
00032 #if defined(_MSC_VER) && !defined(__GNUC__)
00033 #pragma warning(disable: 4786)
00034 #endif
00035 #ifdef SWIG
00036 %module csnd
00037 %include "std_string.i"
00038 %include "std_vector.i"
00039 #if !defined(SWIGLUA)
00040 %include "std_map.i"
00041 %template(IntToStringMap) std::map<int, std::string>;
00042 #endif
00043 %{
00044 #include <string>
00045 #include <vector>
00046 %}
00047 #else
00048 #include <iostream>
00049 #include <string>
00050 #include <vector>
00051 #include <map>
00052 #include <fstream>
00053 #include <sstream>
00054 #include <stdlib.h>
00055 
00056 #if defined(WIN32)
00057 #define PUBLIC __declspec(dllexport)
00058 #include <io.h>
00059 #elif defined(__GNUC__)
00060 #define PUBLIC __attribute__ ( (visibility("default")) )
00061 #else
00062 #define PUBLIC
00063 #endif
00064 #endif
00065 
00066 void PUBLIC gatherArgs(int argc, const char **argv, std::string &commandLine);
00067 
00068 void PUBLIC scatterArgs(const std::string commandLine, std::vector<std::string> &args, std::vector<char *> &argv);
00069 
00070 std::string PUBLIC &trim(std::string &value);
00071 
00072 std::string PUBLIC &trimQuotes(std::string &value);
00073 
00080 bool PUBLIC parseInstrument(const std::string &definition, std::string &preNumber, std::string &id, std::string &name, std::string &postNumber);
00081 
00087 class PUBLIC CsoundFile
00088 {
00089 protected:
00093   std::string filename;
00097   std::string command;
00098   std::vector<std::string> args;
00099   std::vector<char *> argv;
00103   std::string orchestra;
00107   std::string score;
00111   std::vector<unsigned char> midifile;
00112 public:
00116   std::string libraryFilename;
00117   std::vector<std::string> arrangement;
00118   CsoundFile();
00119   virtual ~CsoundFile(){};
00120   virtual std::string generateFilename();
00121   virtual std::string getFilename() const;
00122   virtual void setFilename(std::string name);
00123   virtual int load(std::string filename);
00124   virtual int load(std::istream &stream);
00125   virtual int save(std::string filename) const;
00126   virtual int save(std::ostream &stream) const;
00127   virtual int importFile(std::string filename);
00128   virtual int importFile(std::istream &stream);
00129   virtual int importCommand(std::istream &stream);
00130   virtual int exportCommand(std::ostream &stream) const;
00131   virtual int importOrchestra(std::istream &stream);
00132   virtual int exportOrchestra(std::ostream &stream) const;
00133   virtual int importScore(std::istream &stream);
00134   virtual int exportScore(std::ostream &stream) const;
00135   virtual int importArrangement(std::istream &stream);
00136   virtual int exportArrangement(std::ostream &stream) const;
00137   virtual int exportArrangementForPerformance(std::string filename) const;
00138   virtual int exportArrangementForPerformance(std::ostream &stream) const;
00139   virtual int importMidifile(std::istream &stream);
00140   virtual int exportMidifile(std::ostream &stream) const;
00141   virtual std::string getCommand() const;
00142   virtual void setCommand(std::string commandLine);
00143   virtual std::string getOrcFilename() const;
00144   virtual std::string getScoFilename() const;
00145   virtual std::string getMidiFilename() const;
00146   virtual std::string getOutputSoundfileName() const;
00147   virtual std::string getOrchestra() const;
00148   virtual void setOrchestra(std::string orchestra);
00149   virtual int getInstrumentCount() const;
00150   virtual std::string getOrchestraHeader() const;
00151   virtual bool getInstrument(int number, std::string &definition) const;
00152   //virtual bool getInstrumentNumber(int index, std::string &definition) const;
00153   virtual bool getInstrument(std::string name, std::string &definition) const;
00154   virtual std::map<int, std::string> getInstrumentNames() const;
00155   virtual std::string getScore() const;
00156   virtual void setScore(std::string score);
00157   virtual int getArrangementCount() const;
00158   virtual std::string getArrangement(int index) const;
00159   virtual void addArrangement(std::string instrument);
00160   virtual void setArrangement(int index, std::string instrument);
00161   virtual void insertArrangement(int index, std::string instrument);
00162   virtual void removeArrangement(int index);
00163   virtual void setCSD(std::string xml);
00164   virtual std::string getCSD() const;
00165   virtual void addScoreLine(const std::string line);
00166   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8, double p9, double p10, double p11);
00167   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8, double p9, double p10);
00168   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8, double p9);
00169   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6, double p7, double p8);
00170   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6, double p7);
00171   virtual void addNote(double p1, double p2, double p3, double p4, double p5, double p6);
00172   virtual void addNote(double p1, double p2, double p3, double p4, double p5);
00173   virtual void addNote(double p1, double p2, double p3, double p4);
00174   virtual void addNote(double p1, double p2, double p3);
00175   virtual bool exportForPerformance() const;
00176   virtual void removeAll();
00177   virtual void removeCommand();
00178   virtual void removeOrchestra();
00179   virtual void removeScore();
00180   virtual void removeArrangement();
00181   virtual void removeMidifile();
00182   //virtual void getInstrumentNames(std::vector<std::string> &names) const;
00183   virtual bool loadOrcLibrary(const char *filename = 0);
00184 };
00185 
00186 #endif   //     CSOUND_FILE_H
00187 

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