Wave Arts VQE 1.00
Voice Quality Enhancement
Abstract interface to an audio device. More...
|virtual int||Open (WadParam *param, WadCallbackFn *inFn, WadCallbackFn *outFn, void *arg)=0|
|Open devices for streaming. |
|virtual int||Start ()=0|
|Start streaming. |
|virtual int||Stop ()=0|
|Stop streaming. |
|virtual void||Wait ()=0|
|Wait for stream to complete. |
|virtual void||Close ()=0|
|Close devices and release memory. |
|virtual bool||IsOpen ()=0|
|Test if streaming. |
|virtual WaAudioDev *||GetDevice ()=0|
|Get audio device. |
Abstract interface to an audio device.
The device port is an abstract interface to a device. Opening a device port creates a I/O stream with the device. The stream can be input, output, or input & output. Only one stream is supported per device instance, so you have to create a WaAudioDev for each stream. Derived ports can be used to connect processing objects to an actual device port. So this interface can be used for the audio device itself, or to implement a resampled port, a format conversion port, or an echo-cancelled port.
Implementation specific options are passed to the object constructor, which is not part of this interface. This way the Open call is the same for all device implementations.
Processing chaining is supported via the callback functions passed to Open(). Open can open a downstream port passing callbacks to its own processing functions which in turn call the original callbacks to read/write sound data. The constructor of a derived port will typically be passed the downstream object to Open, either a device or another port.
This is a convenient way to connect processing objects to devices, provided the desired architecture is known a priori. It's not so convenient to dynamically connect processing objects to devices. See WadResWASAPI for an example of a changing the architecture during an Open call.
Use Open to create all internal objects and open the device for streaming. After Open you must call Start to actually start the device streaming. Stop is used to stop the stream, which can be restarted using Start. Close closes the stream and releases all objects in use. In a chain of device ports, Close first closes the actual device at the end of the chain and then closes ports working back towards the application. Given a port, call GetDevice to get a pointer to the actual device at the end of the device chain.
If the audio thread quits due to a callback returning false, the stream does not automatically close, hence you can't use IsOpen() to test for termination. You have to call GetDevice()->IsRunning() to test for thread termination, and if the thread has terminated you can call Close. Another option is to call Wait() which blocks until the thread terminates, and then call Close.
|virtual void WaAudioDevPort::Close||(||)||
Close devices and release memory.
Close the devices and release all memory associated with streaming. Different devices can be re-opened with different parameters without having to recreate the WaAudioDev object.
|virtual WaAudioDev* WaAudioDevPort::GetDevice||(||)||
|virtual bool WaAudioDevPort::IsOpen||(||)||
|virtual int WaAudioDevPort::Open||(||WadParam *||param,|
Open devices for streaming.
Open devices for streaming with provided parameters. Asynchronous callbacks fetch and deliver sample buffers: inFn delivers input sample buffers and outFn fetches output sample buffers. Streaming directions are determined by valid device IDs in parameter structure, at least one direction must be enabled. Pass NULL for callback if that direction is not enabled.
|[in]||inFn||Input callback function, or NULL|
|[in]||outFn||Output callback function, or NULL|
|[in]||arg||Argument to callbacks|
|virtual int WaAudioDevPort::Start||(||)||
|virtual int WaAudioDevPort::Stop||(||)||
|virtual void WaAudioDevPort::Wait||(||)||