[linux-audio-dev] Plugin APIs (again)

David Olofson david at olofson.net
Wed Dec 4 16:54:00 UTC 2002


On Wednesday 04 December 2002 22.29, Steve Harris wrote:
> On Wed, Dec 04, 2002 at 10:05:25 +0100, David Olofson wrote:
> > 	Nice but simple:
> > 		Accept disconnected ports, and just check the
> > 		pointers, or whatever. (Note that passing NULL
> > 		buffers might have other users. In Audiality,
> > 		it's legal for inputs, and means "silence for
> > 		one frame". IIRC, you can turn the feature off,
> > 		if you like, forcing the host to always pass
> > 		valid buffers.)
>
> This one sounds good to me, Mattias suggested something similar for
> LADSPA.

Especially for the inputs, where it coincides with the really rather 
useful "NULL input instead of a buffer means silence" feature - which 
actually is the same thing as "this input is not connected right 
new", for all practical purposes. (Unless you want to emulate pops 
and clicks generated when pulling and plugging analog cables, that 
is. ;-)

However, it's not fun when you're in an inner loop like this:

	for(i = 0; i < frames; ++i)
	{
		float s = inputs[0][i];

		...interesting code here...

		outputs[0][i] = s * controls[0];
		outputs[1][i] = s * controls[1];
		outputs[2][i] = s * controls[2];
		outputs[3][i] = s * controls[3];
		outputs[4][i] = s * controls[4];
	}

Sure, you could turn the loop inside out, but if the "interesting 
code" is complicated, you'll want an intermediate buffer, not to have 
5 copies of that code.

Why not keep it simple, and have the ability to say that the host 
shouldn't pass NULL pointers for output buffers to this plugin?


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

.- Coming soon from VaporWare Inc...------------------------.
| The Return of Audiality! Real, working software. Really!  |
| Real time and off-line synthesis, scripting, MIDI, LGPL...|
`-----------------------------------> (Public Release RSN) -'
.- M A I A -------------------------------------------------.
|    The Multimedia Application Integration Architecture    |
`----------------------------> http://www.linuxdj.com/maia -'
   --- http://olofson.net --- http://www.reologica.se ---



More information about the Linux-audio-dev mailing list