diff --git a/libs/ardour/ardour/lua_api.h b/libs/ardour/ardour/lua_api.h index 527879bedb..9c97d9e313 100644 --- a/libs/ardour/ardour/lua_api.h +++ b/libs/ardour/ardour/lua_api.h @@ -429,6 +429,13 @@ namespace ARDOUR { namespace LuaAPI { std::list > > note_list (std::shared_ptr); + std::list > > + sysex_list (std::shared_ptr); + + std::list > > + patch_change_list (std::shared_ptr); + + } } /* namespace */ namespace ARDOUR { namespace LuaOSC { diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index 6dc818ad90..ec06287ec6 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -1158,6 +1158,32 @@ LuaAPI::note_list (std::shared_ptr mm) return note_ptr_list; } +std::list > > +LuaAPI::sysex_list (std::shared_ptr mm) +{ + typedef std::shared_ptr > SysExPtr; + + std::list event_ptr_list; + + for (auto const& i : mm->sysexes ()) { + event_ptr_list.push_back (i); + } + return event_ptr_list; +} + +std::list > > +LuaAPI::patch_change_list (std::shared_ptr mm) +{ + typedef std::shared_ptr > PatchChangePtr; + + std::list patch_change_ptr_list; + + for (auto const& i : mm->patch_changes ()) { + patch_change_ptr_list.push_back (i); + } + return patch_change_ptr_list; +} + /* ****************************************************************************/ const samplecnt_t LuaAPI::Rubberband::_bufsize = 256; diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 9e96eb46aa..73af0af10d 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -31,6 +31,7 @@ #include "evoral/Control.h" #include "evoral/ControlList.h" +#include "evoral/PatchChange.h" #include "ardour/amp.h" #include "ardour/async_midi_port.h" @@ -268,6 +269,7 @@ CLASSKEYS(ARDOUR::LuaOSC::Address); CLASSKEYS(ARDOUR::LuaProc); CLASSKEYS(ARDOUR::LuaTableRef); CLASSKEYS(ARDOUR::MidiModel::NoteDiffCommand); +CLASSKEYS(ARDOUR::MidiModel::SysExDiffCommand); CLASSKEYS(ARDOUR::MonitorProcessor); CLASSKEYS(ARDOUR::RouteGroup); CLASSKEYS(ARDOUR::ParameterDescriptor); @@ -349,7 +351,9 @@ CLASSKEYS(std::shared_ptr); CLASSKEYS(std::shared_ptr); CLASSKEYS(std::shared_ptr); CLASSKEYS(std::shared_ptr); +CLASSKEYS(std::shared_ptr >); CLASSKEYS(std::shared_ptr >); +CLASSKEYS(std::shared_ptr >); CLASSKEYS(std::shared_ptr >); CLASSKEYS(std::shared_ptr); @@ -972,6 +976,18 @@ LuaBindings::common (lua_State* L) .addFunction ("channel", &Evoral::Note::channel) .endClass () + .beginWSPtrClass > ("EventPtr") + .addFunction ("time", &Evoral::Event::time) + .addFunction ("size", &Evoral::Event::size) + //.addFunction ("buffer", (uint8_t*) &Evoral::Event::buffer) + .endClass () + + .beginWSPtrClass > ("PatchChangePtr") + .addFunction ("time", &Evoral::PatchChange::time) + .addFunction ("bank", &Evoral::PatchChange::bank) + .addFunction ("program", &Evoral::PatchChange::program) + .endClass () + /* libevoral enums */ .beginNamespace ("InterpolationStyle") .addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete)) @@ -1793,6 +1809,8 @@ LuaBindings::common (lua_State* L) .addFunction ("apply_command", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) /* deprecated: left here in case any extant scripts use apply_command */ .addFunction ("apply_diff_command_as_commit", (void (MidiModel::*)(Session*, PBD::Command*))&MidiModel::apply_diff_command_as_commit) .addFunction ("new_note_diff_command", &MidiModel::new_note_diff_command) + .addFunction ("new_sysex_diff_command", &MidiModel::new_sysex_diff_command) + .addFunction ("new_patch_change_diff_command", &MidiModel::new_patch_change_diff_command) .endClass () .beginNamespace ("MidiModel") @@ -1804,6 +1822,16 @@ LuaBindings::common (lua_State* L) .addFunction ("remove", &ARDOUR::MidiModel::NoteDiffCommand::remove) .endClass () + .deriveClass ("NoteDiffCommand") + .addFunction ("change", &ARDOUR::MidiModel::SysExDiffCommand::change) + .addFunction ("remove", &ARDOUR::MidiModel::SysExDiffCommand::remove) + .endClass () + + .deriveClass ("NoteDiffCommand") + .addFunction ("add", &ARDOUR::MidiModel::PatchChangeDiffCommand::add) + .addFunction ("remove", &ARDOUR::MidiModel::PatchChangeDiffCommand::remove) + .endClass () + .endNamespace () /* ARDOUR::MidiModel */ .beginClass ("PresetRecord") @@ -2344,6 +2372,12 @@ LuaBindings::common (lua_State* L) .beginStdList > > ("NotePtrList") .endClass () + .beginStdList > > ("EventPtrList") + .endClass () + + .beginStdList > > ("PatchChangePtrList") + .endClass () + .beginConstStdCPtrList ("EventList") .endClass () @@ -3176,6 +3210,8 @@ LuaBindings::common (lua_State* L) .addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename) .addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr) .addFunction ("note_list", ARDOUR::LuaAPI::note_list) + .addFunction ("sysex_list", ARDOUR::LuaAPI::sysex_list) + .addFunction ("patch_change_list", ARDOUR::LuaAPI::patch_change_list) .addCFunction ("sample_to_timecode", ARDOUR::LuaAPI::sample_to_timecode) .addCFunction ("timecode_to_sample", ARDOUR::LuaAPI::timecode_to_sample) .addFunction ("wait_for_process_callback", ARDOUR::LuaAPI::wait_for_process_callback)