The SndIO class is the base class for all IO operations: file, RT audio, midi, text/console and memory. This class implements input/output to the stdio. It reads/writes samples as text (floats) to the standard IO, making possible the use of UNIX-like pipes and redirection.
SndObj** m_IOobjs
float* m_output
float m_sr
short m_channels
short m_bits
int m_vecsize
int m_vecpos
int m_error
float GetSr()
int GetVectorSize()
short GetChannels()
short GetSize()
float Output(int pos, int channel)
short SetOutput(short channel, SndObj* input)
virtual short Read()
virtual short Write()
virtual char* ErrorMessage()
SndIO(short channels=1, short bits=16,SndObj** inputlist=0, int vecsize=DEF_VECSIZE, float sr=DEF_SR)
This method constructs an object of the SndIO class. Construction parameters are:
short channels: number of input/output channels
short bits: precision in bits (not directly applicable to this
class, since it outputs floats, whatever precision is specified). Defaults to
16 bits (shorts).
SndObj** inputlist: list of input SndObj/SndObj
-derived objects, one for each output channel.
float GetSr()
Returns the current sampling rate in Hz of the object.
int GetVectorSize()
Returns the current output vector size of the object.
short GetSize()
Returns the size (in bits) of the input/output sample.
short GetChannels()
Returns the number of input/output channels.
short SetOutput(short channel, SndObj* input)
Sets the output channels of a SndIO object. Returns 1 if successfully patched.
short channel: output channel to be set. The channel must exist.
SndObj* input: input SndObj/SndObj
-derived object to that channel.
virtual short Read()
Reads one buffer of input signal. Returns 1 if successful. This function is normally placed in a loop with other processing functions such as DoProcess().
virtual short Write()
Writes one buffer of output signal. Returns 1 if successful. This function is normally placed in a loop with other processing functions such as DoProcess().
virtual char* ErrorMessage()
This method retrieves an error string from a SndObj class object. It is used for simple debugging.
SndObj** m_IOobjs: input object list, one item per channel.
Allocated by the SndIO constructor.
float* m_output: signal vector, used by input objects. The method
Output() is used to access the samples in this buffer. It works in an
analoguous way to SndObj-derived classes. Note that this is only relevant
four signal input.
float m_sr: sampling rate in Hz. Set ONLY at construction.
short m_channels: number of channels.
short m_bits: precision in bits.
int m_vecsize: size of signal vector (in items).
int m_vecpos: counter to use when accessing vectors of other objects.
int m_error: error code
int m_samples: number of samples in the signal vector (vecsize*channels).
SndObj Library version 2.0
© Victor Lazzarini, 2001
Music Technology Laboratory
NUI Maynooth