From 4a2f19433d555ba642ce59f87e8487d986699d1e Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:43:16 +0200 Subject: [PATCH] Properly enter loop if starting point is 0, i.E undefined. (#844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix channel 0 being ignored * Allow music to properly loop * Added channel index. Co-authored-by: Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com> --- src/aomusicplayer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 564d9d6..f29e0cf 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -219,20 +219,20 @@ void AOMusicPlayer::set_looping(bool loop_song, int channel) loop_sync[channel] = 0; } - if (loop_start[channel] > 0) { - if (loop_end[channel] > 0 && (loop_end[channel] > loop_start[channel])) + if (loop_start[channel] >= 0) { + if (loop_start[channel] < loop_end[channel]) { //Loop when the endpoint is reached. loop_sync[channel] = BASS_ChannelSetSync( - m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME, - loop_end[channel] , loopProc, &loop_start[channel]); + m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, + loop_end[channel], loopProc, &loop_start[channel]); } else { //Loop when the end of the file is reached. loop_sync[channel] = BASS_ChannelSetSync( - m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, - 0 , loopProc, &loop_start[channel]); + m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME, + 0, loopProc, &loop_start[channel]); } } }