Skip to content

Commit

Permalink
fix: looping doesn't work, but now it does
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamAnimate committed Nov 28, 2024
1 parent 73a6409 commit 1bc3094
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}

if audio.sink.empty() {
// FIXME: this is a little unclean, and may be hard to understand
let song_index = SONG_INDEX.load(Relaxed);
if song_index >= PLAYLIST.read().unwrap().len() - 1 { // playlist len always + 1 because math
if CFG_IS_LOOPED.load(Relaxed) {
audio.rejitter_song();
continue;
} else if song_index >= PLAYLIST.read().unwrap().len() - 1 { // playlist len always + 1 because math
send_control_errorless!(DestroyAndExit, audio_over_mtx);
} else if !CFG_IS_LOOPED.load(Relaxed) {
SONG_INDEX.store(song_index + 1, Relaxed);
}
SONG_INDEX.store(song_index + 1, Relaxed);
audio.rejitter_song();
} else {
// task: synchronise global variables based on what we have.
Expand Down

0 comments on commit 1bc3094

Please sign in to comment.