Copyright © 2001-2018 MultiMedia Soft

WASAPI.DeviceStartShared method

Previous pageReturn to chapter overviewNext page



Starts a WASAPI device in shared mode. In order to start the device in exclusive mode you can use the WASAPI.DeviceStartExcusive method. You can know if a WASAPI device is already started through the WASAPI .DeviceIsStarted method.


This method is only effective if the InitDriversType method has been invoked with the nDriverType parameter set to DRIVER_TYPE_WASAPI and must be always called at a later stage respect to the call to the InitDJSystem/InitDJSystemEx method.


This method will affect any other instance of the control inside the application. If the control should be used in conjunction with the Active Sound Recorder control, this one would be affected too. If you should be using Active DJ Studio in conjunction with Active Sound Recorder, as seen inside the WasapiStreamMixer sample, you should prefer calling this method from Active DJ Studio so you would have a better control over the channel mode used for playback (see the nChannelMode parameter below).


This method is only intended for usage with Windows Vista and later versions.

For further details about the use of WASAPI see the WASAPI object and the How to manage audio flow through WASAPI tutorial.





[Visual Basic]

control.WASAPI.DeviceStartShared (

nDeviceIndex as Integer,

nDeviceType as enumWasapiDeviceTypes,

nChannelMode as enumWasapiChannelModes,

nBufferLengthMs as Long,

nBufferUpdateTimeMs as Long

) as enumErrorCodes



short control.WASAPI.DeviceStartShared (

short nDeviceIndex,

short nDeviceType,

short nChannelMode,

long nBufferLengthMs,

long nBufferUpdateTimeMs








Number representing the zero-based index of the WASAPI device whose friendly name must be retrieved. The total number of available WASAPI devices can be obtained using the WASAPI.DeviceGetCount method.


The type of device.

Supported values are the following:

Mnemonic Value





Audio rendering device.



Audio capture device.



Audio loopback device.


Channel mode.

Supported values are the following:

Mnemonic Value





Enables multichannel mode: with this mode, if the loaded sound in in Mono or in Stereo, there is the possibility to perform speakers assignment through the StreamOutputSpeakerSet method.

If the loaded song is multichannel, for example a 5.1, each channel will be automatically routed to output channels available inside the WASAPI device.



Enables stereo mode. This mode is needed when you need to send what is being played through the front speakers of a render device to a streaming server (casting session) or when the internal stream mixer of the WASAPI device needs to be used for recording purposes through the Active Sound Recorder control.


Length of the buffer expressed in milliseconds.

This value determines the latency and if it should be too small the sound card driver may eventually adjust it to its minimum supported value. You can know if the given length has been accepted by verifying the value of the nLatencyMs parameter after calling the WASAPI.DeviceLatencyGet method.


Update time, expressed in milliseconds, for filling the buffer.

You can set this value to 0 in order to let the sound card driver use its default.




Return value






Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful