summaryrefslogtreecommitdiff
path: root/firmware/pcm_playback.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-06-30 16:28:40 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-06-30 16:28:40 +0000
commit3b90707fdd85a4b21258f6e11f10e15e0f668e3d (patch)
tree88a28be98ee3872e2a7ee473c11b1975394e5197 /firmware/pcm_playback.c
parent8764bbc275c4b299f22a706d67c1b20240af94fb (diff)
Fixed a bug where a few seconds from end of a song was cut out.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6951 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/pcm_playback.c')
-rw-r--r--firmware/pcm_playback.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index a7ee5cecde..04630f100f 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -415,7 +415,7 @@ bool pcm_crossfade_init(void)
*/
void pcm_flush_audio(void)
{
- if (crossfade_init || crossfade_active)
+ if (crossfade_init || crossfade_active || !pcm_playing)
return ;
crossfade_mode = CFM_FLUSH;
@@ -640,30 +640,15 @@ bool pcm_insert_buffer(char *buf, long length)
memcpy(&audiobuffer[audiobuffer_pos+audiobuffer_fillpos],
buf, copy_n);
buf += copy_n;
- audiobuffer_free -= copy_n;
+ audiobuffer_fillpos += copy_n;
length -= copy_n;
/* Pre-buffer to meet CHUNK_SIZE requirement */
if (copy_n + audiobuffer_fillpos < CHUNK_SIZE && length == 0) {
- audiobuffer_fillpos += copy_n;
return true;
}
-
- copy_n += audiobuffer_fillpos;
-
- while (!pcm_play_add_chunk(&audiobuffer[audiobuffer_pos],
- copy_n, pcm_event_handler)) {
- pcm_boost(false);
- yield();
- }
- pcm_event_handler = NULL;
-
- audiobuffer_pos += copy_n;
- audiobuffer_fillpos = 0;
-
- if (audiobuffer_pos >= PCMBUF_SIZE) {
- audiobuffer_pos = 0;
- }
+
+ pcm_flush_fillpos();
}
return true;