Copyright © 2001-2024 MultiMedia Soft

StreamOutputDeviceSet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Changes the output device (sound card) for the given player. This method can be called at any time, also during playback. The current selected device can be obtained through the StreamOutputDeviceGet method.

 

By default, the output device is set at the very beginning through a call to the InitDJSystem method.

 

Use the value returned by the GetOutputDevicesCount method in order to know how many output devices are currently installed on the system and the GetOutputDeviceDesc method in order to retrieve the friendly name of every output device.

 

If the output device is changed successfully, the OutputDeviceChanged event is fired.

 

A call to this method will have no effect if the involved player has been added to a custom stream mixer through the StreamMixerPlayerAdd method.

 

In case you should need to clone the audio stream on a different output device, you may use the StreamCloneAdd method.

 

For further details about output devices management, take a look to the How to work with multiple output devices and speakers section.

 

IMPORTANT NOTE WHEN DEALING WITH VIDEO PLAYBACK: when playing a video clip through the VideoPlayer COM object, this method doesn't have any effect for players whose audio rendering mode has been set to AUDIO_RENDERER_MODE_DS_STANDARD or AUDIO_RENDERER_MODE_CUSTOM_2 through the VideoPlayer.AudioRendererModeSet method; in these specific situations the way to go is the VideoPlayer.AudioRendererDsDeviceSet method.

 

 

Syntax

 

[Visual Basic]

control.StreamOutputDeviceSet (

nPlayer as Integer,

nIndex as Integer

) as enumErrorCodes


 

[C++]

short control.StreamOutputDeviceSet (

short nPlayer,

short nIndex

);


 

 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

nIndex

Number representing the index of the output device that will be used by the given player. The value of this parameter can be in the range between 0 and the value returned by the GetOutputDevicesCount method so it can be used to redirect sound to both DirectSound and ASIO devices (see the InitDriversType method for details about the use of ASIO devices).

 

In case you should need to mute the output of a stream mixer created through the StreamMixerCreate method or assigned to a WASAPI device, assign to the nPlayer parameter the unique identifier of the stream mixer and set the value of this parameter to -1. The unique identifier of a stream mixer can be obtained through the StreamMixerGetIdFromOutput method.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.ERR_NOERROR (0)

The method call was successful.