Add Lua bindings to query MIDI SysEx and PatchChanges
This commit is contained in:
parent
3b5a6e1f15
commit
75d2b46ded
@ -429,6 +429,13 @@ namespace ARDOUR { namespace LuaAPI {
|
||||
std::list<std::shared_ptr< Evoral::Note<Temporal::Beats> > >
|
||||
note_list (std::shared_ptr<ARDOUR::MidiModel>);
|
||||
|
||||
std::list<std::shared_ptr< Evoral::Event<Temporal::Beats> > >
|
||||
sysex_list (std::shared_ptr<ARDOUR::MidiModel>);
|
||||
|
||||
std::list<std::shared_ptr< Evoral::PatchChange<Temporal::Beats> > >
|
||||
patch_change_list (std::shared_ptr<ARDOUR::MidiModel>);
|
||||
|
||||
|
||||
} } /* namespace */
|
||||
|
||||
namespace ARDOUR { namespace LuaOSC {
|
||||
|
@ -1158,6 +1158,32 @@ LuaAPI::note_list (std::shared_ptr<MidiModel> mm)
|
||||
return note_ptr_list;
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<Evoral::Event<Temporal::Beats> > >
|
||||
LuaAPI::sysex_list (std::shared_ptr<MidiModel> mm)
|
||||
{
|
||||
typedef std::shared_ptr<Evoral::Event<Temporal::Beats> > SysExPtr;
|
||||
|
||||
std::list<SysExPtr> event_ptr_list;
|
||||
|
||||
for (auto const& i : mm->sysexes ()) {
|
||||
event_ptr_list.push_back (i);
|
||||
}
|
||||
return event_ptr_list;
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<Evoral::PatchChange<Temporal::Beats> > >
|
||||
LuaAPI::patch_change_list (std::shared_ptr<MidiModel> mm)
|
||||
{
|
||||
typedef std::shared_ptr<Evoral::PatchChange<Temporal::Beats> > PatchChangePtr;
|
||||
|
||||
std::list<PatchChangePtr> 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;
|
||||
|
@ -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<ARDOUR::Region>);
|
||||
CLASSKEYS(std::shared_ptr<ARDOUR::SessionPlaylists>);
|
||||
CLASSKEYS(std::shared_ptr<ARDOUR::Track>);
|
||||
CLASSKEYS(std::shared_ptr<Evoral::ControlList>);
|
||||
CLASSKEYS(std::shared_ptr<Evoral::Event<Temporal::Beats> >);
|
||||
CLASSKEYS(std::shared_ptr<Evoral::Note<Temporal::Beats> >);
|
||||
CLASSKEYS(std::shared_ptr<Evoral::PatchChange<Temporal::Beats> >);
|
||||
CLASSKEYS(std::shared_ptr<Evoral::Sequence<Temporal::Beats> >);
|
||||
|
||||
CLASSKEYS(std::shared_ptr<ARDOUR::Playlist>);
|
||||
@ -972,6 +976,18 @@ LuaBindings::common (lua_State* L)
|
||||
.addFunction ("channel", &Evoral::Note<Temporal::Beats>::channel)
|
||||
.endClass ()
|
||||
|
||||
.beginWSPtrClass <Evoral::Event<Temporal::Beats> > ("EventPtr")
|
||||
.addFunction ("time", &Evoral::Event<Temporal::Beats>::time)
|
||||
.addFunction ("size", &Evoral::Event<Temporal::Beats>::size)
|
||||
//.addFunction ("buffer", (uint8_t*) &Evoral::Event<Temporal::Beats>::buffer)
|
||||
.endClass ()
|
||||
|
||||
.beginWSPtrClass <Evoral::PatchChange<Temporal::Beats> > ("PatchChangePtr")
|
||||
.addFunction ("time", &Evoral::PatchChange<Temporal::Beats>::time)
|
||||
.addFunction ("bank", &Evoral::PatchChange<Temporal::Beats>::bank)
|
||||
.addFunction ("program", &Evoral::PatchChange<Temporal::Beats>::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<ARDOUR::MidiModel::SysExDiffCommand, ARDOUR::MidiModel::DiffCommand> ("NoteDiffCommand")
|
||||
.addFunction ("change", &ARDOUR::MidiModel::SysExDiffCommand::change)
|
||||
.addFunction ("remove", &ARDOUR::MidiModel::SysExDiffCommand::remove)
|
||||
.endClass ()
|
||||
|
||||
.deriveClass<ARDOUR::MidiModel::PatchChangeDiffCommand, ARDOUR::MidiModel::DiffCommand> ("NoteDiffCommand")
|
||||
.addFunction ("add", &ARDOUR::MidiModel::PatchChangeDiffCommand::add)
|
||||
.addFunction ("remove", &ARDOUR::MidiModel::PatchChangeDiffCommand::remove)
|
||||
.endClass ()
|
||||
|
||||
.endNamespace () /* ARDOUR::MidiModel */
|
||||
|
||||
.beginClass <Plugin::PresetRecord> ("PresetRecord")
|
||||
@ -2344,6 +2372,12 @@ LuaBindings::common (lua_State* L)
|
||||
.beginStdList <std::shared_ptr<Evoral::Note<Temporal::Beats> > > ("NotePtrList")
|
||||
.endClass ()
|
||||
|
||||
.beginStdList <std::shared_ptr<Evoral::Event<Temporal::Beats> > > ("EventPtrList")
|
||||
.endClass ()
|
||||
|
||||
.beginStdList <std::shared_ptr<Evoral::PatchChange<Temporal::Beats> > > ("PatchChangePtrList")
|
||||
.endClass ()
|
||||
|
||||
.beginConstStdCPtrList <Evoral::ControlEvent> ("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)
|
||||
|
Loading…
Reference in New Issue
Block a user