diff options
Diffstat (limited to 'src/aosfxplayer.cpp')
| -rw-r--r-- | src/aosfxplayer.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index fcdeb94..8d88667 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -60,15 +60,23 @@ void AOSfxPlayer::stop(int channel) BASS_ChannelStop(m_stream_list[channel]); } +void AOSfxPlayer::set_muted(bool toggle) +{ + m_muted = toggle; + // Update the audio volume + set_volume_internal(m_volume); +} + void AOSfxPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; + m_volume = p_value * 0.01; set_volume_internal(m_volume); } void AOSfxPlayer::set_volume_internal(qreal p_value) { - float volume = static_cast<float>(p_value); + // If muted, volume will always be 0 + float volume = static_cast<float>(p_value) * !m_muted; for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); } |
