diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-15 18:59:04 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-15 18:59:04 +0000 |
| commit | c3fed62fc7ea4ac4a2ed60ecf3ca7d43367e1e0c (patch) | |
| tree | 9a4c2ad1ba5d5830184a32415b05ba59fc72ea44 /firmware | |
| parent | e941289c2f08e8dd4d073b7d025381b660d69012 (diff) | |
| download | rockbox-c3fed62fc7ea4ac4a2ed60ecf3ca7d43367e1e0c.zip rockbox-c3fed62fc7ea4ac4a2ed60ecf3ca7d43367e1e0c.tar.gz rockbox-c3fed62fc7ea4ac4a2ed60ecf3ca7d43367e1e0c.tar.bz2 rockbox-c3fed62fc7ea4ac4a2ed60ecf3ca7d43367e1e0c.tar.xz | |
Fixed the "last song bug".
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6725 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/export/pcm_playback.h | 1 | ||||
| -rw-r--r-- | firmware/pcm_playback.c | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/firmware/export/pcm_playback.h b/firmware/export/pcm_playback.h index 9606415..c78936a 100644 --- a/firmware/export/pcm_playback.h +++ b/firmware/export/pcm_playback.h @@ -43,6 +43,7 @@ void pcm_play_set_watermark(int numbytes, void (*callback)(int bytes_left)); void pcm_set_boost_mode(bool state); bool pcm_is_lowdata(void); bool pcm_crossfade_start(void); +void audiobuffer_add_event(void (*event_handler)(void)); unsigned int audiobuffer_get_latency(void); bool audiobuffer_insert(char *buf, size_t length); bool pcm_is_crossfade_enabled(void); diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index b18238c..45e91ac 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -62,6 +62,8 @@ static int crossfade_pos; static int crossfade_amount; static int crossfade_rem; +static void (*pcm_event_handler)(void); + static unsigned char *next_start; static long next_size; @@ -202,6 +204,8 @@ static void pcm_play_callback(unsigned char** start, long* size) { /* No more buffers */ *size = 0; + if (pcm_event_handler) + pcm_event_handler(); } #if 1 if(pcmbuf_unplayed_bytes <= pcmbuf_watermark) @@ -363,8 +367,7 @@ void pcm_set_boost_mode(bool state) void audiobuffer_add_event(void (*event_handler)(void)) { - while (!pcm_play_add_chunk(NULL, 0, event_handler)) - yield(); + pcm_event_handler = event_handler; } unsigned int audiobuffer_get_latency(void) @@ -474,10 +477,11 @@ bool audiobuffer_insert(char *buf, size_t length) copy_n += audiobuffer_fillpos; while (!pcm_play_add_chunk(&audiobuffer[audiobuffer_pos], - copy_n, NULL)) { + copy_n, pcm_event_handler)) { pcm_boost(false); yield(); } + pcm_event_handler = NULL; audiobuffer_pos += copy_n; audiobuffer_fillpos = 0; @@ -502,6 +506,7 @@ void pcm_play_init(void) pcmbuf_write_index = 0; pcmbuf_unplayed_bytes = 0; crossfade_enabled = false; + pcm_event_handler = NULL; pcm_play_set_watermark(PCM_WATERMARK, pcm_watermark_callback); } |