diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-04-20 22:11:20 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-04-20 22:11:20 +0000 |
commit | c49129cacdf81e86bd613b5baee4acefadcc83d1 (patch) | |
tree | 3a5265b5144771602f7cc8255e6136afa31bb6c4 /apps/talk.c | |
parent | c898a02bb4763e0cf96d99b7964d59f063262ba8 (diff) | |
download | rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.tar.gz rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.zip |
minor improvement to make the clip switch safer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4528 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/talk.c b/apps/talk.c index 47c3e6db58..df5c6ef438 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -214,22 +214,27 @@ static int shutup(void) | |||
214 | && (search[1] & 0x30) == (curr_hd[1] & 0x30)) /* sample rate */ | 214 | && (search[1] & 0x30) == (curr_hd[1] & 0x30)) /* sample rate */ |
215 | { | 215 | { |
216 | search--; /* back to the sync byte */ | 216 | search--; /* back to the sync byte */ |
217 | break; /* From looking at it, this is a header. */ | 217 | break; /* From looking at it, this is our header. */ |
218 | /* This is not a sufficient condition to find header, may | ||
219 | give "false alert" (end too early), but a good start. */ | ||
220 | } | 218 | } |
221 | } | 219 | } |
222 | queue_write = queue_read + 1; /* reset the queue */ | 220 | |
223 | if (queue_write >= QUEUE_SIZE) | ||
224 | queue_write = 0; | ||
225 | queue[queue_read].len = 0; | ||
226 | |||
227 | /* play old data until the frame end, to keep the MAS in sync */ | ||
228 | if (search-pos) | 221 | if (search-pos) |
229 | { | 222 | { /* play old data until the frame end, to keep the MAS in sync */ |
230 | DTCR3 = search-pos; | 223 | DTCR3 = search-pos; |
224 | |||
225 | queue_write = queue_read + 1; /* will be empty after next callback */ | ||
226 | if (queue_write >= QUEUE_SIZE) | ||
227 | queue_write = 0; | ||
228 | queue[queue_read].len = 0; /* current one ends now */ | ||
229 | |||
231 | CHCR3 |= 0x0001; /* re-enable DMA */ | 230 | CHCR3 |= 0x0001; /* re-enable DMA */ |
232 | } | 231 | } |
232 | else | ||
233 | { /* by chance we have played to a frame boundary */ | ||
234 | queue_write = queue_read; /* reset the queue */ | ||
235 | is_playing = false; | ||
236 | mp3_play_stop(); | ||
237 | } | ||
233 | 238 | ||
234 | return 0; | 239 | return 0; |
235 | } | 240 | } |