Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


WvOut Class Reference

#include <WvOut.h>

Inheritance diagram for WvOut:

Stk RtWvOut TcpWvOut List of all members.

Detailed Description

STK audio data output base class.

This class provides output support for various audio file formats. It also serves as a base class for "realtime" streaming subclasses.

WvOut writes samples to an audio file. It 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 takes a pointer to multi-channel sample frame data.

WvOut currently supports uncompressed WAV, AIFF, AIFC, SND (AU), MAT-file (Matlab), and STK RAW file formats. Signed integer (8-, 16-, and 32-bit) and floating- point (32- and 64-bit) data types are supported. STK RAW files use 16-bit integers by definition. MAT-files will always be written as 64-bit floats. If a data type specification does not match the specified file type, the data type will automatically be modified. Compressed data types are not supported.

Currently, WvOut is non-interpolating and the output rate is always Stk::sampleRate().

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

Definition at line 43 of file WvOut.h.

Public Member Functions

 WvOut ()
 Default constructor.

 WvOut (const char *fileName, unsigned int nChannels=1, FILE_TYPE type=WVOUT_WAV, Stk::StkFormat format=STK_SINT16)
 Overloaded constructor used to specify a file name, type, and data format with this object.

virtual ~WvOut ()
 Class destructor.

void openFile (const char *fileName, unsigned int nChannels=1, WvOut::FILE_TYPE type=WVOUT_WAV, Stk::StkFormat format=STK_SINT16)
 Create a file of the specified type and name and output samples to it in the given data format.

void closeFile (void)
 If a file is open, write out samples in the queue and then close it.

unsigned long getFrames (void) const
 Return the number of sample frames output.

StkFloat getTime (void) const
 Return the number of seconds of data output.

bool getClipStatus (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.

virtual void tick (const StkFloat sample)
 Output a single sample to all channels in a sample frame.

virtual void tick (const StkFloat *vector, unsigned int vectorSize)
 Output each sample in vector to all channels in vectorSize sample frames.

virtual void tick (const StkFrames &frames, unsigned int channel=1)
 Output a channel of the StkFrames object to all channels of the WvOut object.

virtual void tickFrame (const StkFloat *frameVector, unsigned int frames=1)
 Output the frameVector of sample frames of the given length.

virtual void tickFrame (const StkFrames &frames)
 Output the StkFrames data to the WvOut object.


Static Public Attributes

const FILE_TYPE WVOUT_RAW
const FILE_TYPE WVOUT_WAV
const FILE_TYPE WVOUT_SND
const FILE_TYPE WVOUT_AIF
const FILE_TYPE WVOUT_MAT


Constructor & Destructor Documentation

WvOut::WvOut const char *  fileName,
unsigned int  nChannels = 1,
FILE_TYPE  type = WVOUT_WAV,
Stk::StkFormat  format = STK_SINT16
 

Overloaded constructor used to specify a file name, type, and data format with this object.

An StkError is thrown for invalid argument values or if an error occurs when initializing the output file.


Member Function Documentation

void WvOut::openFile const char *  fileName,
unsigned int  nChannels = 1,
WvOut::FILE_TYPE  type = WVOUT_WAV,
Stk::StkFormat  format = STK_SINT16
 

Create a file of the specified type and name and output samples to it in the given data format.

An StkError is thrown for invalid argument values or if an error occurs when initializing the output file.

virtual void WvOut::tick const StkFloat  sample  )  [virtual]
 

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

An StkError is thrown if a file write error occurs.

Reimplemented in RtWvOut, and TcpWvOut.

virtual void WvOut::tick const StkFloat *  vector,
unsigned int  vectorSize
[virtual]
 

Output each sample in vector to all channels in vectorSize sample frames.

An StkError is thrown if a file write error occurs.

Reimplemented in RtWvOut, and TcpWvOut.

virtual void WvOut::tick const StkFrames frames,
unsigned int  channel = 1
[virtual]
 

Output a channel of the StkFrames object to all channels of the WvOut object.

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

Reimplemented in RtWvOut, and TcpWvOut.

virtual void WvOut::tickFrame const StkFloat *  frameVector,
unsigned int  frames = 1
[virtual]
 

Output the frameVector of sample frames of the given length.

An StkError is thrown if a file write error occurs.

Reimplemented in RtWvOut, and TcpWvOut.

virtual void WvOut::tickFrame const StkFrames frames  )  [virtual]
 

Output the StkFrames data to the WvOut object.

An StkError will be thrown if a file write error occurs or if there is an incompatability between the number of channels in the WvOut object and that in the StkFrames object.

Reimplemented in RtWvOut, and TcpWvOut.


Member Data Documentation

const FILE_TYPE WvOut::WVOUT_RAW [static]
 

STK RAW file type.

Definition at line 49 of file WvOut.h.

const FILE_TYPE WvOut::WVOUT_WAV [static]
 

WAV file type.

Definition at line 50 of file WvOut.h.

const FILE_TYPE WvOut::WVOUT_SND [static]
 

SND (AU) file type.

Definition at line 51 of file WvOut.h.

const FILE_TYPE WvOut::WVOUT_AIF [static]
 

AIFF file type.

Definition at line 52 of file WvOut.h.

const FILE_TYPE WvOut::WVOUT_MAT [static]
 

Matlab MAT-file type.

Definition at line 53 of file WvOut.h.


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.