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 | |
| parent | c898a02bb4763e0cf96d99b7964d59f063262ba8 (diff) | |
| download | rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.zip rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.tar.gz rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.tar.bz2 rockbox-c49129cacdf81e86bd613b5baee4acefadcc83d1.tar.xz | |
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')
| -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 47c3e6d..df5c6ef 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -214,22 +214,27 @@ static int shutup(void) && (search[1] & 0x30) == (curr_hd[1] & 0x30)) /* sample rate */ { search--; /* back to the sync byte */ - break; /* From looking at it, this is a header. */ - /* This is not a sufficient condition to find header, may - give "false alert" (end too early), but a good start. */ + break; /* From looking at it, this is our header. */ } } - queue_write = queue_read + 1; /* reset the queue */ - if (queue_write >= QUEUE_SIZE) - queue_write = 0; - queue[queue_read].len = 0; - - /* play old data until the frame end, to keep the MAS in sync */ + if (search-pos) - { + { /* play old data until the frame end, to keep the MAS in sync */ DTCR3 = search-pos; + + queue_write = queue_read + 1; /* will be empty after next callback */ + if (queue_write >= QUEUE_SIZE) + queue_write = 0; + queue[queue_read].len = 0; /* current one ends now */ + CHCR3 |= 0x0001; /* re-enable DMA */ } + else + { /* by chance we have played to a frame boundary */ + queue_write = queue_read; /* reset the queue */ + is_playing = false; + mp3_play_stop(); + } return 0; } |