forked from len0rd/rockbox
Second-exact track change detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1444 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3b919cbda3
commit
4e2384eb07
1 changed files with 29 additions and 12 deletions
|
@ -415,6 +415,23 @@ void DEI3(void)
|
||||||
if(mp3buf_read >= mp3buflen)
|
if(mp3buf_read >= mp3buflen)
|
||||||
mp3buf_read = 0;
|
mp3buf_read = 0;
|
||||||
|
|
||||||
|
/* First, check if we are on a track boundary */
|
||||||
|
if (last_tag > 1)
|
||||||
|
{
|
||||||
|
if (mp3buf_read == id3tags[1].mempos)
|
||||||
|
{
|
||||||
|
/* shift array so index 0 is current track */
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DEBUGF("Track change\n");
|
||||||
|
for (i=0; i<last_tag-1; i++)
|
||||||
|
{
|
||||||
|
id3tags[i] = id3tags[i+1];
|
||||||
|
}
|
||||||
|
last_tag--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unplayed_space_left = mp3buf_write - mp3buf_read;
|
unplayed_space_left = mp3buf_write - mp3buf_read;
|
||||||
if(unplayed_space_left < 0)
|
if(unplayed_space_left < 0)
|
||||||
unplayed_space_left = mp3buflen + unplayed_space_left;
|
unplayed_space_left = mp3buflen + unplayed_space_left;
|
||||||
|
@ -430,23 +447,23 @@ void DEI3(void)
|
||||||
if(unplayed_space_left)
|
if(unplayed_space_left)
|
||||||
{
|
{
|
||||||
last_dma_chunk_size = MIN(65536, unplayed_space_left);
|
last_dma_chunk_size = MIN(65536, unplayed_space_left);
|
||||||
last_dma_chunk_size = MIN(last_dma_chunk_size, space_until_end_of_buffer);
|
last_dma_chunk_size = MIN(last_dma_chunk_size,
|
||||||
DTCR3 = last_dma_chunk_size & 0xffff;
|
space_until_end_of_buffer);
|
||||||
SAR3 = (unsigned int)mp3buf + mp3buf_read;
|
|
||||||
|
|
||||||
/* several tracks loaded? */
|
/* several tracks loaded? */
|
||||||
if ( last_tag>1 ) {
|
if (last_tag>1)
|
||||||
|
{
|
||||||
/* will we move across the track boundary? */
|
/* will we move across the track boundary? */
|
||||||
if (( mp3buf_read <= id3tags[1].mempos ) &&
|
if (( mp3buf_read < id3tags[1].mempos ) &&
|
||||||
((mp3buf_read+last_dma_chunk_size) > id3tags[1].mempos )) {
|
((mp3buf_read+last_dma_chunk_size) > id3tags[1].mempos ))
|
||||||
/* shift array so index 0 is current track */
|
{
|
||||||
int i;
|
/* Make sure that we end exactly on the boundary */
|
||||||
for (i=0; i<last_tag-1; i++)
|
last_dma_chunk_size = id3tags[1].mempos - mp3buf_read;
|
||||||
id3tags[i] = id3tags[i+1];
|
|
||||||
last_tag--;
|
|
||||||
DEBUGF("Track change\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DTCR3 = last_dma_chunk_size & 0xffff;
|
||||||
|
SAR3 = (unsigned int)mp3buf + mp3buf_read;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue