Re: [linux-audio-dev] LADSPA and run_adding()

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

Subject: Re: [linux-audio-dev] LADSPA and run_adding()
From: Steve Harris (S.W.Harris_AT_ecs.soton.ac.uk)
Date: Sun Nov 19 2000 - 17:47:38 EET


On Sat, Nov 18, 2000 at 03:22:45PM -0500, Paul Barton-Davis wrote:
> Given that one or the other is the best in some *common* situations
> (though I may agree with you that run_replacing() is more common that
> run_adding()), and given that there isn't very much work to be done in
> the plug to supply both, why not require it ? the argument is that the
> host can do it, but that is suboptimal because of the L1/L2 cache
> situation. the plugins get slightly larger, but the difference between
> run_replacing() and run_adding() is so small that almost anyone can
> code it. in fact, steve's xml parser might even be able to generate the
> code automatically. too bad you can't pass "pointer to machine
> instruction" in any known language :)

I have a pathalogical fear of duplicated code, which I'm afraid is going
to be a common solution. The best thing I have come up with so far is
defining a macro for writing to an output:

write_to_buffer(buffer, value)

which gets #defined as
        (buffer = value)
before run(), and
        (buffer += ((value) * run_adding_gain))
before run_adding()

This would make the callback run* element for an amp:

<callback event="run">
        int pos;
    float coef = pow(10.0f, gain / 20.0f);

    for (pos = 0; pos &lt; sample_count; pos++) {
       write_to_buffer(*(output++), *(input++) * coef);
    }
</callback>

Can anyone see any glaring problems with this? Apart from uglyness, and
that I need to write a propper dtd. ;)

- Steve


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

This archive was generated by hypermail 2b28 : Sun Nov 19 2000 - 18:33:17 EET