[Alsaplayer-devel] bug in save/restore of the pause functionality
Christoph Delfs
christoph.delfs at gmx.de
Wed Mar 7 12:27:56 GMT 2007
Hi all,
I am wondering whether the problem Eric Winn has described earlier (in 2005) has been analyzed further in the past. I would like to cite from the mailing list below. Any comments from the audience?
Cheers
Christoph
######################################
Hi Erik,
I will have a look at the problem. Sounds like a bug in the save/restore
of the pause functionality...
Thanks,
Andy
On Wed, Nov 05, 2003 at 11:18:27PM -0800, Erik Winn wrote:
> Hi,
>
> Tried a sort of brief question about this a few days ago - but it seems not
> to have even made it to the list; I would very much appreciate some sort of
> acknowledgement of this post if it is going to the private list (to which I
> have subscribed but also without response ...) so that I know if I am talking
> to the wall or not.
>
> For everything else, the latest version running with jackd 0.8 is great and
> quite impressive (I especially like the reverse playback feature - neat
> trick.), but I have found a nice glitch in pause/unpause funtionality that
> causes incremental decrease in playback sample rates.
>
> Here is the basic problem - I have isolated it to be related to the mad
> plugin's interaction with CorePlayer::GetSpeed/SetSpeed after Pause when the
> file being played is of a lower sample rate. For instance, I play an mp3 with
> 56 kbps, 22 kHz (joint stereo), no CRC, no padding. At 44100, ap_get_speed()
> returns 50 - which is correct scaling, but it seems that this is stored
> somewhere and used to SetSpeed after pause. Here is what I have found so far:
>
> First, it saves a pitch point in CorePlayer::Start like this
> CorePlayer.cpp, line 585:
> output_rate = node->SamplingRate();
> input_rate = plugin->sample_rate(the_object);
>
> if (input_rate == output_rate)
> SetSpeedMulti(1.0);
> else
> SetSpeedMulti((float) input_rate / (float) output_rate);
> update_pitch();
>
> ... well, mad_sample_rate will do this:
>
> mad_engine.c, line 745:
> if (data)
> return data->samplerate;
>
> ... which, at this point should be 22050. Meaning, we call, effectively,
> SetSpeedMulti(0.5), after which pitch_multi gets 0.5 - and then update_pitch
> essentially divides pitch in half:
>
> CorePlayer.cpp, line 953:
> pitch = pitch_point;
> }
> pitch *= pitch_multi;
>
> ... Now, the next call to GetSpeed will return 0.5, so if we now pause and
> unpause ... well, here it is:
>
> void CorePlayer::Pause()
> {
> save_speed = GetSpeed ();
> SetSpeed (0.0);
> }
>
>
> void CorePlayer::UnPause()
> {
> if (save_speed)
> SetSpeed (save_speed);
> else
> SetSpeed (1.0);
> }
>
> The result is that everytime one pauses/unpauses, the speed is cut in half.
> The same applies for 44100 samplerate mp3s if we are running jackd at 48000
> and neglect to use -F 48000, frequency will be correctly scaled and
> ap_get_speed will return 92, so every un/pause will reduce playback by
> (previous_rate * 0.91875), and so on.
>
> I am quite unsure where to introduce a fix for this - I have only just
> started looking at the code and spent but a few hours with it. I would be
> happy to implement it and submit a patch if you would be good enough to
> suggest where/how this might be done to fit and not break frequency scaling.
>
> Best, and thanks for a nice player,
> Erik Winn
#######################################
--
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out
More information about the alsaplayer-devel
mailing list