Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#12153 - Put Elapsed and Offset in PCM buffer frames.

Attached to Project: Rockbox
Opened by Michael Sevakis (MikeS) - Sunday, 12 June 2011, 01:28 GMT+2
Last edited by Michael Sevakis (MikeS) - Sunday, 28 August 2011, 10:44 GMT+2
Task Type Patches
Category Music playback
Status Closed
Assigned To Michael Sevakis (MikeS)
Player Type All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

Here we slice up PCM frames into about 1/20s chunks. Codecs set elapsed times and offset before the next PCM insert which associates those values with the audio data it subsequently commits to the buffer.

Codecs are modified only minimally so that they set elapsed/offset before outputting anything.

Why?

* Accurate position reporting of samples, especially when using the time index in an uncoventional way (as a sub-track indicator for instance).

* Timing is accurate through track duration regarless of pitch changes.

Now, this is still pretty prelimary. There will likely be short time-reporting glitches in the WPS when switching tracks. Crossfade is not properly converted so don't use it here!

I don't want to invest too much into the current way of doing mixing to accomodate a new buffer format. I'd like  FS#12150  in first before making changes to the format.

Primarily I put this up early so that videogame music enthusiasts can enjoy the benefits.
   pcmbuf-timestamping-05.patch (58.7 KiB)
 apps/pcmbuf.c          |  704 +++++++++++++++++++++++++++----------------------
 apps/pcmbuf.h          |    5 
 apps/codec_thread.c    |   11 
 apps/playback.c        |  110 ++-----
 apps/voice_thread.c    |    4 
 apps/codecs/vorbis.c   |    3 
 apps/codecs/flac.c     |    4 
 apps/codecs/aiff.c     |    2 
 apps/codecs/ape.c      |    3 
 apps/codecs/au.c       |    2 
 apps/codecs/adx.c      |    7 
 apps/codecs/vox.c      |    2 
 apps/codecs/mpa.c      |   12 
 apps/codecs/mpc.c      |    4 
 apps/codecs/aac.c      |    5 
 apps/codecs/speex.c    |    1 
 apps/codecs/spc.c      |    2 
 apps/codecs/tta.c      |    2 
 apps/codecs/alac.c     |    2 
 apps/codecs/wmapro.c   |    1 
 apps/codecs/wav64.c    |    2 
 apps/codecs/wmavoice.c |    2 
 apps/codecs/mod.c      |    3 
 apps/codecs/sid.c      |    2 
 apps/codecs/shorten.c  |    3 
 apps/codecs/wma.c      |    3 
 apps/codecs/a52_rm.c   |    1 
 apps/codecs/smaf.c     |    2 
 apps/codecs/a52.c      |    2 
 apps/codecs/cook.c     |    4 
 apps/codecs/wavpack.c  |    2 
 apps/codecs/wav.c      |    2 
 32 files changed, 506 insertions(+), 408 deletions(-)

This task depends upon

Closed by  Michael Sevakis (MikeS)
Sunday, 28 August 2011, 10:44 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  r30366 - with acceptable solution to annoying sticky wicket
Comment by Michael Sevakis (MikeS) - Wednesday, 20 July 2011, 08:02 GMT+2
Update this to the multichannel PCM system.

Crossfade now operates. Some subtle differences exist. Manual skips don't have a fade-in delay and the WPS is updated when the fade-in of the new track happens rather than immediately at the beginning of the crossfade. WPS stays in better sync with what is being heard.

One last thing to work on that I haven't yet is progress reporting glitches at track transitions, probably by suppressing updates and reenabling them at the right time.
   pcmbuf-timestamping-11.patch (74.7 KiB)
 apps/pcmbuf.c            | 1101 ++++++++++++++++++++++++-----------------------
 apps/pcmbuf.h            |   17 
 apps/codec_thread.c      |   15 
 apps/playback.c          |  149 ++----
 apps/codecs/vorbis.c     |    3 
 apps/codecs/flac.c       |    4 
 apps/codecs/aiff.c       |    2 
 apps/codecs/ape.c        |    3 
 apps/codecs/au.c         |    2 
 apps/codecs/adx.c        |    7 
 apps/codecs/vox.c        |    2 
 apps/codecs/mpa.c        |   12 
 apps/codecs/mpc.c        |    4 
 apps/codecs/speex.c      |    1 
 apps/codecs/aac.c        |    5 
 apps/codecs/spc.c        |    2 
 apps/codecs/tta.c        |    2 
 apps/codecs/alac.c       |    2 
 apps/codecs/wmapro.c     |    1 
 apps/codecs/wav64.c      |    2 
 apps/codecs/wmavoice.c   |    2 
 apps/codecs/mod.c        |    3 
 apps/codecs/sid.c        |    2 
 apps/codecs/shorten.c    |    3 
 apps/codecs/wma.c        |    3 
 apps/codecs/a52_rm.c     |    1 
 apps/codecs/smaf.c       |    2 
 apps/codecs/a52.c        |    2 
 apps/codecs/cook.c       |    4 
 apps/codecs/wavpack.c    |    2 
 apps/codecs/wav.c        |    2 
 firmware/export/system.h |    4 
 32 files changed, 714 insertions(+), 652 deletions(-)

Comment by Rosso Maltese (asettico) - Friday, 22 July 2011, 15:07 GMT+2
Sync to r30189.
   12153-playback-Elapsed_and_offset_in_PCM_buffer_f... (74.6 KiB)
 apps/pcmbuf.c            | 1100 ++++++++++++++++++++++++-----------------------
 apps/pcmbuf.h            |   17 
 apps/codec_thread.c      |   15 
 apps/playback.c          |  149 ++----
 apps/codecs/vorbis.c     |    3 
 apps/codecs/flac.c       |    4 
 apps/codecs/aiff.c       |    2 
 apps/codecs/ape.c        |    3 
 apps/codecs/au.c         |    2 
 apps/codecs/adx.c        |    7 
 apps/codecs/vox.c        |    2 
 apps/codecs/mpa.c        |   12 
 apps/codecs/mpc.c        |    4 
 apps/codecs/speex.c      |    1 
 apps/codecs/aac.c        |    5 
 apps/codecs/spc.c        |    2 
 apps/codecs/tta.c        |    2 
 apps/codecs/alac.c       |    2 
 apps/codecs/wmapro.c     |    1 
 apps/codecs/wav64.c      |    2 
 apps/codecs/wmavoice.c   |    2 
 apps/codecs/mod.c        |    3 
 apps/codecs/sid.c        |    2 
 apps/codecs/shorten.c    |    3 
 apps/codecs/wma.c        |    3 
 apps/codecs/a52_rm.c     |    1 
 apps/codecs/smaf.c       |    2 
 apps/codecs/a52.c        |    2 
 apps/codecs/cook.c       |    4 
 apps/codecs/wavpack.c    |    2 
 apps/codecs/wav.c        |    2 
 firmware/export/system.h |    4 
 32 files changed, 715 insertions(+), 650 deletions(-)

Comment by Michael Sevakis (MikeS) - Saturday, 23 July 2011, 11:25 GMT+2
Some cleanups. Fix a minor bungle or two. Still thinking-over the progress stuff mentioned above.
   pcmbuf-timestamping-14.patch (76.8 KiB)
 apps/pcmbuf.c            | 1164 ++++++++++++++++++++++++-----------------------
 apps/pcmbuf.h            |   17 
 apps/codec_thread.c      |   15 
 apps/playback.c          |  149 ++----
 apps/codecs/vorbis.c     |    3 
 apps/codecs/flac.c       |    4 
 apps/codecs/aiff.c       |    2 
 apps/codecs/ape.c        |    3 
 apps/codecs/au.c         |    2 
 apps/codecs/adx.c        |    7 
 apps/codecs/vox.c        |    2 
 apps/codecs/mpa.c        |   12 
 apps/codecs/mpc.c        |    4 
 apps/codecs/aac.c        |    5 
 apps/codecs/speex.c      |    1 
 apps/codecs/spc.c        |    2 
 apps/codecs/tta.c        |    2 
 apps/codecs/alac.c       |    2 
 apps/codecs/wmapro.c     |    1 
 apps/codecs/wav64.c      |    2 
 apps/codecs/wmavoice.c   |    2 
 apps/codecs/mod.c        |    3 
 apps/codecs/sid.c        |    2 
 apps/codecs/shorten.c    |    3 
 apps/codecs/wma.c        |    3 
 apps/codecs/a52_rm.c     |    1 
 apps/codecs/smaf.c       |    2 
 apps/codecs/a52.c        |    2 
 apps/codecs/cook.c       |    4 
 apps/codecs/wavpack.c    |    2 
 apps/codecs/wav.c        |    2 
 firmware/export/system.h |    4 
 32 files changed, 750 insertions(+), 679 deletions(-)

Comment by Michael Sevakis (MikeS) - Tuesday, 26 July 2011, 05:58 GMT+2
This one seems pretty well to take care of issues previously mentioned with other version. There is one more nagging thing that is a consequence of this method and that is: because playing back the audio sets the time, if tracks are resumed with playback paused (using auto-resume), the time isn't set until unpausing but shows "0:00".

So, gotta get that one right too.
   pcmbuf-timestamping-16.patch (79 KiB)
 apps/pcmbuf.c            | 1225 +++++++++++++++++++++++++----------------------
 apps/pcmbuf.h            |   17 
 apps/codec_thread.c      |   15 
 apps/playback.c          |  150 +----
 apps/codecs/vorbis.c     |    3 
 apps/codecs/flac.c       |    4 
 apps/codecs/aiff.c       |    2 
 apps/codecs/ape.c        |    3 
 apps/codecs/au.c         |    2 
 apps/codecs/adx.c        |    7 
 apps/codecs/vox.c        |    2 
 apps/codecs/mpa.c        |   12 
 apps/codecs/mpc.c        |    4 
 apps/codecs/aac.c        |    5 
 apps/codecs/speex.c      |    1 
 apps/codecs/spc.c        |    2 
 apps/codecs/tta.c        |    2 
 apps/codecs/alac.c       |    2 
 apps/codecs/wmapro.c     |    1 
 apps/codecs/wav64.c      |    2 
 apps/codecs/wmavoice.c   |    2 
 apps/codecs/mod.c        |    3 
 apps/codecs/sid.c        |    2 
 apps/codecs/shorten.c    |    3 
 apps/codecs/wma.c        |    3 
 apps/codecs/a52_rm.c     |    1 
 apps/codecs/smaf.c       |    2 
 apps/codecs/a52.c        |    2 
 apps/codecs/cook.c       |    4 
 apps/codecs/wavpack.c    |    2 
 apps/codecs/wav.c        |    2 
 firmware/export/system.h |    4 
 32 files changed, 780 insertions(+), 711 deletions(-)

Comment by Michael Sevakis (MikeS) - Monday, 08 August 2011, 19:04 GMT+2
That one issue of getting paused times is really a sticky wicket indeed. Still looking for a magic angle on this one or else things will be more warty than I care to have them be.
Comment by Michael Sevakis (MikeS) - Tuesday, 23 August 2011, 05:22 GMT+2
Do a resync to r30340. A partial solution exists to the aformentioned problem but the crossfade case is still not nice to work out.

Edit: Fix revision number
   pcmbuf-timestamping-21.patch (88 KiB)
 apps/pcmbuf.c            | 1399 +++++++++++++++++++++++++----------------------
 apps/pcmbuf.h            |   28 
 apps/codec_thread.c      |   15 
 apps/playback.c          |  204 ++----
 apps/codecs/adx.c        |    7 
 apps/codecs/aac.c        |    5 
 apps/codecs/speex.c      |    1 
 apps/codecs/alac.c       |    2 
 apps/codecs/wav64.c      |    2 
 apps/codecs/wmavoice.c   |    2 
 apps/codecs/mod.c        |    3 
 apps/codecs/shorten.c    |    3 
 apps/codecs/wma.c        |    3 
 apps/codecs/a52_rm.c     |    1 
 apps/codecs/smaf.c       |    2 
 apps/codecs/cook.c       |    4 
 apps/codecs/vorbis.c     |    3 
 apps/codecs/flac.c       |    4 
 apps/codecs/aiff.c       |    2 
 apps/codecs/ape.c        |    3 
 apps/codecs/au.c         |    2 
 apps/codecs/vox.c        |    2 
 apps/codecs/mpa.c        |   12 
 apps/codecs/mpc.c        |    4 
 apps/codecs/spc.c        |    2 
 apps/codecs/tta.c        |    2 
 apps/codecs/wmapro.c     |    1 
 apps/codecs/sid.c        |    2 
 apps/codecs/a52.c        |    2 
 apps/codecs/wavpack.c    |    2 
 apps/codecs/wav.c        |    2 
 firmware/export/system.h |    4 
 32 files changed, 926 insertions(+), 804 deletions(-)

Comment by Michael Sevakis (MikeS) - Sunday, 28 August 2011, 05:38 GMT+2
Ok, got a working solution that is not so bad. I'm not sure what was holding it up now. Next update is a commit.

Loading...