Copyright © 2001-2018 MultiMedia Soft

WASAPI.AttachInputDeviceToPlayer method

Previous pageReturn to chapter overviewNext page

Remarks

 

Attaches an input device (capture or loopback) to a player for immediate playback of incoming audio data.

 

When the selected input device is a loopback device, this method gives the possibility to mirror the output of a specific render device to a different render device with a very low latency: in this specific case it's strongly recommended that you avoid playing audio data taken from a specific loopback device to the corresponding render device or you may experience a very annoying echo effect.

 

An attached device can be detached from the player by invoking the CloseSound method or by loading a new sound through the LoadSound method or similar.

 

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.

 

 

Syntax

 

[Visual Basic]

control.WASAPI.AttachInputDeviceToPlayer (

nPlayer as Integer,

nDeviceIndex as Integer,

nDeviceType as enumWasapiDeviceTypes

) as enumErrorCodes


 

[C++]

short control.WASAPI.AttachInputDeviceToPlayer (

short nPlayer,

short nDeviceIndex,

short nDeviceType

);


 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

nDeviceIndex

Number representing the zero-based index of the WASAPI capture device.

This index is related to WASAPI capture devices enumerated through the WASAPI.DeviceGetCount and WASAPI.DeviceGetDesc methods having the nDeviceType parameter set to WASAPI_DEVICE_TYPE_CAPTURE..

nDeviceType

The type of input device used to obtain audio data.

Supported values are the following:

Mnemonic Value

Value

Meaning

WASAPI_DEVICE_TYPE_RENDER

0

Audio rendering device. Not being an input device, when this setting is applied audio data will be automatically taken from the corresponding loopback device.

WASAPI_DEVICE_TYPE_CAPTURE

1

Audio capture device.

WASAPI_DEVICE_TYPE_LOOPBACK

2

Audio loopback device.

 

 

 

Return value

 

Value

Meaning

 

 

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