Re: [linux-audio-dev] PTAF link and comments

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] PTAF link and comments
From: David Olofson (david@olofson.net)
Date: Mon Feb 03 2003 - 16:42:26 EET


On Monday 03 February 2003 15.12, Sami P Perttu wrote:
> On Mon, 3 Feb 2003, David Olofson wrote:
> > > As a plugin author, having to implement
> > > both is a pain. I use code generation to make both functions.
> >
> > You don't necessarily *have* to implement both. Even the
> > primitive FX plugin API of Audiality have these variants:
> >
> > void (*process)(struct ADY_plugin *p,
> > int *buf, unsigned frames);
> > void (*process_r)(struct ADY_plugin *p,
> > int *in, int *out, unsigned frames);
> > void (*process_m)(struct ADY_plugin *p,
> > int *in, int *out, unsigned frames);
> >
> > ...and you only *have* to provide *one* - any variant will do. If
> > you don't provide all of them, the host "SDK" will emulate the
> > others using the ones that are provided.
>
> I think this is bad.

It's a primitive performance hack. Once upon a time, these things
actually mattered... ;-)

> There should be just one process() function,
> which could be given two gain values, one for previous output and
> another for the plugin's own output. Plugins would do
>
> out[i] = previous_gain * out[i] + gain * myoutput;
>
> When previous gain is zero this is almost equivalent to replace
> except that NANs and maybe some other values will screw you.
> Solution: forbid NANs as output and maybe cleanse buffers
> periodically. And initially, of course.

Well, that cover's all the cases, and you *can* still optimize with
alternative inner loops if you like. Just check for 0.0 gains - but
remember that the gain controls will most probably be normal *ramped*
controls, so you can't just check the initial value.

Looks like a great idea.

As to NANs, I think you're pretty screwed if you get them in an audio
stream anyway. Plugins that generate NANs are broken, as are hosts
that allow plugins to operate on garbage buffers.

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

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`---------------------------> http://olofson.net/audiality -'
   --- http://olofson.net --- http://www.reologica.se ---


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Feb 03 2003 - 16:55:56 EET