SPKitProcessor contains member functions common to all SPKit classes. The setInput(SPKitProcessor* ip) function is used for initialization and connecting a signal input to the object. A derived class may have its own initialization function, which must be used instead of the standard setInput() function. For example, SPKitDelay has a setInputAndDelayTime(SPKitProcessor* ip, SPKitFloat dt) function for connecting to the signal input and setting the delay time.
Other important functions inherited from SPKitProcesssor are getSamplingRate() and getChannelCount() for retrieving the sampling rate and number of channels of the object's output signal.
All SPKit classes inherit from SPKitProcessor. It provides several useful member functions and variables which can be accessed from subclasses. Most importantly, SPKitProcessor defines a setInput() function for connecting and initializing signal processing objects and a getSample() function for retrieving and processing signal samples.
setInput() initializes a sound processing module by reading values for inputSamplingRate, inputChannelCount and originalDataFormat. setInput also initializes input to newInput.
Derived classes may redefine setInput() to do any initialization that requires data of the members in the paragraph above. A derived class should always call the base class setInput() before accessing any inherited members (e.g. those mentioned above). from its own setInput() or equivalent initialization function (e.g. see SPKitDelay::setInputAndDelayTime()).
Note: SPKit objects are not fully initialized before setInput() is called. While it is error prone and not good C++ practice to leave an object in an uninitialized state after construction, there is a good reason for allowing this in SPKit: a derived class may call its base class' setInput() anywhere in its own definition of setInput(). This was found very useful in many SPKit classes and would not have been possible with standard C++ constructors.
Signal multiplexing objects, and other objects that may have multiple outputs, may need to override setOutput() to store all their outputs to an array instead of the default member variable output.
getSample() stores the processed sample in outputSample. The function returns 0 on end of signal, 1 otherwise. SPKitProcessor::getSample() has no signal processing functionality. It just retrieves a sample from input and stores it in outputSample. However, the function is useful and is inherited by composite processors, such as SPKitComb and SPKitComb
caller is a pointer to the object that requests a sample. caller can be used, for example, by signal routing objects (e.g. a multiplexer) to direct samples to the right outputs.
returns inputSamplingRate. A sampling rate converter class should override it.
The following member functions are declared non-virtual:
Author: Kai Lassfolk