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

Attached to Project: Rockbox
Opened by Michael Sevakis (MikeS) - Saturday, 11 June 2011, 23:28 GMT
Last edited by Michael Sevakis (MikeS) - Sunday, 28 August 2011, 08:44 GMT
Task Type Patches
Category Music playback
Status Closed
Assigned To Michael Sevakis (MikeS)
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


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.


* 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.
This task depends upon

Closed by  Michael Sevakis (MikeS)
Sunday, 28 August 2011, 08:44 GMT
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, 06:02 GMT
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.
Comment by Rosso Maltese (asettico) - Friday, 22 July 2011, 13:07 GMT
Sync to r30189.
Comment by Michael Sevakis (MikeS) - Saturday, 23 July 2011, 09:25 GMT
Some cleanups. Fix a minor bungle or two. Still thinking-over the progress stuff mentioned above.
Comment by Michael Sevakis (MikeS) - Tuesday, 26 July 2011, 03:58 GMT
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.
Comment by Michael Sevakis (MikeS) - Monday, 08 August 2011, 17:04 GMT
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, 03:22 GMT
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
Comment by Michael Sevakis (MikeS) - Sunday, 28 August 2011, 03:38 GMT
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.