|
Wave Arts VQE
1.00
Voice Quality Enhancement
|
WaAudioDev implemented with Mac Core Audio. More...
#include <WadMacHAL.h>
Public Member Functions | |
| WadMacHAL () | |
| Constructor. | |
| ~WadMacHAL () | |
| Destructor. | |
| int | Init () |
| initialize the OS API and discover all devices | |
| virtual int | GetNumDevices (int *pNumDev) |
| Get the count of devices discovered. | |
| virtual int | GetDevInfo (int devId, WadDevInfo *pInfo) |
| Get device information. | |
| virtual int | GetDefaultInDevId (int *pId) |
| Get the default input device. | |
| virtual int | GetDefaultOutDevId (int *pId) |
| Get the default output device. | |
| virtual int | Open (WadParam *param, WadCallbackFn *inFn, WadCallbackFn *outFn, void *arg) |
| Open devices for streaming. | |
| virtual int | Start () |
| Start streaming. | |
| virtual int | Stop () |
| Stop streaming. | |
| virtual void | Close () |
| Close devices and release memory. | |
| virtual void | Wait () |
| Wait for stream to complete. | |
| virtual int | SetVol (int devId, bool outputFlag, float vol) |
| Set volume. | |
| virtual int | GetVol (int devId, bool outputFlag, float *pVol) |
| Get volume. | |
| virtual bool | IsRunning () |
| Test if stream I/O thread is running. | |
| virtual int | GetBufTime (bool isOutput, int *pBufTimeMsec) |
| Get buffer time. | |
| virtual WadAPI | GetAPI () |
| return API enum | |
| OSStatus | Init (AudioDeviceID input, AudioDeviceID output) |
| Initialize. | |
| void | Cleanup () |
| Cleanup. | |
| OSStatus | SetInputDeviceAsCurrent (AudioDeviceID in) |
| Set input device. | |
| OSStatus | SetOutputDeviceAsCurrent (AudioDeviceID out) |
| Set output device. | |
Protected Attributes | |
| WaACDevInfo * | m_Devs |
| device table | |
WaAudioDev implemented with Mac Core Audio.
WaAudioDev C++ wrapper around Mac Core Audio using AUHAL and output audio units.
| void WadMacHAL::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.
Reimplemented in WadResMacHAL.
| WadAPI WadMacHAL::GetAPI | ( | ) | [virtual] |
| int WadMacHAL::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 WadMacHAL::GetDefaultInDevId | ( | int * | pId | ) | [virtual] |
Get the default input device.
| [out] | pId | pointer to default input device ID |
Implements WaAudioDev.
| int WadMacHAL::GetDefaultOutDevId | ( | int * | pId | ) | [virtual] |
Get the default output device.
| [out] | pId | pointer to default output device ID |
Implements WaAudioDev.
| int WadMacHAL::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 WadMacHAL::GetNumDevices | ( | int * | pNumDev | ) | [virtual] |
Get the count of devices discovered.
| [out] | pNumDev | pointer to number of devices |
Implements WaAudioDev.
| int WadMacHAL::GetVol | ( | int | devId, |
| bool | isOutput, | ||
| float * | pVol | ||
| ) | [virtual] |
Get volume.
| [in] | devId | device ID |
| [in] | isOutput | true if get output volume, else get input volume |
| [out] | vol | pointer to volume, 0.0 (min) to 1.0 (max) |
Get volume of device. Any discovered device can be specified and the device does not need to be open for streaming.
Reimplemented from WaAudioDev.
| int WadMacHAL::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.
| virtual bool WadMacHAL::IsRunning | ( | ) | [inline, 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 WadMacHAL::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.
Reimplemented in WadResMacHAL.
| int WadMacHAL::SetVol | ( | int | devId, |
| bool | isOutput, | ||
| float | vol | ||
| ) | [virtual] |
Set volume.
| [in] | devId | device ID |
| [in] | isOutput | true if set output volume, else set input volume |
| [in] | vol | volume, 0.0 (min) to 1.0 (max) |
Set volume of device. Any discovered device can be specified and the device does not need to be open for streaming.
Reimplemented from WaAudioDev.
| int WadMacHAL::Start | ( | ) | [virtual] |
Start streaming.
Start streaming audio. This must be called after Open to actually start stream.
Implements WaAudioDevPort.
| int WadMacHAL::Stop | ( | ) | [virtual] |
Stop streaming.
Stop streaming audio. Stream can be restarted by calling Start().
Implements WaAudioDevPort.
| void WadMacHAL::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