Version 4.4.0

This commit is contained in:
Gary Scavone
2013-09-29 23:11:39 +02:00
committed by Stephen Sinclair
parent d199342e86
commit eccd8c9981
287 changed files with 11712 additions and 7676 deletions

View File

@@ -1,3 +1,12 @@
#ifndef STK_RTWVOUT_H
#define STK_RTWVOUT_H
#include "WvOut.h"
#include "RtAudio.h"
#include "Mutex.h"
namespace stk {
/***************************************************/
/*! \class RtWvOut
\brief STK realtime audio (blocking) output class.
@@ -9,35 +18,26 @@
low-latency is desired.
RtWvOut supports multi-channel data in interleaved format. It is
important to distinguish the tick() methods, which output single
samples to all channels in a sample frame, from the tickFrame()
method, which take a pointer or reference to multi-channel sample
frame data.
important to distinguish the tick() method that outputs a single
sample to all channels in a sample frame from the overloaded one
that takes a reference to an StkFrames object for multi-channel
and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
*/
/***************************************************/
#ifndef STK_RTWVOUT_H
#define STK_RTWVOUT_H
#include "WvOut.h"
#include "RtAudio.h"
class RtWvOut : public WvOut
{
public:
//! Default constructor.
/*!
The \e device argument is passed to RtAudio during
instantiation. The default value (zero) will select the default
device on your system. On systems with multiple
soundcards/devices, values greater than zero can be specified in
accordance with the order that the devices are enumerated by the
underlying audio API. The default buffer size of RT_BUFFER_SIZE
is defined in Stk.h. An StkError will be thrown if an error
occurs duing instantiation.
The default \e device argument value (zero) will select the
default output device on your system. The first device enumerated
by the underlying audio API is specified with a value of one. The
default buffer size of RT_BUFFER_SIZE is defined in Stk.h. An
StkError will be thrown if an error occurs duing instantiation.
*/
RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 20 );
@@ -48,7 +48,7 @@ class RtWvOut : public WvOut
//! Start the audio output stream.
/*!
The stream is started automatically, if necessary, when a
tick() or tickFrame method is called.
tick() method is called.
*/
void start( void );
@@ -59,16 +59,30 @@ class RtWvOut : public WvOut
*/
void stop( void );
// This function is not intended for general use but had to be made
//! Output a single sample to all channels in a sample frame.
/*!
If the device is "stopped", it is "started".
*/
void tick( const StkFloat sample );
//! Output the StkFrames data.
/*!
If the device is "stopped", it is "started". The number of
channels in the StkFrames argument must equal the number of
channels specified during instantiation. However, this is only
checked if _STK_DEBUG_ is defined during compilation, in which
case an incompatibility will trigger an StkError exception.
*/
void tick( StkFrames& frames );
// This function is not intended for general use but must be
// public for access from the audio callback function.
int readBuffer( void *buffer, unsigned int frameCount );
protected:
void computeSample( const StkFloat sample );
void computeFrames( const StkFrames& frames );
RtAudio dac_;
Mutex mutex_;
bool stopped_;
unsigned int readIndex_;
unsigned int writeIndex_;
@@ -77,4 +91,6 @@ class RtWvOut : public WvOut
};
} // stk namespace
#endif