Skip to content

Commit

Permalink
stop audio player earlier on tab loading - fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Sep 1, 2024
1 parent 9ad7d65 commit 63ad667
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ui/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ impl RuxApplication {
}
Message::FileOpened(result) => {
self.tab_file_is_loading = false;
// stop previous audio player if any
if let Some(audio_player) = &mut self.audio_player {
audio_player.stop();
}
match result {
Ok((contents, file_name)) => {
if let Ok(song) = parse_gp_data(&contents) {
Expand Down Expand Up @@ -178,10 +182,6 @@ impl RuxApplication {
tablature_scroll_id.clone(),
);
self.tablature = Some(tablature);
// stop previous audio player if any
if let Some(audio_player) = &mut self.audio_player {
audio_player.stop();
}
// audio player initialization
let audio_player = AudioPlayer::new(
song_rc.clone(),
Expand Down

0 comments on commit 63ad667

Please sign in to comment.