Skip to content

Commit 4a2f194

Browse files
SalantoTrickyLeifa
andauthored
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>
1 parent 90ff911 commit 4a2f194

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/aomusicplayer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,20 @@ void AOMusicPlayer::set_looping(bool loop_song, int channel)
219219
loop_sync[channel] = 0;
220220
}
221221

222-
if (loop_start[channel] > 0) {
223-
if (loop_end[channel] > 0 && (loop_end[channel] > loop_start[channel]))
222+
if (loop_start[channel] >= 0) {
223+
if (loop_start[channel] < loop_end[channel])
224224
{
225225
//Loop when the endpoint is reached.
226226
loop_sync[channel] = BASS_ChannelSetSync(
227-
m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME,
228-
loop_end[channel] , loopProc, &loop_start[channel]);
227+
m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME,
228+
loop_end[channel], loopProc, &loop_start[channel]);
229229
}
230230
else
231231
{
232232
//Loop when the end of the file is reached.
233233
loop_sync[channel] = BASS_ChannelSetSync(
234-
m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME,
235-
0 , loopProc, &loop_start[channel]);
234+
m_stream_list[channel], BASS_SYNC_END | BASS_SYNC_MIXTIME,
235+
0, loopProc, &loop_start[channel]);
236236
}
237237
}
238238
}

0 commit comments

Comments
 (0)