Properly enter loop if starting point is 0, i.E undefined. (#844)

* Fix channel 0 being ignored

* Allow music to properly loop

* Added channel index.

Co-authored-by: Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com>
This commit is contained in:
Salanto 2022-08-05 15:43:16 +02:00 committed by GitHub
parent 90ff911376
commit 4a2f19433d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,20 +219,20 @@ void AOMusicPlayer::set_looping(bool loop_song, int channel)
loop_sync[channel] = 0; loop_sync[channel] = 0;
} }
if (loop_start[channel] > 0) { if (loop_start[channel] >= 0) {
if (loop_end[channel] > 0 && (loop_end[channel] > loop_start[channel])) if (loop_start[channel] < loop_end[channel])
{ {
//Loop when the endpoint is reached. //Loop when the endpoint is reached.
loop_sync[channel] = BASS_ChannelSetSync( loop_sync[channel] = BASS_ChannelSetSync(
m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME, m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME,
loop_end[channel] , loopProc, &loop_start[channel]); loop_end[channel], loopProc, &loop_start[channel]);
} }
else else
{ {
//Loop when the end of the file is reached. //Loop when the end of the file is reached.
loop_sync[channel] = BASS_ChannelSetSync( loop_sync[channel] = BASS_ChannelSetSync(
m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME,
0 , loopProc, &loop_start[channel]); 0, loopProc, &loop_start[channel]);
} }
} }
} }