Hi All,
I'm trying to write a LADSPA plugin to do the following:
Given n inputs (lets say 4), and one output, It should present the
highest "priority" input on the output. Input 1 is the lowest priority,
with Input 4 being the highest.
In order to write this in code, within the runPriomux function, I do
this:
y=-1;
for (i=0; i<=3; i++)
{
pfBuffer=*(pfInput[i]++);
if (pfBuffer > -1.0f)
y=i;
}
if (y!=-1)
*(pfOutput++)=pfBuffer;
i is the input channel (0-3, not 1-4, but you know what I mean)
y is what is supposed to be the highest priority channel with audio
on it.
Now..here's where Im confused. I thought the values for audio samples
in LADSPA were -1.0f...1.0f (with -1.0f being infinity). This doesn't
seem to work, as the above code always appears to think that the 4th
input (i=3) has data on it, even if it's muted in ardour (via another
bus that's single output is connected to input 4...)
I've also looked at the code of meterbridge, and tried using -70.0f,
but with the same problem...Anyone want to plant me a clue on what
I'm doing wrong ?
I've attached the entire plugin source below. It's really been ripped
off of the example amp in the LADSPA SDK I'm afraid....
Thanks in advance for any help, this last bit is driving me mad, now
I've worked out how to code plugins!
All the Best
Iain