how to find out PulseAudio's base rate (44100?) from ALSA?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-01-17 at 15:51 +0100, Joerg-Cyril.Hoehle at t-systems.com
wrote:
> Hi,
> 
> I've been using open with SND_PCM_NO_AUTO_RESAMPLE to no avail with PulseAudio.
> When using plug:dmix, resampling was disabled, and using the usual snd_pcm_hw_params_*
> functions, I could identify that dmix prefers 32bit samples at 48000 (at least on an Intel HDA machine).
> Similarly, hw:0 will reveal that it can only play 16bit stereo at 48000 and 44100 (IIRC).
> 
> How can I find out PA's preferred rate? 44100 is found in one of its configuration files on an
> Ubuntu system, but I'd like the alsa_plugins to tell me that when I'm using snd_pcm_open("default").

There's no "PA's preferred rate". There can be multiple sound cards, and
each of them can run at a different sample rate. If you use "default" as
the alsa device, the alsa plugin doesn't know which sink is going to be
used until the stream is actually created. Even then your stream may get
moved to another sink later on the fly. But if you want to avoid
resampling just to optimize things (that is, you can live also with
resampling), the stream moving case probably isn't something that
matters much, because it's a relatively rare event.

It's possible to create a stream so that the sample rate will be fixed
to the rate of whatever sink gets selected. I wonder if the alsa plugin
could use that functionality with SND_PCM_NO_AUTO_RESAMPLE. I don't know
the alsa interface well, but I would guess that it's just not possible
to create the stream yet at the phase when you're calling the
snd_pcm_hw_params_* functions. Therefore, my guess is that it is
currently impossible to achieve what you want, and that it's not going
to change in the future.

There's a new feature in the next Pulseaudio release, though, that
should make things a little better for your case: if the sound card
supports both 44100 and 48000, the rate should get automatically
selected so that it matches the wine stream rate, unless there was
already something else playing when the wine stream was created.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux