BASS WAS API

BASS_WASAPI_SetVolume


Sets the device volume.

BOOL BASS_WASAPI_SetVolume(
    DWORD mode,
    float volume
);

Parameters

modeThe type of volume to set and the curve to use.
BASS_WASAPI_VOL_SESSIONSet the session volume, else the device volume.
BASS_WASAPI_CURVE_DBUse a logarithmic curve. This is the default if no curve is specified.
BASS_WASAPI_CURVE_LINEARUse a linear curve.
BASS_WASAPI_CURVE_WINDOWSUse Windows' hybrid curve, as used by Windows' volume controls.
volumeThe volume level... 0 (silent) to 1 (max) if using the linear or Windows curves, else a dB level. The device's valid dB level range can be obtained from BASS_WASAPI_GetInfo.

Return value

If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_INITBASS_WASAPI_Init has not been successfully called.
BASS_ERROR_NOTAVAILVolume control is unavailable.
BASS_ERROR_ILLPARAMvolume is invalid.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

Session volume only affects the current process, so other users of the device are unaffected. It has no effect on exclusive mode output, and maps to the device volume with input devices (so does affect other users). Session volume always uses the BASS_WASAPI_CURVE_WINDOWS curve.

When the BASS_WASAPI_CURVE_LINEAR curve is used, the resulting volume level may not be exactly as requested because it gets translated to a dB value within the device's valid dB level range, which is available from BASS_WASAPI_GetInfo.

When using multiple devices, the current thread's device setting (as set with BASS_WASAPI_SetDevice) determines which device this function call applies to.

See also

BASS_WASAPI_GetVolume, BASS_WASAPI_SetMute