Skip to content

Commit

Permalink
fix stop_play() so it resets the wav position right where the sound card
Browse files Browse the repository at this point in the history
was playing when stopped.
  • Loading branch information
joncampbell123 committed Oct 8, 2017
1 parent 985cc82 commit 01140e9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions media/dosamp/dosamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,11 +913,24 @@ static int begin_play() {
}

static void stop_play() {
uint32_t pos;

if (!wav_playing) return;

_cli();
sndsb_stop_dsp_playback(sb_card);
wav_playing = 0;
pos = sndsb_read_dma_buffer_position(sb_card);
update_wav_play_delay(pos);
update_play_position();
wav_position = wav_play_position;

sndsb_stop_dsp_playback(sb_card);

wav_play_empty = 1;
pos = sndsb_read_dma_buffer_position(sb_card);
sb_card->buffer_last_io = pos;
update_wav_play_delay(pos);
update_play_position();
wav_playing = 0;
_sti();
}

Expand Down

0 comments on commit 01140e9

Please sign in to comment.