You are reading help file online using chmlib.com
|
ISpMMSysAudio::GetDeviceId passes back the multimedia device ID being used by the audio object.
HRESULT GetDeviceId(
UINT *puDeviceId
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_POINTER | puDeviceId is a bad pointer. |
The default device ID for SpMMSysAudio objects that are created using CoCreateInstance is the WAVE_MAPPER. For audio objects created using an object token, the ID will always be a specific wave in or wave out device ID.
The following code snippet illustrates the use of ISpMMSysAudio::GetDeviceId using CoCreateInstance.
HRESULT hr = S_OK;
// create the multimedia input object
hr = cpMMSysAudio.CoCreateInstance(CLSID_SpMMAudioIn);
// Check hr
// get the default device id
UINT uiDeviceId;
hr = cpMMSysAudio->GetDeviceId(&uiDeviceId);
// Check hr
// uiDeviceId == WAVE_MAPPER
The following code snippet illustrates the use of ISpMMSysAudio::GetDeviceId using an ISpObjectToken
HRESULT hr = S_OK;
// get the current multimedia object's object token
hr = cpMMSysAudio.QueryInterface(&cpObjectWithToken);
// Check hr
// Find the preferred multimedia object token
hr = SpFindBestToken(SPCAT_AUDIOIN, L"Technology=MMSys", NULL, &cpObjectToken);
// Check hr
// set the current multimedia object to the preferred multimedia object token
hr = cpObjectWithToken->SetObjectToken(cpObjectToken);
// Check hr
// get the device id for the object
UINT uiDeviceId;
hr = cpMMSysAudio->GetDeviceId(&uiDeviceId);
// Check hr
// uiDeviceId != WAVE_MAPPER
You are reading help file online using chmlib.com
|