|
Wave Arts VQE
1.00
Voice Quality Enhancement
|
File device for WaAudioDev. More...
#include <WadFile.h>
Public Member Functions | |
| WadFile (char *inFile, char *outFile, bool simRealTime) | |
| Create a WadFile. | |
| ~WadFile () | |
| destructor | |
| WadAPI | GetAPI () |
| return API enum | |
| int | Init () |
| initialize the OS API and discover all devices | |
| int | GetNumDevices (int *pNumDev) |
| Get the count of devices discovered. | |
| int | GetDevInfo (int devId, WadDevInfo *pInfo) |
| Get device information. | |
| int | GetDefaultInDevId (int *pId) |
| Get the default input device. | |
| int | GetDefaultOutDevId (int *pId) |
| Get the default output device. | |
| int | Open (WadParam *param, WadCallbackFn *inFn, WadCallbackFn *outFn, void *arg) |
| Open devices for streaming. | |
| int | Start () |
| Start streaming. | |
| int | Stop () |
| Stop streaming. | |
| void | Close () |
| Close devices and release memory. | |
| void | Wait () |
| Wait for stream to complete. | |
| int | GetBufTime (bool isOutput, int *pBufTimeMsec) |
| Get buffer time. | |
| bool | IsRunning () |
| Test if stream I/O thread is running. | |
| int | Thread () |
| I/O thread entry point. | |
Protected Attributes | |
| char * | inFile |
| input file name, or NULL if fill with zeros | |
| char * | outFile |
| output file name, or NULL if discard | |
| WadParam | param |
| stream parameters | |
| AFileIn * | afi |
| input file | |
| AFileOut * | afo |
| output file | |
| void * | inBuf |
| temp input buffer | |
| void * | outBuf |
| temp output buffer | |
| bool | isRunning |
| T/F running? | |
| bool | simRealTime |
| T/F simulating realtime by pausing between buffers? | |
| void * | arg |
| argument to callback functions | |
| WadCallbackFn * | inFn |
| input (record) callback | |
| WadCallbackFn * | outFn |
| output (play) callback | |
File device for WaAudioDev.
The WadFile file device reads from an input file (or fills with zeros), and writes to an output file (or discards). There is one device discovered, device ID == 0 (called the "File device"), which supports both input and output. Volume control and metering are currently not implemented but could be.
| WadFile::WadFile | ( | char * | inFile, |
| char * | outFile, | ||
| bool | simRealTime | ||
| ) |
Create a WadFile.
| [in] | inFile | input file name, or NULL to fill with zeros |
| [in] | outFile | output file name, or NULL to discard |
| [in] | simRealTime | T/F if simulating realtime |
WAV and AIF files are supported. Files will be created using 16-bit integer sample format. If simulating realtime, the I/O thread will pause between callbacks, else the processing runs as fast as possible.
| void WadFile::Close | ( | ) | [virtual] |
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.
Implements WaAudioDevPort.
| WadAPI WadFile::GetAPI | ( | ) | [virtual] |
| int WadFile::GetBufTime | ( | bool | isOutput, |
| int * | pBufTimeMsec | ||
| ) | [virtual] |
Get buffer time.
| [in] | isOutput | true if get output buffer time, else get input buffer time |
| [out] | pBufTimeMsec | pointer to buffer time in milliseconds |
Return total buffer times in msec for the currently open devices. This is useful in case we want to increase the buffering because we're getting dropouts.
Reimplemented from WaAudioDev.
| int WadFile::GetDefaultInDevId | ( | int * | pId | ) | [virtual] |
Get the default input device.
| [out] | pId | pointer to default input device ID |
Implements WaAudioDev.
| int WadFile::GetDefaultOutDevId | ( | int * | pId | ) | [virtual] |
Get the default output device.
| [out] | pId | pointer to default output device ID |
Implements WaAudioDev.
| int WadFile::GetDevInfo | ( | int | devId, |
| WadDevInfo * | pInfo | ||
| ) | [virtual] |
Get device information.
| [in] | devId | the device ID, 0 to numDev-1 |
| [out] | pInfo | pointer to device info |
Implements WaAudioDev.
| int WadFile::GetNumDevices | ( | int * | pNumDev | ) | [virtual] |
Get the count of devices discovered.
| [out] | pNumDev | pointer to number of devices |
Implements WaAudioDev.
| int WadFile::Init | ( | ) | [virtual] |
initialize the OS API and discover all devices
Initialize, which means do device discovery. The idea is that the devices are enumerated at Init time, and from then on only this device set can be used. Any dynamic changes to the device set can be caught via messages and then this WaAudioDev object must be recreated to discover the new devices updating the device table.
Implements WaAudioDev.
| bool WadFile::IsRunning | ( | ) | [virtual] |
Test if stream I/O thread is running.
Implement this to return false if the I/O thread has exited perhaps because a callback has returned false. This is a non-blocking alternative to Wait(). But why can't we just use IsOpen()? Ah, because the thread terminating doesn't automatically close the device, that's why.
Implements WaAudioDev.
| int WadFile::Open | ( | WadParam * | param, |
| WadCallbackFn * | inFn, | ||
| WadCallbackFn * | outFn, | ||
| void * | arg | ||
| ) | [virtual] |
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] | param | Stream parameters |
| [in] | inFn | Input callback function, or NULL |
| [in] | outFn | Output callback function, or NULL |
| [in] | arg | Argument to callbacks |
Implements WaAudioDevPort.
| int WadFile::Start | ( | ) | [virtual] |
Start streaming.
Start streaming audio. This must be called after Open to actually start stream.
Implements WaAudioDevPort.
| int WadFile::Stop | ( | ) | [virtual] |
Stop streaming.
Stop streaming audio. Stream can be restarted by calling Start().
Implements WaAudioDevPort.
| void WadFile::Wait | ( | ) | [virtual] |
Wait for stream to complete.
Wait for streaming I/O thread to terminate. This call blocks and should only be called if the callbacks will return false status to stop streaming and terminate I/O thread.
Implements WaAudioDevPort.
1.7.5.1