Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


RtWvIn Class Reference

#include <RtWvIn.h>

Inheritance diagram for RtWvIn:

WvIn Stk List of all members.

Detailed Description

STK realtime audio (blocking) input class.

This class provides a simplified interface to RtAudio for realtime audio input. It is a protected subclass of WvIn. Because this class makes use of RtAudio's blocking output routines, its performance is less robust on systems where the audio API is callback-based (Macintosh CoreAudio and Windows ASIO).

RtWvIn supports multi-channel data in interleaved format. It is important to distinguish the tick() methods, which return samples produced by averaging across sample frames, from the tickFrame() methods, which return pointers to multi-channel sample frames. For single-channel data, these methods return equivalent values.

by Perry R. Cook and Gary P. Scavone, 1995 - 2004.

Definition at line 32 of file RtWvIn.h.

Public Member Functions

 RtWvIn (int nChannels=1, StkFloat sampleRate=Stk::sampleRate(), int device=0, int bufferFrames=RT_BUFFER_SIZE, int nBuffers=2)
 Default constructor.

 ~RtWvIn ()
 Class destructor.

void start (void)
 Start the audio input stream.

void stop (void)
 Stop the audio input stream.

StkFloat lastOut (void) const
 Return the average across the last output sample frame.

StkFloat tick (void)
 Read out the average across one sample frame of data.

StkFloat * tick (StkFloat *vector, unsigned int vectorSize)
 Read out vectorSize averaged sample frames of data in vector.

StkFramestick (StkFrames &frames, unsigned int channel=1)
 Fill a channel of the StkFrames object with averaged sample frames.

const StkFloat * lastFrame (void) const
 Return a pointer to the last output sample frame.

const StkFloat * tickFrame (void)
 Return a pointer to the next sample frame of data.

StkFloat * tickFrame (StkFloat *frameVector, unsigned int frames)
 Read out sample frames of data to frameVector.

StkFramestickFrame (StkFrames &frames)
 Fill the StkFrames object with sample frames of data and return the same reference.


Constructor & Destructor Documentation

RtWvIn::RtWvIn int  nChannels = 1,
StkFloat  sampleRate = Stk::sampleRate(),
int  device = 0,
int  bufferFrames = RT_BUFFER_SIZE,
int  nBuffers = 2
 

Default constructor.

The device argument is passed to RtAudio during instantiation. The default value (zero) will select the default device on your system or the first device found meeting the specified parameters. 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.


Member Function Documentation

void RtWvIn::start void   ) 
 

Start the audio input stream.

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

void RtWvIn::stop void   ) 
 

Stop the audio input stream.

It may be necessary to use this method to avoid audio underflow problems if you wish to temporarily stop audio input.

StkFloat RtWvIn::tick void   )  [virtual]
 

Read out the average across one sample frame of data.

An StkError will be thrown if an error occurs during input.

Reimplemented from WvIn.

StkFloat* RtWvIn::tick StkFloat *  vector,
unsigned int  vectorSize
[virtual]
 

Read out vectorSize averaged sample frames of data in vector.

An StkError will be thrown if an error occurs during input.

Reimplemented from WvIn.

StkFrames& RtWvIn::tick StkFrames frames,
unsigned int  channel = 1
[virtual]
 

Fill a channel of the StkFrames object with averaged sample frames.

The channel argument should be one or greater (the first channel is specified by 1). An StkError will be thrown if an error occurs during input or the channel argument is zero or it is greater than the number of channels in the StkFrames object.

Reimplemented from WvIn.

const StkFloat* RtWvIn::tickFrame void   )  [virtual]
 

Return a pointer to the next sample frame of data.

An StkError will be thrown if an error occurs during input.

Reimplemented from WvIn.

StkFloat* RtWvIn::tickFrame StkFloat *  frameVector,
unsigned int  frames
[virtual]
 

Read out sample frames of data to frameVector.

An StkError will be thrown if an error occurs during input.

Reimplemented from WvIn.

StkFrames& RtWvIn::tickFrame StkFrames frames  )  [virtual]
 

Fill the StkFrames object with sample frames of data and return the same reference.

An StkError will be thrown if an error occurs during input or there is an incompatability between the number of channels in the RtWvIn object and that in the StkFrames object.

Reimplemented from WvIn.


The documentation for this class was generated from the following file:
The Synthesis ToolKit in C++ (STK)
©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.