On Thu, Apr 23, 2009 at 6:55 PM, Lennart Poettering <lennart at poettering.net> wrote: > On Wed, 22.04.09 19:14, s.jansen at gmail.com (s.jansen at gmail.com) wrote: > >> My audio hardware supports multiple sample rates (44.1khz, >> 48khz,96khz) and I thought it would be nice if pulseaudio can >> automatically adjust the global resample rate based on the incoming >> stream(s). This to avoid any unneeded resampling if the hardware is >> capable of accepting the requested sample rate. ?A simple scheme >> would be to set the sample rate to the maximum incoming samplerate >> of all streams. It would basically automatically scale up and down >> based on the max rate. > > This has been requested before. I don't think it is feasable however. > > Changing the sampling frequency requires reopening the audio > device. That will always result in discontinuities in audio. So, let's > say you take a phone call which is sampled at 8khz. Then an event > sound is played at 22khz. The device freq hence needs to be changed > from 8khz to 22khz for that short plop sound and then back again. Both > times you'd hear a short drop out. People would hate that. > > Also, modern sound cards usually only do *one* sampling type and *one* > sampling frequency. Spending time on the logic you suggest is hence > probably better invested in speeding up the resampler or improving it > otherwise. > > I'lll probably extend the current profile logic however, to allow > switching the output frequency with it. The most important reason for > that is digital output (spdif) since some amps cannot take 48khz or > cannot take 44khz and hence we need to allow the user to select which > freq he wants. > > If that's in place it should be easy to add some code that switches > profiles based on a policy like you suggest. But I don't think this > would lead to much, but I am always happy to be proven wrong. > > Lennart > Your arguments do make sense and your above example would be a situation when you don't want to switch sampling rates.