Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


RtWvOut.h

00001 #ifndef STK_RTWVOUT_H
00002 #define STK_RTWVOUT_H
00003 
00004 #include "WvOut.h"
00005 #include "RtAudio.h"
00006 #include "Mutex.h"
00007 
00008 namespace stk {
00009 
00010 /***************************************************/
00028 /***************************************************/
00029 
00030 class RtWvOut : public WvOut
00031 {
00032  public:
00033 
00035 
00042   RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
00043            int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
00044 
00046   ~RtWvOut();
00047 
00049 
00053   void start( void );
00054 
00056 
00060   void stop( void );
00061 
00063 
00066   void tick( const StkFloat sample );
00067 
00069 
00076   void tick( const StkFrames& frames );
00077 
00078   // This function is not intended for general use but must be
00079   // public for access from the audio callback function.
00080   int readBuffer( void *buffer, unsigned int frameCount );
00081 
00082  protected:
00083 
00084   RtAudio dac_;
00085   Mutex mutex_;
00086   bool stopped_;
00087   unsigned int readIndex_;
00088   unsigned int writeIndex_;
00089   long framesFilled_;
00090   unsigned int status_; // running = 0, emptying buffer = 1, finished = 2
00091 
00092 };
00093 
00094 } // stk namespace
00095 
00096 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.