Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH] Track change silence
From: Hardeep Sidhu (hardeeps_at_pobox.com)
Date: 2002-08-22


Okay, patch below should fix:
1. Track change silence when selecting next track just as it's being loaded into
the buffer
2. Repeat of first few seconds of song when selecting next track with multiple
files in buffer or when ffw to end of file
3. ffw to end of file not always starting next song

-Hardeep

Index: firmware/mpeg.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/mpeg.c,v
retrieving revision 1.99
diff -u -b -r1.99 mpeg.c
--- firmware/mpeg.c 22 Aug 2002 07:58:18 -0000 1.99
+++ firmware/mpeg.c 22 Aug 2002 15:38:31 -0000
@@ -794,23 +794,33 @@

                 /* is next track in ram? */
                 if ( num_tracks_in_memory() > 1 ) {
- int track_offset = (tag_read_idx+1) & MAX_ID3_TAGS_MASK;
- mp3buf_read = id3tags[track_offset]->mempos;
+ int unplayed_space_left, unswapped_space_left;
+
+ track_change();
+ mp3buf_read = id3tags[tag_read_idx]->mempos;
                     init_dma();
                     last_dma_tick = current_tick;

+ unplayed_space_left = get_unplayed_space();
+ unswapped_space_left = mp3buf_write - mp3buf_swapwrite;
+ if (unswapped_space_left < 0)
+ unswapped_space_left += mp3buflen;
+
                     /* should we start reading more data? */
- if(!filling && (get_unplayed_space() < MPEG_LOW_WATER)) {
+ if(!filling && (unplayed_space_left < MPEG_LOW_WATER)) {
                         filling = true;
                         queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
                         play_pending = true;
+ } else if(unswapped_space_left &&
+ unswapped_space_left > unplayed_space_left) {
+ /* Stop swapping the data from the previous file */
+ mp3buf_swapwrite = mp3buf_read;
+ play_pending = true;
                     } else {
                         playing = true;
                         if (!paused)
                             start_dma();
                     }
-
- track_change();
                 }
                 else {
                     reset_mp3_buffer();
@@ -903,6 +913,11 @@
                 else
                     /* Not enough information to FF/Rewind */
                     break;
+
+ /* Don't seek right to the end of the file so that we can
+ transition properly to the next song */
+ if (newpos >= (int)(id3->filesize - id3->id3v1len))
+ newpos = id3->filesize - id3->id3v1len - 1;

                 newpos = newpos & ~1;
                 curpos = lseek(mpeg_file, 0, SEEK_CUR);

----- Original Message -----
From: "Hardeep Sidhu" <hardeeps_at_pobox.com>
To: <rockbox_at_cool.haxx.se>
Sent: Wednesday, August 21, 2002 10:02 PM
Subject: Re: Track change silence

> I spoke too soon, this patch doesn't fix the repeat bug. Still investigating...
>
> -Hardeep
>
> ----- Original Message -----
> From: "Hardeep Sidhu" <hardeeps_at_pobox.com>
> To: <rockbox_at_cool.haxx.se>
> Sent: Wednesday, August 21, 2002 8:59 PM
> Subject: Re: Track change silence
>
>
> > The patch below fixes this bug. The problem occurred when selecting the next
> track
> > just as it was being loaded into the buffer. The patch also fixes the bug
where
> > the first few seconds of the next track were repeated if it was already loaded
in
> > memory.
> >
> > -Hardeep
>
>



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa