Share via


ISpMMSysAudio::SetDeviceId (Windows CE 5.0)

Send Feedback

This method sets the multimedia device identifier. This method works only on audio objects that were not created using an object token, and only when the object is in the SPAS_CLOSED state.

This method should not be used in typical application development. SAPI provides tokens for all the available sound devices in a computer and these can be used to create an initialized SpMMSysAudio object. This method is available for non-standard multimedia audio devices.

HRESULT SetDeviceId( UINT uDeviceId);

Parameters

  • uDeviceId
    [in] Identifier of the device to set.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
SPERR_DEVICE_BUSY Object is not in the SPAS_CLOSED state.
SPERR_ALREADY_INITIALIZED Object was created using an object token.
E_INVALIDARG uDeviceId is invalid. It is not set to WAVE_MAPPER or device does not exist.

Example

The following code snippet illustrates the use of this method.

HRESULT hr = S_OK;
// create the multimedia output object
hr = cpMMSysAudio.CoCreateInstance(CLSID_SpMMAudioOut);
// Check hr
// set the output device to an alternate multimedia device (such as a modem)
hr = cpMMSysAudio->SetDeviceId(ALTERNATE_MM_DEVICE);
// Check hr

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.