ISpMMSysAudio::GetDeviceId (Windows CE 5.0)

Send Feedback

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.

HRESULT GetDeviceId(UINT* puDeviceId);

Parameters

  • puDeviceId
    [out] Pointer to the device identifier.

Return Values

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

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpMMSysAudio | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.