#include <csPerfThread.hpp>
Public Member Functions | |
void * | GetProcessCallback () |
void | SetProcessCallback (void(*Callback)(void *), void *cbdata) |
CSOUND * | GetCsound () |
int | GetStatus () |
void | Play () |
void | Pause () |
void | TogglePause () |
void | Stop () |
void | ScoreEvent (int absp2mode, char opcod, int pcnt, const MYFLT *p) |
void | InputMessage (const char *s) |
void | SetScoreOffsetSeconds (double timeVal) |
int | Join () |
void | FlushMessageQueue () |
CsoundPerformanceThread (Csound *) | |
CsoundPerformanceThread (CSOUND *) | |
~CsoundPerformanceThread () | |
Private Member Functions | |
int | Perform () |
void | csPerfThread_constructor (CSOUND *) |
void | QueueMessage (CsoundPerformanceThreadMessage *) |
Private Attributes | |
volatile CsoundPerformanceThreadMessage * | firstMessage |
CsoundPerformanceThreadMessage * | lastMessage |
CSOUND * | csound |
void * | queueLock |
void * | pauseLock |
void * | flushLock |
void * | perfThread |
int | paused |
int | status |
void * | cdata |
void(* | processcallback )(void *cdata) |
Friends | |
class | CsoundPerformanceThreadMessage |
class | CsPerfThread_PerformScore |
Performs a score in a separate thread until the end of score is reached, the playback (which is paused by default) is stopped by calling CsoundPerformanceThread::Stop(), or an error occurs. The constructor takes a Csound instance pointer as argument; it assumes that csoundCompile() was called successfully before creating the performance thread. Once the playback is stopped for one of the above mentioned reasons, the performance thread calls csoundCleanup() and returns.
CsoundPerformanceThread::CsoundPerformanceThread | ( | Csound * | ) |
CsoundPerformanceThread::CsoundPerformanceThread | ( | CSOUND * | ) |
CsoundPerformanceThread::~CsoundPerformanceThread | ( | ) |
void CsoundPerformanceThread::csPerfThread_constructor | ( | CSOUND * | ) | [private] |
void CsoundPerformanceThread::FlushMessageQueue | ( | ) |
Waits until all pending messages (pause, send score event, etc.) are actually received by the performance thread.
CSOUND* CsoundPerformanceThread::GetCsound | ( | ) | [inline] |
Returns the Csound instance pointer.
void* CsoundPerformanceThread::GetProcessCallback | ( | ) | [inline] |
Returns the process callback as a void pointer
int CsoundPerformanceThread::GetStatus | ( | ) | [inline] |
Returns the current status, zero if still playing, positive if the end of score was reached or performance was stopped, and negative if an error occured.
void CsoundPerformanceThread::InputMessage | ( | const char * | s | ) |
Sends a score event as a string, similarly to line events (-L).
int CsoundPerformanceThread::Join | ( | ) |
Waits until the performance is finished or fails, and returns a positive value if the end of score was reached or Stop() was called, and a negative value if an error occured. Also releases any resources associated with the performance thread object.
void CsoundPerformanceThread::Pause | ( | ) |
Pauses performance (can be continued by calling Play()).
int CsoundPerformanceThread::Perform | ( | ) | [private] |
void CsoundPerformanceThread::Play | ( | ) |
Continues performance if it was paused.
void CsoundPerformanceThread::QueueMessage | ( | CsoundPerformanceThreadMessage * | ) | [private] |
void CsoundPerformanceThread::ScoreEvent | ( | int | absp2mode, | |
char | opcod, | |||
int | pcnt, | |||
const MYFLT * | p | |||
) |
void CsoundPerformanceThread::SetProcessCallback | ( | void(*)(void *) | Callback, | |
void * | cbdata | |||
) | [inline] |
Sets the process callback.
void CsoundPerformanceThread::SetScoreOffsetSeconds | ( | double | timeVal | ) |
Sets the playback time pointer to the specified value (in seconds).
void CsoundPerformanceThread::Stop | ( | ) |
Stops performance (cannot be continued).
void CsoundPerformanceThread::TogglePause | ( | ) |
Pauses performance unless it is already paused, in which case it is continued.
friend class CsoundPerformanceThreadMessage [friend] |
friend class CsPerfThread_PerformScore [friend] |
void* CsoundPerformanceThread::cdata [private] |
CSOUND* CsoundPerformanceThread::csound [private] |
volatile CsoundPerformanceThreadMessage* CsoundPerformanceThread::firstMessage [private] |
void* CsoundPerformanceThread::flushLock [private] |
CsoundPerformanceThreadMessage* CsoundPerformanceThread::lastMessage [private] |
int CsoundPerformanceThread::paused [private] |
void* CsoundPerformanceThread::pauseLock [private] |
void* CsoundPerformanceThread::perfThread [private] |
void(* CsoundPerformanceThread::processcallback)(void *cdata) [private] |
void* CsoundPerformanceThread::queueLock [private] |
int CsoundPerformanceThread::status [private] |