System.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 CROSSPLATFORM_H
00023 #define CROSSPLATFORM_H
00024 
00025 #include "Platform.hpp"
00026 #ifdef SWIG
00027 %module CsoundAC
00028 %{
00029 #include "CppSound.hpp"
00030 #include <string>
00031 #include <vector>
00032 #include <cstdarg>
00033 #include <ctime>
00034   %}
00035 #else
00036 #include "CppSound.hpp"
00037 #include <string>
00038 #include <vector>
00039 #include <cstdarg>
00040 #include <ctime>
00041 #endif
00042 
00043 namespace csound
00044 {
00045   class Logger
00046   {
00047   public:
00048     Logger();
00049     virtual ~Logger();
00050     virtual void write(const char *text);
00051   };
00052 
00053   typedef void (*MessageCallbackType)(CSOUND *csound, int attribute, const char *format, va_list marker);
00054 
00058   class System
00059   {
00060     static void *userdata_;
00061     static int messageLevel;
00062     static void (*messageCallback)(CSOUND *csound, int attribute, const char *format, va_list valist);
00063     static FILE *logfile;
00064   public:
00065     enum Level
00066       {
00067         ERROR_LEVEL             = 1,
00068         WARNING_LEVEL           = 2,
00069         INFORMATION_LEVEL       = 4,
00070         DEBUGGING_LEVEL         = 8
00071       };
00076     static void parsePathname(const std::string pathname, std::string &drive, std::string &base, std::string &file, std::string &extension);
00080     static int openLibrary(void **library, std::string filename);
00085     static void *getSymbol(void *library, std::string name);
00089     static void closeLibrary(void *library);
00094     static std::vector<std::string> getFilenames(std::string directoryName);
00099     static std::vector<std::string> getDirectoryNames(std::string directoryName);
00103     static void *createThread(void (*threadRoutine)(void *threadData), void *data, int priority);
00107     static void *createThreadLock();
00112     static void waitThreadLock(void *lock, size_t timeoutMilliseconds = 0);
00116     static void notifyThreadLock(void *lock);
00120     static void destroyThreadLock(void *lock);
00124     static int setMessageLevel(int messageLevel);
00128     static void yieldThread();
00132     static int getMessageLevel();
00136     static void setUserdata(void *userdata);
00140     static void *getUserdata();
00141 
00146     static void setLogfile(FILE *logfile);
00147 
00152     static FILE *getLogfile();
00153 #ifndef SWIG
00154 
00157     static void error(CSOUND *csound, const char *format,...);
00161     static void error(const char *format,...);
00165     static void warn(CSOUND *csound, const char *format,...);
00169     static void warn(const char *format,...);
00173     static void inform(CSOUND *csound, const char *format,...);
00177     static void inform(const char *format,...);
00181     static void debug(CSOUND *csound, const char *format,...);
00185     static void debug(const char *format,...);
00189     static void message(CSOUND *csound, const char *format,...);
00193     static void message(const char *format,...);
00197     static void message(CSOUND *csound, const char *format, va_list valist);
00201 #if defined(MSVC)
00202     static void message(const char *format, va_list valist);
00203 #else
00204     PUBLIC static void message(const char *format, va_list valist);
00205 #endif
00206 
00209     static void message(CSOUND *csound, int level, const char *format,...);
00213     static void message(CSOUND *csound, int attribute, const char *format, va_list valist);
00217     static void setMessageCallback(MessageCallbackType messageCallback_);
00221     static MessageCallbackType getMessageCallback();
00222 #endif
00223 
00226     static int execute(const char *command);
00230     static int shellOpen(const char *filename, const char *command = "open");
00235     static std::string getSharedLibraryExtension();
00239     static clock_t startTiming();
00243     static double stopTiming(clock_t startedAt);
00247     static void sleep(double milliseconds);
00251     static void beep();
00252   };
00253 
00257   class ThreadLock
00258   {
00259     void *lock;
00260   public:
00261     ThreadLock();
00262     virtual ~ThreadLock();
00267     virtual void open();
00271     virtual void close();
00275     virtual bool isOpen();
00280     virtual void startWait(size_t timeoutMilliseconds = 0);
00284     virtual void endWait();
00285   };
00286 }
00287 #endif
00288 

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