Fix a/b and cross-fade plugins to handle unconnected inputs
This commit is contained in:
parent
230883c678
commit
134319bde6
@ -64,14 +64,19 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
|||||||
-- optimize fixed gain case (copy buffers)
|
-- optimize fixed gain case (copy buffers)
|
||||||
if cur_a == target_A and cur_b == target_B then
|
if cur_a == target_A and cur_b == target_B then
|
||||||
if target_A == 1.0 then
|
if target_A == 1.0 then
|
||||||
-- the first set of channels channel may be in-place
|
if ia == ARDOUR.ChanMapping.Invalid then
|
||||||
if buf_aout ~= bufs:get_audio(ia) then
|
buf_aout:silence (n_samples, offset)
|
||||||
|
elseif buf_aout ~= bufs:get_audio(ia) then
|
||||||
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
assert (buf_aout ~= bufs:get_audio(ib))
|
if ib == ARDOUR.ChanMapping.Invalid then
|
||||||
assert (target_B == 1.0)
|
buf_aout:silence (n_samples, offset)
|
||||||
buf_aout:read_from (bufs:get_audio(ib):data (0), n_samples, offset, offset)
|
else
|
||||||
|
assert (buf_aout ~= bufs:get_audio(ib))
|
||||||
|
assert (target_B == 1.0)
|
||||||
|
buf_aout:read_from (bufs:get_audio(ib):data (0), n_samples, offset, offset)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
goto next
|
goto next
|
||||||
end
|
end
|
||||||
@ -84,16 +89,17 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
|||||||
cur_b = ARDOUR.Amp.apply_gain (bufs:get_audio(ib), sr, n_samples, gB, target_B, offset)
|
cur_b = ARDOUR.Amp.apply_gain (bufs:get_audio(ib), sr, n_samples, gB, target_B, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- channels are supposed to be in linear order
|
|
||||||
assert (buf_aout ~= bufs:get_audio(ib))
|
|
||||||
|
|
||||||
-- copy input to output if needed (first set of channels may be in-place)
|
-- copy input to output if needed (first set of channels may be in-place)
|
||||||
if buf_aout ~= bufs:get_audio(ia) then
|
if ia == ARDOUR.ChanMapping.Invalid then
|
||||||
|
buf_aout:silence (n_samples, offset)
|
||||||
|
elseif buf_aout ~= bufs:get_audio(ia) then
|
||||||
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add the second buffer
|
-- add the second buffer
|
||||||
ARDOUR.DSP.mix_buffers_no_gain (buf_aout:data (offset), bufs:get_audio(ib):data (offset), n_samples)
|
if ib ~= ARDOUR.ChanMapping.Invalid then
|
||||||
|
ARDOUR.DSP.mix_buffers_no_gain (buf_aout:data (offset), bufs:get_audio(ib):data (offset), n_samples)
|
||||||
|
end
|
||||||
|
|
||||||
::next::
|
::next::
|
||||||
end
|
end
|
||||||
|
@ -66,14 +66,19 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
|||||||
-- optimize hard A/B fixed gain case (copy buffers)
|
-- optimize hard A/B fixed gain case (copy buffers)
|
||||||
if cur_a == target_A and cur_b == target_B then
|
if cur_a == target_A and cur_b == target_B then
|
||||||
if target_A == 1.0 then
|
if target_A == 1.0 then
|
||||||
-- the first (and only first) channel may be in-place
|
if ia == ARDOUR.ChanMapping.Invalid then
|
||||||
if buf_aout ~= bufs:get_audio(ia) then
|
buf_aout:silence (n_samples, offset)
|
||||||
|
elseif buf_aout ~= bufs:get_audio(ia) then
|
||||||
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
||||||
end
|
end
|
||||||
goto next
|
goto next
|
||||||
elseif target_B == 1.0 then
|
elseif target_B == 1.0 then
|
||||||
assert (buf_aout ~= bufs:get_audio(ib))
|
if ib == ARDOUR.ChanMapping.Invalid then
|
||||||
buf_aout:read_from (bufs:get_audio(ib):data (0), n_samples, offset, offset)
|
buf_aout:silence (n_samples, offset)
|
||||||
|
else
|
||||||
|
assert (buf_aout ~= bufs:get_audio(ib))
|
||||||
|
buf_aout:read_from (bufs:get_audio(ib):data (0), n_samples, offset, offset)
|
||||||
|
end
|
||||||
goto next
|
goto next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -86,16 +91,17 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
|||||||
cur_b = ARDOUR.Amp.apply_gain (bufs:get_audio(ib), sr, n_samples, gB, target_B, offset)
|
cur_b = ARDOUR.Amp.apply_gain (bufs:get_audio(ib), sr, n_samples, gB, target_B, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- channels are supposed to be in linear order
|
|
||||||
assert (buf_aout ~= bufs:get_audio(ib))
|
|
||||||
|
|
||||||
-- copy input to output if needed (first set of channels may be in-place)
|
-- copy input to output if needed (first set of channels may be in-place)
|
||||||
if buf_aout ~= bufs:get_audio(ia) then
|
if ia == ARDOUR.ChanMapping.Invalid then
|
||||||
|
buf_aout:silence (n_samples, offset)
|
||||||
|
elseif buf_aout ~= bufs:get_audio(ia) then
|
||||||
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
buf_aout:read_from (bufs:get_audio(ia):data (0), n_samples, offset, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add the second buffer
|
-- add the second buffer
|
||||||
ARDOUR.DSP.mix_buffers_no_gain (buf_aout:data (offset), bufs:get_audio(ib):data (offset), n_samples)
|
if ib ~= ARDOUR.ChanMapping.Invalid then
|
||||||
|
ARDOUR.DSP.mix_buffers_no_gain (buf_aout:data (offset), bufs:get_audio(ib):data (offset), n_samples)
|
||||||
|
end
|
||||||
|
|
||||||
::next::
|
::next::
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user