next up previous contents
Next: Feature related types Up: Type definitions Previous: Type definitions   Contents

Waveform related types

There are three main types related to waveforms. A waveform is stored in a structure defined as


    typedef 		 struct { 

unsigned long n; /* number of samples */
sample_t *s; /* array of samples */
} spsig_t;
where sample_t is a float. To allow for a control of the amount of memory used for I/O functions, I/Os are made using a waveform buffer defined as

    typedef 		 struct { 

unsigned long m; /* maximum number of samples */
unsigned long n; /* number of samples */
sample_t *s; /* array of samples */
} sigbuf_t;
Finally, waveform I/Os rely on the use of a waveform stream whose corresponding structure is given by

    typedef 		 struct { 

char *name; /* stream file name (NULL if stdin) */
void *f; /* input stream (FILE or SP_FILE) */
int format; /* stream format */
unsigned long nsamples; /* total number of samples in stream */
unsigned long nread; /* number of samples read */
float Fs; /* sample rate */
unsigned short nchannels; /* number of channels */
int nbps; /* bytes per samples and channel */
int swap; /* to swap or not to swap? */
sigbuf_t *buf; /* input buffer */
} sigstream_t;


next up previous contents
Next: Feature related types Up: Type definitions Previous: Type definitions   Contents
Guillaume Gravier 2003-05-07