How can i mute and unmute BASS playback (platform independend)? Until now i save the current volume before muting, set volume to 0 and set it back if unmute.
Example:
part of my C++ class
volume_t lastVolume; // 0.0f = silent, 1.0f = max (volume_t = float)
// ...
bool mute(bool mute)
{
if( mute )
{
lastVolume = getVolume(); // Save current volume
return setVolume(0.0f); // Set volume to silent
}
else
{
return setVolume(lastVolume); // restore last volume before muting
}
}
Is there a better way to do this? In the BASS Api documentation there's only one mute function:
BOOL BASS_WASAPI_SetMute(
BOOL mute
);
However, this looks good, but unfortunately its part of BASSWASAPI (WASAPI I/O on Windows Vista and later - which is not crossplatform).