WASAPI.DeviceVolumeSet method |
|
Remarks
Sets the volume of the given WASAPI device for the current process. The current volume can be obtained through the WASAPI.DeviceVolumeGet method.
If you need to modify the master volume for the given WASAPI device, shared by all running processes, use the CoreAudioDevices.MasterVolumeSet method.
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.
Syntax
[Visual Basic] Public Function DeviceVolumeSet ( nDeviceIndex as Int32, nDeviceType as enumWasapiDeviceTypes, nScaleType as enumVolumeScales, fVolumeLevel as Single ) as enumErrorCodes |
[C#] public enumErrorCodes DeviceVolumeSet ( Int32 nDeviceIndex, enumWasapiDeviceTypes nDeviceType, enumVolumeScales nScaleType, float fVolumeLevel ); |
[C++] public: enumErrorCodes DeviceVolumeSet ( Int32 nDeviceIndex, enumWasapiDeviceTypes nDeviceType, enumVolumeScales nScaleType, float fVolumeLevel ); |
Parameter |
Description |
||||||||||||
|
|
||||||||||||
nDeviceIndex |
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. |
||||||||||||
nDeviceType |
The type of device. Supported values are the following:
|
||||||||||||
nScaleType |
The volume scaling type. Supported values are the following:
|
||||||||||||
fVolumeLevel |
Number representing the volume level for the current process (the meaning of this value depends upon the nScaleType parameter). The range of acceptable values, expressed in dB, to apply can be determined by checking the fLevelMinIndB and fLevelMaxIndB parameters of the CoreAudioDevices.MasterVolumeGet method. |
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |