[pulseaudio-discuss] PA and OS X

Daniel Mack daniel at caiaq.de
Fri Jul 17 04:35:08 PDT 2009


On Fri, Jul 17, 2009 at 02:14:54PM +0300, Tanu Kaskinen wrote:
> pe, 2009-07-17 kello 12:12 +0200, Daniel Mack kirjoitti:
> > Is there any standard internal audio sample format? CoreAudio works with
> > floats all the way, so it would be perfect if there were no further
> > sample conversions included (which is tricky as floats in kernel space
> > are considered evil in Mac OS X, similar to Linux).
> 
> Since Colin didn't have a detailed answer to this, I'll try...
> 
> So any native CoreAudio clients will be pushing and recording only float
> samples? That's fine - the IOAudioEngine thingy will then create float
> streams to the PA server (this is fully supported).

The native format inside IOAudioEngines is float, yes. You can make it
transport different sample formats, but you would have to care for the
conversion yourself. Which sucks, as you need to care for SSE2/Altivec
and all the other performance booters yourself as well and deal with
different compiler flags for differen platforms and so on. But it seems
we can avoid all this by purely using floats then. Which is good.

> And when doing the input/output modules, they talk to the sound card
> only with float samples too?

Not necessarily, no. You can plug in a converter to your audio graph
(see the xine code I posted).

> Then the sinks and sources you create can
> only be configured to work in float mode. Which is fine too. Clients can
> use any format they like when communicating with the server. If the
> format of the stream and the sink/source don't match, conversion is done
> by the existing framework. Neither clients nor the sink/source module
> implementers need to care much about sample format issues.

The thing is, you can never know how soundcards handle their native
samples. They're most likely _not_ in float, so their drivers will
convert it back to ints. It doesn't really matter from that side, but
for consistency reasons, we can use floats here as well.

But don't confuse these two modules, they need to be completely
separated. And as Colin pointed out, the macosx-{source,sink} module
would need to be a module for the PA server, while the userspace backend
for the kernel module should be a self-contained, libpulse based kind of
daemon. So they also live in different spaces.

> So, if I understood this correctly, local streams on Mac would always
> use float samples and no conversions are needed at any point, other than
> sample rate conversions (which are also done somewhat transparently by
> the existing framework).

We can make this the verdict, yes.

Daniel




More information about the pulseaudio-discuss mailing list