|
|
Log in / Subscribe / Register

API target

API target

Posted Oct 14, 2009 12:15 UTC (Wed) by pharm (guest, #22305)
In reply to: API target by drag
Parent article: LPC: The past, present, and future of Linux audio

If you target Alsa then you can use the 'safe' subset that is supported by PulseAudio then you might be fine.

The (slightly abrasive, but ultimately useful) discussion on the Braid blog about audio support under Linux eventually revealed that the safe Alsa subset isn't really a great deal of use, because you can't guarantee to get your hands on the audio ring buffer & rewrite the parts that haven't been played yet on the fly: The alsa mmap functions that let you do this aren't part of the safe core :(

The *biggest* issue that arose from that discussion was that it's well nigh on impossible for a developer to work out what they're expected to use if they need more than the basic SDL sound API (which can't do a great deal more than 'play this sound now please'). The safe ALSA subset plus the mmap alsa functions (since most hardware can expose those in reality) is probably it, but that isn't exactly well-advertised.


to post comments

API target

Posted Oct 20, 2009 9:32 UTC (Tue) by njs (subscriber, #40338) [Link] (1 responses)

But, uh, the mmap functions can't possibly be supported over an emulated-in-userspace sound device, i.e., what we're all using now that our "alsa" output is going to pulseaudio?

A better API is clearly needed, but I don't think it involves mmap.

API target

Posted Oct 20, 2009 10:57 UTC (Tue) by cladisch (✭ supporter ✭, #50193) [Link]

> But, uh, the mmap functions can't possibly be supported over an emulated-in-userspace sound device

Classic mmap() can't. However, the ALSA API requires that the applications tells when and where it wants to access the buffer, and when it is done, so it is possible to emulate mmap on top on devices without a memory buffer. (In that case, the extra buffer adds latency, of course.)

> A better API is clearly needed

ALSA has snd_pcm_forward/rewind functions to move around in the buffer. However, these functions are optional, and the PulseAudio plugin does not implement them.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds