CsoundPerformanceThread Class Reference

#include <csPerfThread.hpp>

Collaboration diagram for CsoundPerformanceThread:

Collaboration graph
[legend]

Detailed Description

CsoundPerformanceThread(Csound *) CsoundPerformanceThread(CSOUND *)

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.

Public Member Functions

void * GetProcessCallback ()
void SetProcessCallback (void(*Callback)(void *), void *cbdata)
CSOUNDGetCsound ()
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
CSOUNDcsound
void * queueLock
void * pauseLock
void * flushLock
void * perfThread
int paused
int status
void * cdata
void(* processcallback )(void *cdata)

Friends

class CsoundPerformanceThreadMessage
class CsPerfThread_PerformScore


Constructor & Destructor Documentation

CsoundPerformanceThread::CsoundPerformanceThread ( Csound *   ) 

CsoundPerformanceThread::CsoundPerformanceThread ( CSOUND  ) 

CsoundPerformanceThread::~CsoundPerformanceThread (  ) 


Member Function Documentation

int CsoundPerformanceThread::Perform (  )  [private]

void CsoundPerformanceThread::csPerfThread_constructor ( CSOUND  )  [private]

void CsoundPerformanceThread::QueueMessage ( CsoundPerformanceThreadMessage *   )  [private]

void* CsoundPerformanceThread::GetProcessCallback (  )  [inline]

Returns the process callback as a void pointer

void CsoundPerformanceThread::SetProcessCallback ( void(*)(void *)  Callback,
void *  cbdata 
) [inline]

Sets the process callback.

CSOUND* CsoundPerformanceThread::GetCsound (  )  [inline]

Returns the Csound instance 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::Play (  ) 

Continues performance if it was paused.

void CsoundPerformanceThread::Pause (  ) 

Pauses performance (can be continued by calling Play()).

void CsoundPerformanceThread::TogglePause (  ) 

Pauses performance unless it is already paused, in which case it is continued.

void CsoundPerformanceThread::Stop (  ) 

Stops performance (cannot be continued).

void CsoundPerformanceThread::ScoreEvent ( int  absp2mode,
char  opcod,
int  pcnt,
const MYFLT *  p 
)

Sends a score event of type 'opcod' (e.g. 'i' for a note event), with 'pcnt' p-fields in array 'p' (p[0] is p1). If absp2mode is non-zero, the start time of the event is measured from the beginning of performance, instead of the default of relative to the current time.

void CsoundPerformanceThread::InputMessage ( const char *  s  ) 

Sends a score event as a string, similarly to line events (-L).

void CsoundPerformanceThread::SetScoreOffsetSeconds ( double  timeVal  ) 

Sets the playback time pointer to the specified value (in seconds).

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::FlushMessageQueue (  ) 

Waits until all pending messages (pause, send score event, etc.) are actually received by the performance thread.


Friends And Related Function Documentation

friend class CsoundPerformanceThreadMessage [friend]

friend class CsPerfThread_PerformScore [friend]


Field Documentation

volatile CsoundPerformanceThreadMessage* CsoundPerformanceThread::firstMessage [private]

CsoundPerformanceThreadMessage* CsoundPerformanceThread::lastMessage [private]


Generated on Sun Nov 9 00:08:21 2008 for Csound and CsoundAC by  doxygen 1.5.6