[Alsaplayer-devel] Re: Alsaplayer JACK implement question
Andy Lo A Foe
alsa at alsaplayer.org
Sun Feb 27 21:43:57 GMT 2005
Hi Ian,
Well, I'm doing something pretty sneeky. As alsaplayer supports 'speed'
control whenever an input file's sample rate differs from the output
device a special multiplier is used to compensate for this difference.
If a 22KHz input is played and JACK is configured for 44KHz the
multiplier is set to 0.5 which results in a sample being output twice.
It makes supporting variable sample rates a breeze ;-)
The relevant code is in CorePlayer.cpp, check out the SetSpeedMulti().
This is called from, for instance:
pcm_worker()
Hope this helps...
Regards,
Andy
PS. Cc to alsaplayer-devel as it might interest others as well
Erickson, Ian wrote:
>Hi Andy,
>
>I was hoping you could explain something to me...
>
>I'm new to audio programming and am playing around with adding a audio
>component to a remote desktop application that I'm toying with - using
>JACK and ALSA, just picked these up.
>
>I've been using your implementation of JACK.cpp in the alsaplayer for
>some insight.
>
>What I want to ask is: I am able to start the JACK daemon at say
>22100KHz sample rate. I can then start two instances of alsaplayer, one
>playing a 8-bit 11k mono audio file, another playing a 16bit 44k stereo
>audio file, seamlessly at the same time.
>
>Where are you doing the resampling to match the JACK d's 22k rate?
>Right now my app works flawlessly, but I have to match my source audio
>to JACK d's sample rate. Make sense?
>
>Its just a mystery to me how or where you are handling multiple
>unmatching rates w/ the JACK d.
>
>Any help in understanding how JACK and alsaplayer works along these
>lines would be helpful!!
>
>Thanks!!
>
>-ian
>
>
More information about the alsaplayer-devel
mailing list