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 SHELL_H 00023 #define SHELL_H 00024 00025 #include "Platform.hpp" 00026 #ifdef SWIG 00027 %module CsoundAC 00028 %include "std_string.i" 00029 %{ 00030 #include <string> 00031 %} 00032 #else 00033 #include <string> 00034 #endif 00035 00036 namespace csound 00037 { 00038 typedef void PyObject_; 00039 extern void (*Py_Initialize_)(void); 00040 extern void (*Py_Finalize_)(void); 00041 extern void (*PySys_SetArgv_)(int, char **); 00042 extern PyObject_ *(*PyImport_ImportModule_)(char *); 00043 extern void (*PyErr_Print_)(void); 00044 extern PyObject_ *(*PyObject_GetAttrString_)(PyObject_ *, char *); 00045 extern int (*PyRun_SimpleFileEx_)(FILE *, const char *, int); 00046 extern int (*PyRun_SimpleString_)(const char *); 00047 extern PyObject_ *(*PyObject_CallMethod_)(PyObject_ *, 00048 char *, char *, ...); 00049 extern long (*PyLong_AsLong_)(PyObject_ *); 00050 00059 class Shell 00060 { 00061 protected: 00062 static void *pythonLibrary; 00063 static const char *pythonLibraryPathList[]; 00064 std::string filename; 00065 std::string script; 00066 public: 00067 Shell(); 00068 virtual ~Shell(); 00069 virtual void open(); 00070 virtual void close(); 00071 virtual void main(int argc, char **argv); 00072 virtual void initialize(); 00073 virtual void clear(); 00074 static std::string generateFilename(); 00075 virtual void setFilename(std::string filename); 00076 virtual std::string getFilename() const; 00077 virtual std::string getOutputSoundfileName() const; 00078 virtual std::string getMidiFilename() const; 00079 virtual std::string getScript() const; 00080 virtual void setScript(std::string text); 00081 virtual void load(std::string filename); 00082 virtual void loadAppend(std::string filename); 00083 virtual void save(std::string filename) const; 00084 virtual void save() const; 00085 virtual int runScript(); 00086 virtual int runScript(std::string script); 00087 virtual void stop(); 00088 }; 00089 } 00090 #endif