Re: [linux-audio-dev] Juce now has ALSA support!

From: David Olofson <david@email-addr-hidden>
Date: Fri Mar 03 2006 - 09:16:46 EET

On Friday 03 March 2006 02:38, Lee Revell wrote:
> On Wed, 2006-03-01 at 21:40 -0500, Paul Davis wrote:
> > its presentation of a multiplicity of programming models
>
> How would you solve this? Make people who insist on a
> read()/write()
> interface go through the OSS emulation layer? Would you remove
> everything but the mmap() interface? The callback interface?

Well, there is a reason why all "serious" audio APIs use the callback
model. It's the only model that really works for low latency audio.
If you want to do serious real time audio, you'll have to get your
head around this model anyway. (You need to keep the CPU load steady,
and generating N samples every cycle rather than larger blocks "every
now and then" is the first step.) If you're not doing real time
stuff, you can wrap any API with whatever type of API you like, as
the buffering that is sometimes required, won't matter.

Indeed, there are some "latency reduction" tricks you can play with an
mmap() interface, but those are inefficient, messy hacks that you are
(or rather, were) forced to use to get usable latency in games on
some platforms. Not really usable for musical applications, and the
method doesn't fit well into engines with master effects and the
like. Callbacks on a proper OS are simpler, more reliable and more
efficient.

A read()/write() interface is basically just a (more or less) buffered
wrapper over a real interface. I frankly don't understand why one
would want to use something like it for anything remotely resembling
real time audio I/O. All it does is confuse matters WRT how much
buffering you actually have, especially when you're doing full duplex
audio. It may be handy in non real time applications (sometimes it's
easier to let the algorithm control the block sizes), but as those
aren't sensitive to additional buffering, you can just wrap the real
API with whatever you like. No reason to break or complicate the real
API to support that.

//David Olofson - Programmer, Composer, Open Source Advocate

.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
Received on Fri Mar 3 12:15:18 2006

This archive was generated by hypermail 2.1.8 : Fri Mar 03 2006 - 12:15:18 EET