Share via


ISpMMSysAudio::GetDeviceId (Windows Embedded CE 6.0)

1/6/2010

This method gets the multimedia device identifier being used by the audio object. The default device identifier for SpMMSysAudio objects that are created using CoCreateInstance is WAVE_MAPPER. For audio objects created using an object token, the identifier is always a specific wave in or wave out device identifier.

Syntax

HRESULT GetDeviceId(
  UINT* puDeviceId
);

Parameters

  • puDeviceId
    [out] Pointer to the device identifier.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_POINTER

puDeviceId is a bad pointer.

Example

The following code snippet illustrates the use of this method using CoCreateInstance.

HRESULT hr = S_OK;
// create the multimedia input object
hr = cpMMSysAudio.CoCreateInstance(CLSID_SpMMAudioIn);
// Check hr
// get the default device identifier
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 identifier for the object 
UINT uiDeviceId;
hr = cpMMSysAudio->GetDeviceId(&uiDeviceId);
// Check hr
// uiDeviceId != WAVE_MAPPER

Requirements

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpMMSysAudio
SAPI Interfaces