[pulseaudio-discuss] Supporting hardware resampling
Colin Guthrie
gmane at colin.guthr.ie
Tue Nov 30 04:44:45 PST 2010
'Twas brillig, and Wade Brown at 30/11/10 02:57 did gyre and gimble:
> Pierre,
>
>> Default PulseAudio behavior is to mix in software. If you wanted to
>> mix in hardware, you could highjack the passthrough work I've been
>> doing for AC3. Essentially one device for sw mix, and a number of hw
>> devices with no processing in PulseAudio. Still fairly hairy stuff at
>> this point since you need to tag each stream as passthrough or not,
>> and route explicitely to a specific device for hw or sw mixing. You
>> would also need to load these devices by hand in the default.pa
>> configuration or use a specific profile for your hardware.
>> -Pierre
>
> I assume you're talking about the submitted patch here:
> http://www.mail-archive.com/pulseaudio-discuss@mail.0pointer.de/msg07283.html
>
> It seems like I could work with this, but it may not be pleasant. I
> haven't dug too deep yet, but if the nature of Pulse Audio is to only
> deliver one stream to any given sink I'm probably out of luck.
> Creating several would be easy, but routing streams intelligently does
> not look look so friendly. I don't suppose anybody has cobbled
> together some sort of round robin allocator.
For passthrough stuff, yes, it can only take one stream at a time, but
for normal audio there can be multiple streams which are all mixed and
resampled (or resampled and then mixed, I'm not 100% sure which: the
windows policy is to mix first AFAICT,
http://msdn.microsoft.com/en-us/library/ff537756%28v=VS.85%29.aspx but
would need to look and see what we do as i don't know that bit of the
code too well).
In theory you'd want to group all the same-freq data together, mix it
and then pass it to the sink which would use the DSP to do the
resampling needed, which isn't really something supported right now in
the PA architecture AFAIK.
The trick comes from knowing the h/w can do this. I guess one way of
working would be to change things so that each sink can actually open
the h/w multiple times for different sample rates if it supports h/w
mixing and simply route the audio to the appropriate connection, all the
while maintaining a single sink "view" to all things higher up.
This would require a reasonable amount of rework to do things correctly
however (and I'm not even sure that it's the right approach anyway).
It's likely something that will be attached in some way to the UCM work
in alsa, so that this kind of thing is only configured when we are told
it will work.
Just some idle musings on the topic that may, or may not be ill-informed!
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mageia Contributor [http://www.mageia.org/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
More information about the pulseaudio-discuss
mailing list