Skip to content

Commit

Permalink
Properly enter loop if starting point is 0, i.E undefined. (#844)
Browse files Browse the repository at this point in the history
* Fix channel 0 being ignored

* Allow music to properly loop

* Added channel index.

Co-authored-by: Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com>
  • Loading branch information
Salanto and TrickyLeifa authored Aug 5, 2022
1 parent 90ff911 commit 4a2f194
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/aomusicplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}

0 comments on commit 4a2f194

Please sign in to comment.