SPKitReader


User's Guide

SPKitReader is a signal input class. It requests samples from an input soundfile.

SPKitReader is connected to its input soundfile with the setInput(const char* sf) function, where sf is the name of the input soundfile. setInput() opens the soundfile for reading.

Audio samples are requested from SPKitReader with the getSample() function.

Here is an example.

The current implementation of SPKitReader supports only 16 bit linear NeXT/SUN audio files.


Programmer's Reference

Defined in <spkit/reader.h>
Inherits from SPKitProcessor

SPKitReader overloads the setInput() function for opening an input soundfile for reading. SPKitReader also redefines getSample().

Public Members

SPKitError setInput(const char* sf)
connect an input soundfile to the object, open the file for reading and initialize the objects variables, such as inputSamplingRate, inputChannelCount and originalDataFormat, according to the information stored in the input soundfile header.
int getSample(SPKitSample& outputSample)
retrieve a processed audio sample

getSample() reads an audio sample from the input soundfile and stores it in outputSample. The sample is converted to SPKitSample and scaled between -1 and 1.

int32 getSampleCount()
return sampleCount
int32 getSamplesLeft()
return samplesLeft

Protected Members

These members are specific to the "generic" version of SPKit, which supports the NeXT/Sun soundfile format. The SGI version is not documented yet. The public members are the same in both versions.
FILE* filePtr
pointer to the output soundfile
SndHeader* fileHeader
pointer to the output soundfile header
int32 sampleCount
number of samples in the input soundfile
int32 samplesLeft
number of samples unread samples in the input soundfile

Return to SPKit home

Kai Lassfolk / University of Helsinki / kpl@elisir.helsinki.fi