Remove dsp_has_midi_*() in favor of dsp_ioconfig()
_has_midi_*put members of LuaProc will be set according to the actual configuration chosen, for configure_io() and run() to use.
This commit is contained in:
parent
82e1ef5fb0
commit
66470b96b7
@ -228,25 +228,6 @@ LuaProc::load_script ()
|
||||
}
|
||||
}
|
||||
|
||||
// query midi i/o
|
||||
luabridge::LuaRef lua_dsp_has_midi_in = luabridge::getGlobal (L, "dsp_has_midi_input");
|
||||
if (lua_dsp_has_midi_in.type () == LUA_TFUNCTION) {
|
||||
try {
|
||||
_has_midi_input = lua_dsp_has_midi_in ();
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
luabridge::LuaRef lua_dsp_has_midi_out = luabridge::getGlobal (L, "dsp_has_midi_output");
|
||||
if (lua_dsp_has_midi_out.type () == LUA_TFUNCTION) {
|
||||
try {
|
||||
_has_midi_output = lua_dsp_has_midi_out ();
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
_ctrl_params.clear ();
|
||||
|
||||
luabridge::LuaRef lua_render = luabridge::getGlobal (L, "render_inline");
|
||||
@ -395,6 +376,8 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
|
||||
imprecise->set (DataType::AUDIO, (in)); \
|
||||
imprecise->set (DataType::MIDI, possible_midiin); \
|
||||
} \
|
||||
_has_midi_input = (possible_midiin > 0); \
|
||||
_has_midi_output = (possible_midiout > 0); \
|
||||
penalty = p; \
|
||||
found = true; \
|
||||
} \
|
||||
@ -436,8 +419,8 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
|
||||
|
||||
int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
|
||||
int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
|
||||
int possible_midiin = _has_midi_input ? 1 : 0;
|
||||
int possible_midiout = _has_midi_output ? 1 : 0;
|
||||
int possible_midiin = io["midi_in"].isNumber() ? io["midi_in"] : 0;
|
||||
int possible_midiout = io["midi_out"].isNumber() ? io["midi_out"] : 0;
|
||||
|
||||
if (midi_in != possible_midiin && !imprecise) {
|
||||
continue;
|
||||
|
@ -8,12 +8,9 @@ ardour {
|
||||
}
|
||||
|
||||
function dsp_ioconfig ()
|
||||
return { { audio_in = 0, audio_out = 0}, }
|
||||
return { { midi_in = 1, midi_out = 1, audio_in = 0, audio_out = 0}, }
|
||||
end
|
||||
|
||||
function dsp_has_midi_input () return true end
|
||||
function dsp_has_midi_output () return true end
|
||||
|
||||
function dsp_run (_, _, n_samples)
|
||||
assert (type(midiin) == "table")
|
||||
assert (type(midiout) == "table")
|
||||
|
@ -8,11 +8,9 @@ ardour {
|
||||
}
|
||||
|
||||
function dsp_ioconfig ()
|
||||
return { { audio_in = 0, audio_out = 0}, }
|
||||
return { { midi_out = 1, audio_in = 0, audio_out = 0}, }
|
||||
end
|
||||
|
||||
function dsp_has_midi_output () return true end
|
||||
|
||||
local tme = 0 -- sample-counter
|
||||
local seq = 1 -- sequence-step
|
||||
local spb = 0 -- samples per beat
|
||||
|
@ -13,12 +13,9 @@ local evlen = 3
|
||||
local hpadding, vpadding = 4, 2
|
||||
|
||||
function dsp_ioconfig ()
|
||||
return { { audio_in = -1, audio_out = -1}, }
|
||||
return { { midi_in = 1, midi_out = 1, audio_in = -1, audio_out = -1}, }
|
||||
end
|
||||
|
||||
function dsp_has_midi_input () return true end
|
||||
function dsp_has_midi_output () return true end
|
||||
|
||||
function dsp_params ()
|
||||
return
|
||||
{
|
||||
|
@ -10,14 +10,10 @@ ardour {
|
||||
-- return possible audio i/o configurations
|
||||
function dsp_ioconfig ()
|
||||
-- -1, -1 = any number of channels as long as input and output count matches
|
||||
return { { audio_in = -1, audio_out = -1}, }
|
||||
-- require 1 MIDI in, 1 MIDI out.
|
||||
return { { midi_in = 1, midi_out = 1, audio_in = -1, audio_out = -1}, }
|
||||
end
|
||||
|
||||
-- require 1 MIDI in, 1 MIDI out.
|
||||
function dsp_has_midi_input () return true end
|
||||
function dsp_has_midi_output () return true end
|
||||
|
||||
|
||||
-- "dsp_runmap" uses Ardour's internal processor API, eqivalent to
|
||||
-- 'connect_and_run()". There is no overhead (mapping, translating buffers).
|
||||
-- The lua implementation is responsible to map all the buffers directly.
|
||||
@ -91,7 +87,8 @@ function dsp_runmap (bufs, in_map, out_map, n_samples, offset)
|
||||
local midi_ins = in_map:count (): n_midi () -- number of midi input buffers
|
||||
local midi_outs = out_map:count (): n_midi () -- number of midi input buffers
|
||||
|
||||
-- with dsp_has_midi_in/out() the following will always be true
|
||||
-- with midi_in=1, midi_out=1 in dsp_ioconfig
|
||||
-- the following will always be true
|
||||
assert (midi_ins == 1)
|
||||
assert (midi_outs == 1)
|
||||
|
||||
|
@ -10,20 +10,15 @@ ardour {
|
||||
function dsp_ioconfig ()
|
||||
return
|
||||
{
|
||||
-- { audio_in = 0, audio_out = -1}, -- any number of channels
|
||||
-- { audio_in = 0, audio_out = 1}, -- values > 0, precisely N channels
|
||||
{ audio_in = 0, audio_out = 2}, -- values > 0, precisely N channels
|
||||
{ audio_in = 0, audio_out = 4}, -- values > 0, precisely N channels
|
||||
{ audio_in = 0, audio_out = 8}, -- values > 0, precisely N channels
|
||||
-- { audio_in = 0, audio_out = -6}, -- values < -2, up to -N channels, here 1,..,6
|
||||
-- { midi_in = 1, audio_in = 0, audio_out = -1}, -- any number of channels
|
||||
-- { midi_in = 1, audio_in = 0, audio_out = 1}, -- values > 0, precisely N channels
|
||||
{ midi_in = 1, audio_in = 0, audio_out = 2}, -- values > 0, precisely N channels
|
||||
{ midi_in = 1, audio_in = 0, audio_out = 4}, -- values > 0, precisely N channels
|
||||
{ midi_in = 1, audio_in = 0, audio_out = 8}, -- values > 0, precisely N channels
|
||||
-- { midi_in = 1, audio_in = 0, audio_out = -6}, -- values < -2, up to -N channels, here 1,..,6
|
||||
}
|
||||
end
|
||||
|
||||
function dsp_has_midi_input ()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
local note_table = {}
|
||||
local active_notes = {}
|
||||
local phases = {}
|
||||
|
Loading…
Reference in New Issue
Block a user