Copyright © 2006-2018 MultiMedia Soft

WASAPI.DeviceCoreAudioIndexGet method

Previous pageReturn to chapter overviewNext page



Obtains the zero-based index inside the list of CoreAudio devices of a given WASAPI device.


While the list of CoreAudio devices, depending upon the value of the nStateMask parameter of the CoreAudioDevices.Enum method, may not contain unplugged or disabled devices, the list of WASAPI devices will always contain all of the devices installed inside the system, also if currently unplugged or disabled: this methods allows creating a one-to-one correspondence between WASAPI devices and CoreAudio devices.



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

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

Further information about management of audio devices in Windows Vista and later versions can be found inside the How to access settings of audio devices in Windows Vista and later versions tutorial.





[Visual Basic]

Public Function DeviceCoreAudioIndexGet (

nDeviceIndex as Int32,

nDeviceType as enumWasapiDeviceTypes,

ByRef nIndexCoreAudio as Int32

) as enumErrorCodes



public enumErrorCodes DeviceCoreAudioIndexGet (

Int32 nDeviceIndex,

enumWasapiDeviceTypes nDeviceType,

ref Int32 nIndexCoreAudio




public: enumErrorCodes DeviceCoreAudioIndexGet (

Int32 nDeviceIndex,

enumWasapiDeviceTypes nDeviceType,

Int32 __gc  *nIndexCoreAudio









Number representing the zero-based index of the WASAPI device of interest. 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.


Reference that, on return from the method call, will contain the zero-based index of the CoreAudio device corresponding to the given WASAPI device.

If the returned value should be set to -1, this would mean that the given WASAPI device wasn't enumerated by a previous call to the CoreAudioDevices.Enum method, probably because currently disabled or unplugged.



Return value






Negative value

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

enumErrorCodes.ERR_NOERROR (0)

The method call was successful.