Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


RtWvOut.h
1 #ifndef STK_RTWVOUT_H
2 #define STK_RTWVOUT_H
3 
4 #include "WvOut.h"
5 #include "RtAudio.h"
6 #include "Mutex.h"
7 
8 namespace stk {
9 
10 /***************************************************/
28 /***************************************************/
29 
30 class RtWvOut : public WvOut
31 {
32  public:
33 
35 
42  RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
43  int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
44 
47 
49 
53  void start( void );
54 
56 
60  void stop( void );
61 
63 
66  void tick( const StkFloat sample );
67 
69 
76  void tick( const StkFrames& frames );
77 
78  // This function is not intended for general use but must be
79  // public for access from the audio callback function.
80  int readBuffer( void *buffer, unsigned int frameCount );
81 
82  protected:
83 
84  RtAudio dac_;
85  Mutex mutex_;
86  bool stopped_;
87  unsigned int readIndex_;
88  unsigned int writeIndex_;
89  long framesFilled_;
90  unsigned int status_; // running = 0, emptying buffer = 1, finished = 2
91 
92 };
93 
94 } // stk namespace
95 
96 #endif
Realtime audio i/o C++ classes.
Definition: RtAudio.h:280
STK mutex class.
Definition: Mutex.h:37
STK realtime audio (blocking) output class.
Definition: RtWvOut.h:31
void tick(const StkFrames &frames)
Output the StkFrames data.
void tick(const StkFloat sample)
Output a single sample to all channels in a sample frame.
void start(void)
Start the audio output stream.
void stop(void)
Stop the audio output stream.
~RtWvOut()
Class destructor.
RtWvOut(unsigned int nChannels=1, StkFloat sampleRate=Stk::sampleRate(), int device=0, int bufferFrames=RT_BUFFER_SIZE, int nBuffers=20)
Default constructor.
An STK class to handle vectorized audio data.
Definition: Stk.h:279
static StkFloat sampleRate(void)
Static method that returns the current STK sample rate.
Definition: Stk.h:148
STK audio output abstract base class.
Definition: WvOut.h:23
The STK namespace.
Definition: ADSR.h:6

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