#include <soundio.h>
Public Member Functions | |
SoundIoFilter () | |
Standard constructor. | |
virtual | ~SoundIoFilter () |
Standard destructor. | |
virtual bool | FltPrepare (SoundIoFormat const &fmt, bool up, bool dn, ErrorInfo *error=0)=0 |
Request filter to prepare for stream processing. | |
virtual void | FltCleanup (void)=0 |
Release filter from stream processing. | |
virtual SoundIoBuffer const * | FltProcess (bool up, SoundIoBuffer const &src, SoundIoBuffer &dest)=0 |
Request processing of a sample buffer. |
virtual bool FltPrepare | ( | SoundIoFormat const & | fmt, | |
bool | up, | |||
bool | dn, | |||
ErrorInfo * | error = 0 | |||
) | [pure virtual] |
Request filter to prepare for stream processing.
As part of starting stream processing, SoundIoPump will invoke this method on all registered filters.
[in] | fmt | PCM audio format to be used in the stream |
[in] | up | true if samples will move up through this filter, false otherwise. |
[in] | dn | true if samples will move down through this filter, false otherwise. |
[out] | error | Error information structure. If this method fails and returns false, and error is not 0, error will be filled out with information on the cause of the failure. |
true | Filter is prepared and ready to process samples. | |
false | Filter is not prepared, effectively vetoing stream setup. This will cause SoundIoPump::Start() to fail. |
up
and down
will be true
. For single direction streams, either up
or down
will be true
.If this method succeeds, future calls to FltProcess() may be made.
virtual void FltCleanup | ( | void | ) | [pure virtual] |
Release filter from stream processing.
As part of terminating stream processing, SoundIoPump will invoke this method on all registered filters.
After this method returns, no further calls to FltProcess() will be made until the next successful call to FltPrepare().
virtual SoundIoBuffer const* FltProcess | ( | bool | up, | |
SoundIoBuffer const & | src, | |||
SoundIoBuffer & | dest | |||
) | [pure virtual] |
Request processing of a sample buffer.
The SoundIoPump object handles transfer of samples between two SoundIo objects, referred to as its bottom and top endpoints. Between the endpoints, filters may be stacked to intercept and process samples as they pass between the endpoints.
Sample data in a bidirectional pump configuration is transferred first from top to bottom, then bottom to top. In such a configuration, for each packet of sample data transferred, each filter will receive a FltProcess() call with up
= false
, then another FltProcess() call with up
= true
.
up | true if the samples are moving up through the filter stack, false otherwise. | |
src | Buffer containing source samples for filter | |
dest | Buffer to contain result samples from filter, if modification is required. |