mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Clarify documentation of Lua inter-processor communication
This commit is contained in:
parent
0b51d760ad
commit
e4edd8e602
1 changed files with 10 additions and 3 deletions
|
|
@ -21,9 +21,10 @@ function dsp_run (ins, outs, n_samples)
|
||||||
local route = self:route ()
|
local route = self:route ()
|
||||||
local shmem = self:shmem ()
|
local shmem = self:shmem ()
|
||||||
|
|
||||||
|
-- count plugins
|
||||||
local i = 0;
|
local i = 0;
|
||||||
local l = 0;
|
local l = 0;
|
||||||
local s = -1;
|
local s = -1; -- 'self' this plugin instance
|
||||||
|
|
||||||
-- iterate overall plugins on this track,
|
-- iterate overall plugins on this track,
|
||||||
-- find all LuaProc instances of this plugin (unique_id),
|
-- find all LuaProc instances of this plugin (unique_id),
|
||||||
|
|
@ -33,12 +34,16 @@ function dsp_run (ins, outs, n_samples)
|
||||||
and not proc:to_insert():plugin (0):to_luaproc():isnil ()
|
and not proc:to_insert():plugin (0):to_luaproc():isnil ()
|
||||||
and proc:to_insert():plugin (0):unique_id () == self:unique_id () then
|
and proc:to_insert():plugin (0):unique_id () == self:unique_id () then
|
||||||
if (self:id ():to_s() == proc:to_insert():plugin (0):id ():to_s()) then
|
if (self:id ():to_s() == proc:to_insert():plugin (0):id ():to_s()) then
|
||||||
s = l; -- this plugin instance
|
s = l; -- *this* plugin instance
|
||||||
end
|
end
|
||||||
if l == 0 then
|
if l == 0 then
|
||||||
|
-- use shared-memory are of the first plugin instance for all.
|
||||||
|
--
|
||||||
|
-- (the first plugin writes there, all later plugins only read,
|
||||||
|
-- plugins on a track are executed in order, in the same thread)
|
||||||
shmem = proc:to_insert():plugin (0):to_luaproc():shmem ()
|
shmem = proc:to_insert():plugin (0):to_luaproc():shmem ()
|
||||||
end
|
end
|
||||||
l = l + 1 -- count total instances of this plugin
|
l = l + 1 -- count total instances of this plugin-type
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
until proc:isnil ()
|
until proc:isnil ()
|
||||||
|
|
@ -55,6 +60,8 @@ function dsp_run (ins, outs, n_samples)
|
||||||
peak = ARDOUR.DSP.compute_peak(outs[c], n_samples, peak)
|
peak = ARDOUR.DSP.compute_peak(outs[c], n_samples, peak)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- actual inter-plugin communication
|
||||||
local a = shmem:to_float (0):array ()
|
local a = shmem:to_float (0):array ()
|
||||||
if s == 0 then
|
if s == 0 then
|
||||||
-- the first plugin saves the peak
|
-- the first plugin saves the peak
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue