Sets a channel's volume.
BOOL BASS_ASIO_ChannelSetVolume( BOOL input, int channel, float volume );
input | Dealing with an input channel? FALSE = an output channel. |
channel | The input/output channel number... 0 = first, -1 = master. |
volume | The volume level... 0 (silent) - 1.0 (normal). Above 1.0 amplifies the sound. |
BASS_ERROR_INIT | BASS_ASIO_Init has not been successfully called. |
BASS_ERROR_ILLPARAM | The input and channel combination is invalid, or volume is below 0. |
ASIO drivers do not provide volume control themselves, so the volume adjustments are applied to the sample data by BASSASIO. This also means that changes do not persist across sessions and the channel volume levels will always start at 1.0. Changes are ramped to prevent "click" sounds.
When the channel's sample format is DSD, a 0 volume setting will mute the channel and anything else will be treated as 1.0 (normal).
float volume = pow10(db / 20); // translate logarithmic dB level to linear BASS_ASIO_ChannelSetVolume(FALSE, 0, volume); // apply it to output channel 0