aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-01-19 05:26:07 -0600
committerGitHub <noreply@github.com>2021-01-19 14:26:07 +0300
commit75c1df5312d36eabee68822bd5830777fe00ec03 (patch)
tree49aadab3e5dc6438c5b27e58546a7bac09d5802d
parenta929c950a017921042a0d91637be0f5478618742 (diff)
fix music fading being audible when volume is 0 (#416)
-rw-r--r--src/aomusicplayer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 585a7f42..0f872055 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -96,7 +96,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop,
BASS_ChannelLock(oldstream, false);
}
- if (effect_flags & FADE_OUT) {
+ if (effect_flags & FADE_OUT & (m_volume[channel] != 0)) {
// Fade out the other sample and stop it (due to -1)
BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL | BASS_SLIDE_LOG,
-1, 4000);
@@ -116,6 +116,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop,
BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL,
static_cast<float>(m_volume[channel] / 100.0f),
1000);
+
}
else
this->set_volume(m_volume[channel], channel);
@@ -155,6 +156,7 @@ void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user)
BASS_ChannelLock(channel, false);
}
+
void AOMusicPlayer::set_looping(bool toggle, int channel)
{
qDebug() << "Setting looping for channel" << channel << "to" << toggle;