JackOfAll wrote: 
> Triode,
> 
> I've spent a couple of hours this afternoon, seemingly chasing rainbows,
> trying to track down why the total number of frames coming out of the
> resample process (per track) did not equal the exact multiple of the
> input frames * oversampling ratio.... Something cranky is going on after
> a period of time, using the same resample process. (And yes, I took into
> account that some data from the old track might be left in the sox
> resample buffer, with a new track at the same sample rate, so was
> draining it before working out the numbers.) You might not like what
> I've done in the patch, creating a new resample process per track, and
> spoiling your code, but all my numbers work out......
> 
> In any case, in decode loop, drain() has to be called. Otherwise, last
> track in playlist will not be drained to out buf if anything is left in
> sox process buffer, without any new input.

I was doing per track resampling - see earlier code from Saturday ish. 
The reason for changed was that there is clearly history in the
resampler which I was trying to retain across track boundaries so we
don't change the filtering charateristics across a gapless transition. 
This is probably not noticable though..?

Can you comment on when you are counting the output frames.  You have
spend more time looking at what comes out of soxr_process than me, but I
have observed that not all calls result in output frames.  Hence on end
of a track, unless drain is called we won't get a complete count. 
However over the long term we should get all the frames out of it.  I do
need to fix it so drain is called at the end of a playlist - probably by
draining if the output buffer fill gets to less than say half full and
decode is complete.

Seems to me we have two options:
1) separate resample per track which will result in loss of filter state
over a gapless transition
2) one resample for all tracks, but need to make sure we drain at end of
a playlist.  Downside is that track start marks may not be in the right
place and potentially this will impact sync.

Which is preferred?


------------------------------------------------------------------------
Triode's Profile: http://forums.slimdevices.com/member.php?userid=17
View this thread: http://forums.slimdevices.com/showthread.php?t=98544

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to