aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-09-26 03:47:17 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-09-26 03:47:17 +0200
commitaa0282f2e337fe644bcbaf64a8a568b95b8232b4 (patch)
tree543f88a4fda8d94795dd89706f266c4f80a44799
parent00deaf779f872253f7ab1395402f7a13c5264e8a (diff)
downloadapplause2-aa0282f2e337fe644bcbaf64a8a568b95b8232b4.tar.gz
LADSPAStream: fixed input port mapping
* User-provided arguments should correspond to the n'th input port instead of the n'th overall port. This failed if output ports were mixed with input ports (or come first) in the list of ports that the LADSPA plugin defines.
-rw-r--r--ladspa.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/ladspa.lua b/ladspa.lua
index b6af57e..3c207e8 100644
--- a/ladspa.lua
+++ b/ladspa.lua
@@ -257,16 +257,19 @@ function LADSPAStream:ctor(file, ...)
-- List of output port numbers (origin 0)
self.output_ports = {}
+ local input_port_count = 0
for i = 0, tonumber(self.descriptor.PortCount)-1 do
local port_descriptor = self.descriptor.PortDescriptors[i]
if bit.band(port_descriptor, ffi.C.LADSPA_PORT_INPUT) ~= 0 then
+ input_port_count = input_port_count + 1
+
local port_name = ffi.string(self.descriptor.PortNames[i])
-- We must connect all ports, so if the user does not provide
-- an input stream or constant, we try to provide a default.
-- There may be no default, in which case we throw an error.
- local data = input_ports[i+1] or input_ports[port_name] or
+ local data = input_ports[input_port_count] or input_ports[port_name] or
getPortDefault(self.descriptor.PortRangeHints[i]) or
error('Input stream/constant for port "'..port_name..'" in plugin '..
'"'..file..'" required')