Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


RtWvIn.h

00001 #ifndef STK_RTWVIN_H
00002 #define STK_RTWVIN_H
00003 
00004 #include "WvIn.h"
00005 #include "RtAudio.h"
00006 #include "Mutex.h"
00007 
00008 namespace stk {
00009 
00010 /***************************************************/
00029 /***************************************************/
00030 
00031 class RtWvIn : public WvIn
00032 {
00033 public:
00035 
00042   RtWvIn( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
00043           int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
00044 
00046   ~RtWvIn();
00047 
00049 
00053   void start( void );
00054 
00056 
00060   void stop( void );
00061 
00063 
00072   StkFloat lastOut( unsigned int channel = 0 );
00073 
00075 
00084   StkFloat tick( unsigned int channel = 0 );
00085 
00087 
00094   StkFrames& tick( StkFrames& frames );
00095 
00096   // This function is not intended for general use but must be
00097   // public for access from the audio callback function.
00098   void fillBuffer( void *buffer, unsigned int nFrames );
00099 
00100 protected:
00101 
00102          RtAudio adc_;
00103   Mutex mutex_;
00104   bool stopped_;
00105   unsigned int readIndex_;
00106   unsigned int writeIndex_;
00107   unsigned int framesFilled_;
00108 
00109 };
00110 
00111 inline StkFloat RtWvIn :: lastOut( unsigned int channel )
00112 {
00113 #if defined(_STK_DEBUG_)
00114   if ( channel >= data_.channels() ) {
00115     oStream_ << "RtWvIn::lastOut(): channel argument and audio stream are incompatible!";
00116     handleError( StkError::FUNCTION_ARGUMENT );
00117   }
00118 #endif
00119 
00120   return lastFrame_[channel];
00121 }
00122 
00123 } // stk namespace
00124 
00125 #endif

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