Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Public Member Functions | List of all members
stk::RtWvOut Class Reference

STK realtime audio (blocking) output class. More...

#include <RtWvOut.h>

Inheritance diagram for stk::RtWvOut:
stk::WvOut stk::Stk

Public Member Functions

 RtWvOut (unsigned int nChannels=1, StkFloat sampleRate=Stk::sampleRate(), int device=0, int bufferFrames=RT_BUFFER_SIZE, int nBuffers=20)
 Default constructor. More...
 
 ~RtWvOut ()
 Class destructor.
 
void start (void)
 Start the audio output stream. More...
 
void stop (void)
 Stop the audio output stream. More...
 
void tick (const StkFloat sample)
 Output a single sample to all channels in a sample frame. More...
 
void tick (const StkFrames &frames)
 Output the StkFrames data. More...
 
- Public Member Functions inherited from stk::WvOut
 WvOut (void)
 Default constructor.
 
unsigned long getFrameCount (void) const
 Return the number of sample frames output.
 
StkFloat getTime (void) const
 Return the number of seconds of data output.
 
bool clipStatus (void)
 Returns true if clipping has been detected during output since instantiation or the last reset.
 
void resetClipStatus (void)
 Reset the clipping status to false.
 
- Public Member Functions inherited from stk::Stk
void ignoreSampleRateChange (bool ignore=true)
 A function to enable/disable the automatic updating of class data when the STK sample rate changes. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from stk::Stk
static StkFloat sampleRate (void)
 Static method that returns the current STK sample rate.
 
static void setSampleRate (StkFloat rate)
 Static method that sets the STK sample rate. More...
 
static std::string rawwavePath (void)
 Static method that returns the current rawwave path.
 
static void setRawwavePath (std::string path)
 Static method that sets the STK rawwave path.
 
static void swap16 (unsigned char *ptr)
 Static method that byte-swaps a 16-bit data type.
 
static void swap32 (unsigned char *ptr)
 Static method that byte-swaps a 32-bit data type.
 
static void swap64 (unsigned char *ptr)
 Static method that byte-swaps a 64-bit data type.
 
static void sleep (unsigned long milliseconds)
 Static cross-platform method to sleep for a number of milliseconds.
 
static bool inRange (StkFloat value, StkFloat min, StkFloat max)
 Static method to check whether a value is within a specified range.
 
static void handleError (const char *message, StkError::Type type)
 Static function for error reporting and handling using c-strings.
 
static void handleError (std::string message, StkError::Type type)
 Static function for error reporting and handling using c++ strings.
 
static void showWarnings (bool status)
 Toggle display of WARNING and STATUS messages.
 
static void printErrors (bool status)
 Toggle display of error messages before throwing exceptions.
 
- Static Public Attributes inherited from stk::Stk
static const StkFormat STK_SINT8
 
static const StkFormat STK_SINT16
 
static const StkFormat STK_SINT24
 
static const StkFormat STK_SINT32
 
static const StkFormat STK_FLOAT32
 
static const StkFormat STK_FLOAT64
 
- Protected Member Functions inherited from stk::Stk
 Stk (void)
 Default constructor.
 
virtual ~Stk (void)
 Class destructor.
 
virtual void sampleRateChanged (StkFloat newRate, StkFloat oldRate)
 This function should be implemented in subclasses that depend on the sample rate.
 
void addSampleRateAlert (Stk *ptr)
 Add class pointer to list for sample rate change notification.
 
void removeSampleRateAlert (Stk *ptr)
 Remove class pointer from list for sample rate change notification.
 
void handleError (StkError::Type type) const
 Internal function for error reporting that assumes message in oStream_ variable.
 

Detailed Description

STK realtime audio (blocking) output class.

This class provides a simplified interface to RtAudio for realtime audio output. It is a subclass of WvOut. This class makes use of RtAudio's callback functionality by creating a large ring-buffer into which data is written. This class should not be used when low-latency is desired.

RtWvOut supports multi-channel data in interleaved format. It is 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–2014.

Constructor & Destructor Documentation

stk::RtWvOut::RtWvOut ( unsigned int  nChannels = 1,
StkFloat  sampleRate = Stk::sampleRate(),
int  device = 0,
int  bufferFrames = RT_BUFFER_SIZE,
int  nBuffers = 20 
)

Default constructor.

The default 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.

Member Function Documentation

void stk::RtWvOut::start ( void  )

Start the audio output stream.

The stream is started automatically, if necessary, when a tick() method is called.

void stk::RtWvOut::stop ( void  )

Stop the audio output stream.

It may be necessary to use this method to avoid undesireable audio buffer cycling if you wish to temporarily stop audio output.

void stk::RtWvOut::tick ( const StkFloat  sample)
virtual

Output a single sample to all channels in a sample frame.

If the device is "stopped", it is "started".

Implements stk::WvOut.

void stk::RtWvOut::tick ( const StkFrames frames)
virtual

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.

Implements stk::WvOut.


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

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