csPerfThread.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CSOUND_CSPERFTHREAD_HPP
00025 #define CSOUND_CSPERFTHREAD_HPP
00026
00027 class CsoundPerformanceThreadMessage;
00028 class CsPerfThread_PerformScore;
00029
00044 #ifdef SWIGPYTHON
00045 struct PUBLIC pycallbackdata {
00046 PyObject *func;
00047 PyObject *data;
00048 };
00049 #endif
00050
00051 class PUBLIC CsoundPerformanceThread {
00052 private:
00053 volatile CsoundPerformanceThreadMessage *firstMessage;
00054 CsoundPerformanceThreadMessage *lastMessage;
00055 CSOUND *csound;
00056 void *queueLock;
00057 void *pauseLock;
00058 void *flushLock;
00059 void *perfThread;
00060 int paused;
00061 int status;
00062 void * cdata;
00063
00064 int Perform();
00065 void csPerfThread_constructor(CSOUND *);
00066 void QueueMessage(CsoundPerformanceThreadMessage *);
00067 void (*processcallback)(void *cdata);
00068 public:
00069
00070 #ifdef SWIGPYTHON
00071 PyThreadState *_tstate;
00072 pycallbackdata pydata;
00073 #endif
00074
00077 void *GetProcessCallback() { return (void *)processcallback; }
00078
00082 void SetProcessCallback(void (*Callback)(void *), void *cbdata){
00083 processcallback = Callback;
00084 cdata = cbdata;
00085 }
00089 CSOUND *GetCsound()
00090 {
00091 return csound;
00092 }
00098 int GetStatus()
00099 {
00100 return status;
00101 }
00105 void Play();
00109 void Pause();
00114 void TogglePause();
00118 void Stop();
00125 void ScoreEvent(int absp2mode, char opcod, int pcnt, const MYFLT *p);
00129 void InputMessage(const char *s);
00133 void SetScoreOffsetSeconds(double timeVal);
00140 int Join();
00145 void FlushMessageQueue();
00146
00147 CsoundPerformanceThread(Csound *);
00148 CsoundPerformanceThread(CSOUND *);
00149 ~CsoundPerformanceThread();
00150
00151 friend class CsoundPerformanceThreadMessage;
00152 friend class CsPerfThread_PerformScore;
00153 };
00154
00155 #endif // CSOUND_CSPERFTHREAD_HPP
00156