NVDA Helper
In-process and lite high-speed utilities for NVDA
|
Play a stream of audio using WASAPI. More...
Public Types | |
using | ChunkCompletedCallback |
Public Member Functions | |
WasapiPlayer (wchar_t *deviceName, WAVEFORMATEX format, ChunkCompletedCallback callback) | |
Constructor. | |
HRESULT | open (bool force=false) |
Open the audio device. | |
HRESULT | feed (unsigned char *data, unsigned int size, unsigned int *id) |
Feed a chunk of audio. | |
HRESULT | stop () |
HRESULT | sync () |
HRESULT | idle () |
HRESULT | pause () |
HRESULT | resume () |
HRESULT | setChannelVolume (unsigned int channel, float level) |
Play a stream of audio using WASAPI.
WasapiPlayer::WasapiPlayer | ( | wchar_t * | deviceName, |
WAVEFORMATEX | format, | ||
ChunkCompletedCallback | callback ) |
Constructor.
Specify an empty (not null) deviceName to use the default device.
HRESULT WasapiPlayer::open | ( | bool | force = false | ) |
Open the audio device.
If force is true, the device will be reopened even if it is already open.
References BUFFER_SIZE, CLSID_MMDeviceEnumerator, HRESULT(), IID_IAudioClient, IID_IAudioClock, IID_IAudioRenderClient, and notificationClient.
Referenced by feed(), SilencePlayer::init(), setChannelVolume(), and wasPlay_open().
Feed a chunk of audio.
If not null, id will be set to a number used to identify the audio associated with this call. The callback will be called with this number when this audio finishes playing.
References HRESULT(), notificationClient, and open().
Referenced by wasPlay_feed().
HRESULT WasapiPlayer::stop | ( | ) |
References HRESULT().
Referenced by idle(), SilencePlayer::terminate(), and wasPlay_stop().
HRESULT WasapiPlayer::sync | ( | ) |
Referenced by idle(), and wasPlay_sync().
HRESULT WasapiPlayer::idle | ( | ) |
References HRESULT(), stop(), and sync().
Referenced by wasPlay_idle().
HRESULT WasapiPlayer::pause | ( | ) |
References HRESULT().
Referenced by wasPlay_pause().
HRESULT WasapiPlayer::resume | ( | ) |
References HRESULT().
Referenced by wasPlay_resume().
References HRESULT(), IID_IAudioStreamVolume, and open().
Referenced by wasPlay_setChannelVolume().