Logo Search packages:      
Sourcecode: csound version File versions  Download package

CsoundPerformanceThread Class Reference

#include <csPerfThread.hpp>

List of all members.

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.

An example program using the CsoundPerformanceThread class

include <stdio.h> include "csound.hpp" include "csPerfThread.hpp"

int main(int argc, char *argv[]) { int result=0; Csound cs; csoundInitialize(NULL,NULL,NULL); result = cs.Compile(argc,argv);

if(!result) { CsoundPerformanceThread perfThread(cs.GetCsound()); perfThread.Play(); // Starts performance while(perfThread.GetStatus() == 0); // nothing to do here... but you could process input events, graphics etc perfThread.Stop(); // Stops performance. In fact, performance should have already been finished, so this is just an example of how to stop if you need perfThread.Join(); // always call Join() after Stop() as a rule of thumb. } else{ printf("csoundCompile returned an error\n"); return 1; }

return 0; }

Definition at line 85 of file csPerfThread.hpp.

Public Member Functions

 CsoundPerformanceThread (CSOUND *)
 CsoundPerformanceThread (Csound *)
void FlushMessageQueue ()
CSOUND * GetCsound ()
void * GetProcessCallback ()
int GetStatus ()
void InputMessage (const char *s)
int isRunning ()
int Join ()
void Pause ()
void Play ()
void ScoreEvent (int absp2mode, char opcod, int pcnt, const MYFLT *p)
void SetProcessCallback (void(*Callback)(void *), void *cbdata)
void SetScoreOffsetSeconds (double timeVal)
void Stop ()
void TogglePause ()

Private Member Functions

void csPerfThread_constructor (CSOUND *)
int Perform ()
void QueueMessage (CsoundPerformanceThreadMessage *)

Private Attributes

void * cdata
CSOUND * csound
void * flushLock
int paused
void * pauseLock
void * perfThread
void(* processcallback )(void *cdata)
void * queueLock
int running
int status


class CsoundPerformanceThreadMessage
class CsPerfThread_PerformScore

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index