sipxmedialib
Version 3.3
|
Container for the Microsoft Windows Multimedia specific input driver. More...
#include <MpidWinMM.h>
Classes | |
class | MpWinInputAudioDeviceNotifier |
Public Member Functions | |
Creators | |
MpidWinMM (const UtlString &name, MpInputDeviceManager &deviceManager, unsigned nInputBuffers=DEFAULT_N_INPUT_BUFS) | |
Default constructor. More... | |
virtual | ~MpidWinMM () |
Destructor. More... | |
Manipulators | |
OsStatus | enableDevice (unsigned samplesPerFrame, unsigned samplesPerSec, MpFrameTime currentFrameTime) |
Initialize device driver and state. More... | |
OsStatus | disableDevice () |
Uninitialize device driver. More... | |
Inquiry | |
UtlBoolean | isDeviceValid () |
Inquire if the windows device is valid. More... | |
Public Member Functions inherited from MpInputDeviceDriver | |
MpInputDeviceDriver (const UtlString &name, MpInputDeviceManager &deviceManager) | |
Default constructor. More... | |
virtual | ~MpInputDeviceDriver () |
Destructor. More... | |
virtual OsStatus | setDeviceId (MpInputDeviceHandle deviceId) |
Set device ID associated with this device in parent input device manager. More... | |
virtual OsStatus | clearDeviceId () |
Clear the device ID associated with this device. More... | |
virtual MpInputDeviceHandle | getDeviceId () const |
Get device ID associated with this device in parent input device manager. More... | |
uint32_t | getSamplesPerSec () const |
Get the sample rate of this device driver, if enabled. More... | |
uint32_t | getSamplesPerFrame () const |
Get the samples per frame of this device driver, if enabled. More... | |
MpFrameTime | getFramePeriod () |
Calculate the number of milliseconds that a frame occupies in time. More... | |
MpFrameTime | getCurrentFrameTime () const |
Get timestamp for the next frame to be pushed to input device manager. More... | |
const UtlString & | getDeviceName () const |
Get device name. More... | |
virtual UtlBoolean | isEnabled () |
Inquire if this driver is enabled. More... | |
Static Public Member Functions | |
Accessors | |
static UtlString | getDefaultDeviceName () |
get the windows name of the default wave input device. More... | |
Static Public Member Functions inherited from MpInputDeviceDriver | |
static MpFrameTime | getFramePeriod (unsigned samplesPerFrame, unsigned samplesPerSec) |
Calculate the number of milliseconds that a frame occupies in time. More... | |
Protected Member Functions | |
WAVEHDR * | initWaveHeader (int n) |
Zero out a wave header, so it is ready to be filled in by windows. More... | |
void | processAudioInput (HWAVEIN hwi, UINT uMsg, void *dwParam1) |
Processes incoming audio data. More... | |
Static Protected Member Functions | |
static void CALLBACK | waveInCallbackStatic (HWAVEIN hwi, UINT uMsg, void *dwInstance, void *dwParam1, void *dwParam2) |
Callback function for receiving data from windows audio. More... | |
static bool | nameIsSame (const UtlString &a, const UtlString &b) |
static IMMDeviceEnumerator * | getWinDeviceEnumerator () |
static void | registerDeviceEnumerator (IMMDeviceEnumerator *deviceEnumeratorPtr, IMMNotificationClient *winAudioDeviceChangeCallback) |
static void | unregisterDeviceEnumerator (IMMDeviceEnumerator *deviceEnumeratorPtr, IMMNotificationClient *winAudioDeviceChangeCallback) |
static void | getWinNameForDevice (IMMDeviceEnumerator *deviceEnumeratorPtr, const LPCWSTR winDeviceId, UtlString &deviceName) |
Private Member Functions | |
MpidWinMM (const MpInputDeviceDriver &rMpInputDeviceDriver) | |
Copy constructor (not implemented for this class) More... | |
MpidWinMM & | operator= (const MpInputDeviceDriver &rhs) |
Assignment operator (not implemented for this class) More... | |
Private Attributes | |
int | mWinMMDeviceId |
HWAVEIN | mDevHandle |
The Microsoft handle for this audio input device. More... | |
unsigned | mNumInBuffers |
unsigned | mWaveBufSize |
WAVEHDR * | mpWaveHeaders |
Array of nNumInBuffers wave headers. More... | |
LPSTR * | mpWaveBuffers |
Array of nNumInBuffers wave buffers. More... | |
UtlBoolean | mIsOpen |
Boolean indicating waveInOpen() completed. More... | |
unsigned | mnAddBufferFailures |
within the callback has failed since last enabled. More... | |
IMMNotificationClient * | mWinAudioDeviceChangeCallback |
device state changes. More... | |
IMMDeviceEnumerator * | mDeviceEnumeratorPtr |
Friends | |
class | MpodWinMM |
Additional Inherited Members | |
Protected Attributes inherited from MpInputDeviceDriver | |
MpInputDeviceManager * | mpInputDeviceManager |
this device driver. More... | |
UtlBoolean | mIsEnabled |
Whether this device driver is enabled or not. More... | |
MpInputDeviceHandle | mDeviceId |
this device, as supplied by the InputDeviceManager. More... | |
unsigned | mSamplesPerFrame |
number of samples. More... | |
unsigned | mSamplesPerSec |
of samples per second. More... | |
MpFrameTime | mCurrentFrameTime |
pushed to input device manager. More... | |
Container for the Microsoft Windows Multimedia specific input driver.
The MpidWinMM device driver wrapper is the concrete container containing the implementation of the windows multimedia wave audio input interface. This is currently driven by callbacks.
MpidWinMM | ( | const UtlString & | name, |
MpInputDeviceManager & | deviceManager, | ||
unsigned | nInputBuffers = DEFAULT_N_INPUT_BUFS |
||
) |
Default constructor.
[in] | name | - unique device driver name (e.g. "YAMAHA AC-XG WDM Audio", etc.) |
[in] | deviceManager | - MpInputDeviceManager this device is to push frames to via pushFrame method |
[in] | nOutputBuffers | - The number of frame-sized buffers to register with Windows to fill with frames of audio data, in case we're not fast enough to process them. |
|
virtual |
Destructor.
|
private |
Copy constructor (not implemented for this class)
|
virtual |
Initialize device driver and state.
This method enables the device driver.
this SHOULD NOT be used to mute/unmute a device. Disabling and enabling a device results in state and buffer queues being cleared.
[in] | samplesPerFrame | - the number of samples in a frame of media |
[in] | samplesPerSec | - sample rate for media frame in samples per second |
[in] | currentFrameTime | - time in milliseconds for beginning of frame relative to the MpInputDeviceManager reference time |
[in] | deviceId | - device Id used to identify this input device to MpInputDeviceManager for pushFrame calls. |
Implements MpInputDeviceDriver.
|
virtual |
Uninitialize device driver.
This method disables the device driver and should release any platform device resources so that the device might be used else where.
this SHOULD NOT be used to mute/unmute a device. Disabling and enabling a device results in state and buffer queues being cleared.
Implements MpInputDeviceDriver.
|
static |
get the windows name of the default wave input device.
|
inlinevirtual |
Inquire if the windows device is valid.
Implements MpInputDeviceDriver.
|
protected |
Zero out a wave header, so it is ready to be filled in by windows.
Initialize all the values in the wave header indicated by n
.
[in] | n | - The index into mpWaveHeaders indicating which wave header to initialize. |
|
protected |
Processes incoming audio data.
This method, called by the static callback function waveInCallbackStatic, processes audio input data from the windows waveform audio functions, passing the results to the input manager.
|
staticprotected |
Callback function for receiving data from windows audio.
This static method is called by the windows waveform audio functions passing incoming audio data to be processed. This function then passes the results on to processAudioInput()
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
private |
Assignment operator (not implemented for this class)
|
friend |
|
private |
The underlying windows Device ID (not the logical Mp device ID)
|
private |
The Microsoft handle for this audio input device.
|
private |
The number of buffers to supply to windows for audio processing.
|
private |
The size, in bytes, of mpWaveBuffer after allocation.
|
private |
Array of nNumInBuffers wave headers.
|
private |
Array of nNumInBuffers wave buffers.
|
private |
Boolean indicating waveInOpen() completed.
|
private |
within the callback has failed since last enabled.
The number of times that addBuffer called
|
private |
device state changes.
Callback interface for audio
|
private |