Add Lua bindings for basic MIDI model editing
This commit is contained in:
parent
392972fb50
commit
0cf75054a6
|
@ -24,6 +24,8 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <vamp-hostsdk/Plugin.h>
|
||||
|
||||
#include "evoral/Note.hpp"
|
||||
|
||||
#include "ardour/libardour_visibility.h"
|
||||
|
||||
#include "ardour/processor.h"
|
||||
|
@ -241,6 +243,9 @@ namespace ARDOUR { namespace LuaAPI {
|
|||
|
||||
};
|
||||
|
||||
boost::shared_ptr<Evoral::Note<Evoral::Beats> >
|
||||
new_noteptr (uint8_t, Evoral::Beats, Evoral::Beats, uint8_t, uint8_t);
|
||||
|
||||
} } /* namespace */
|
||||
|
||||
namespace ARDOUR { namespace LuaOSC {
|
||||
|
|
|
@ -255,6 +255,7 @@ public:
|
|||
MidiModel::SysExDiffCommand* new_sysex_diff_command (const std::string name = "midi edit");
|
||||
MidiModel::PatchChangeDiffCommand* new_patch_change_diff_command (const std::string name = "midi edit");
|
||||
void apply_command (Session& session, Command* cmd);
|
||||
void apply_command (Session* session, Command* cmd) { if (session) { apply_command (*session, cmd); } }
|
||||
void apply_command_as_subcommand (Session& session, Command* cmd);
|
||||
|
||||
bool sync_to_source (const Glib::Threads::Mutex::Lock& source_lock);
|
||||
|
|
|
@ -646,3 +646,9 @@ LuaAPI::Vamp::process (const std::vector<float*>& d, ::Vamp::RealTime rt)
|
|||
const float* const* bufs = &d[0];
|
||||
return _plugin->process (bufs, rt);
|
||||
}
|
||||
|
||||
boost::shared_ptr<Evoral::Note<Evoral::Beats> >
|
||||
LuaAPI::new_noteptr (uint8_t chan, Evoral::Beats beat_time, Evoral::Beats length, uint8_t note, uint8_t velocity)
|
||||
{
|
||||
return boost::shared_ptr<Evoral::Note<Evoral::Beats> > (new Evoral::Note<Evoral::Beats>(chan, beat_time, length, note, velocity));
|
||||
}
|
||||
|
|
|
@ -43,8 +43,12 @@
|
|||
#include "ardour/luabindings.h"
|
||||
#include "ardour/luaproc.h"
|
||||
#include "ardour/meter.h"
|
||||
#include "ardour/midi_model.h"
|
||||
#include "ardour/midi_track.h"
|
||||
#include "ardour/midi_playlist.h"
|
||||
#include "ardour/midi_port.h"
|
||||
#include "ardour/midi_region.h"
|
||||
#include "ardour/midi_source.h"
|
||||
#include "ardour/phase_control.h"
|
||||
#include "ardour/playlist.h"
|
||||
#include "ardour/plugin.h"
|
||||
|
@ -159,6 +163,7 @@ CLASSKEYS(ARDOUR::LuaAPI::Vamp);
|
|||
CLASSKEYS(ARDOUR::LuaOSC::Address);
|
||||
CLASSKEYS(ARDOUR::LuaProc);
|
||||
CLASSKEYS(ARDOUR::LuaTableRef);
|
||||
CLASSKEYS(ARDOUR::MidiModel::NoteDiffCommand);
|
||||
CLASSKEYS(ARDOUR::MonitorProcessor);
|
||||
CLASSKEYS(ARDOUR::RouteGroup);
|
||||
CLASSKEYS(ARDOUR::ParameterDescriptor);
|
||||
|
@ -176,6 +181,8 @@ CLASSKEYS(PBD::Configuration);
|
|||
CLASSKEYS(PBD::PropertyChange);
|
||||
|
||||
CLASSKEYS(Evoral::Beats);
|
||||
CLASSKEYS(Evoral::Event<framepos_t>);
|
||||
|
||||
|
||||
CLASSKEYS(std::vector<std::string>);
|
||||
CLASSKEYS(std::vector<float>);
|
||||
|
@ -191,11 +198,19 @@ CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Port> >);
|
|||
CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Region> >);
|
||||
CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
|
||||
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::Automatable>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::AutomatableSequence<Evoral::Beats>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::AutomationList>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::MidiModel>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::MidiPlaylist>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::MidiRegion>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::MidiSource>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::Processor>);
|
||||
CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
|
||||
CLASSKEYS(boost::shared_ptr<Evoral::ControlList>);
|
||||
CLASSKEYS(boost::shared_ptr<Evoral::Note<Evoral::Beats> >);
|
||||
CLASSKEYS(boost::shared_ptr<Evoral::Sequence<Evoral::Beats> >);
|
||||
|
||||
CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
|
||||
|
||||
|
@ -415,6 +430,19 @@ LuaBindings::common (lua_State* L)
|
|||
luabridge::getGlobalNamespace (L)
|
||||
|
||||
.beginNamespace ("Evoral")
|
||||
.beginClass <Evoral::Event<framepos_t> > ("Event")
|
||||
.addFunction ("clear", &Evoral::Event<framepos_t>::clear)
|
||||
.addFunction ("size", &Evoral::Event<framepos_t>::size)
|
||||
.addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
|
||||
.addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
|
||||
.addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
|
||||
.endClass ()
|
||||
|
||||
.beginClass <Evoral::Beats> ("Beats")
|
||||
.addConstructor <void (*) (double)> ()
|
||||
.addFunction ("to_double", &Evoral::Beats::to_double)
|
||||
.endClass ()
|
||||
|
||||
.beginClass <Evoral::Parameter> ("Parameter")
|
||||
.addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
|
||||
.addFunction ("type", &Evoral::Parameter::type)
|
||||
|
@ -456,6 +484,18 @@ LuaBindings::common (lua_State* L)
|
|||
.addData ("to", &Evoral::Range<framepos_t>::to)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <Evoral::Sequence<Evoral::Beats>, Evoral::ControlSet> ("Sequence")
|
||||
.endClass ()
|
||||
|
||||
.beginWSPtrClass <Evoral::Note<Evoral::Beats> > ("NotePtr")
|
||||
.addFunction ("time", &Evoral::Note<Evoral::Beats>::time)
|
||||
.addFunction ("note", &Evoral::Note<Evoral::Beats>::note)
|
||||
.addFunction ("velocity", &Evoral::Note<Evoral::Beats>::velocity)
|
||||
.addFunction ("off_velocity", &Evoral::Note<Evoral::Beats>::off_velocity)
|
||||
.addFunction ("length", &Evoral::Note<Evoral::Beats>::length)
|
||||
.addFunction ("channel", &Evoral::Note<Evoral::Beats>::channel)
|
||||
.endClass ()
|
||||
|
||||
/* libevoral enums */
|
||||
.beginNamespace ("InterpolationStyle")
|
||||
.addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete))
|
||||
|
@ -856,6 +896,7 @@ LuaBindings::common (lua_State* L)
|
|||
|
||||
.deriveWSPtrClass <Playlist, SessionObject> ("Playlist")
|
||||
.addCast<AudioPlaylist> ("to_audioplaylist")
|
||||
.addCast<MidiPlaylist> ("to_midiplaylist")
|
||||
.addFunction ("region_by_id", &Playlist::region_by_id)
|
||||
.addFunction ("data_type", &Playlist::data_type)
|
||||
.addFunction ("n_regions", &Playlist::n_regions)
|
||||
|
@ -894,6 +935,10 @@ LuaBindings::common (lua_State* L)
|
|||
.addFunction ("read", &AudioPlaylist::read)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <MidiPlaylist, Playlist> ("MidiPlaylist")
|
||||
.addFunction ("set_note_mode", &MidiPlaylist::set_note_mode)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <Track, Route> ("Track")
|
||||
.addCast<AudioTrack> ("to_audio_track")
|
||||
.addCast<MidiTrack> ("to_midi_track")
|
||||
|
@ -919,6 +964,7 @@ LuaBindings::common (lua_State* L)
|
|||
|
||||
.deriveWSPtrClass <Region, SessionObject> ("Region")
|
||||
.addCast<Readable> ("to_readable")
|
||||
.addCast<MidiRegion> ("to_midiregion")
|
||||
/* properties */
|
||||
.addFunction ("position", &Region::position)
|
||||
.addFunction ("start", &Region::start)
|
||||
|
@ -972,9 +1018,45 @@ LuaBindings::common (lua_State* L)
|
|||
.addFunction ("set_position_locked", &Region::set_position_locked)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <MidiRegion, Region> ("MidiRegion")
|
||||
.addFunction ("do_export", &MidiRegion::do_export)
|
||||
.addFunction ("midi_source", &MidiRegion::midi_source)
|
||||
.addFunction ("model", (boost::shared_ptr<MidiModel> (MidiRegion::*)())&MidiRegion::midi_source)
|
||||
.endClass ()
|
||||
|
||||
.beginWSPtrClass <Source> ("Source")
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <MidiSource, Source> ("MidiSource")
|
||||
.addFunction ("empty", &MidiSource::empty)
|
||||
.addFunction ("length", &MidiSource::length)
|
||||
.addFunction ("model", &MidiSource::model)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
|
||||
.addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <AutomatableSequence<Evoral::Beats>, Automatable> ("AutomatableSequence")
|
||||
.addCast<Evoral::Sequence<Evoral::Beats> > ("to_sequence")
|
||||
.endClass ()
|
||||
|
||||
.deriveWSPtrClass <MidiModel, AutomatableSequence<Evoral::Beats> > ("MidiModel")
|
||||
.addFunction ("apply_command", (void (MidiModel::*)(Session*, Command*))&MidiModel::apply_command)
|
||||
.addFunction ("new_note_diff_command", &ARDOUR::MidiModel::MidiModel::new_note_diff_command)
|
||||
.endClass ()
|
||||
|
||||
.beginNamespace ("MidiModel")
|
||||
.deriveClass<ARDOUR::MidiModel::DiffCommand, Command> ("DiffCommand")
|
||||
.endClass ()
|
||||
|
||||
.deriveClass<ARDOUR::MidiModel::NoteDiffCommand, ARDOUR::MidiModel::DiffCommand> ("NoteDiffCommand")
|
||||
.addFunction ("add", &ARDOUR::MidiModel::NoteDiffCommand::add)
|
||||
.addFunction ("remove", &ARDOUR::MidiModel::NoteDiffCommand::remove)
|
||||
.endClass ()
|
||||
|
||||
.endNamespace () /* ARDOUR::MidiModel */
|
||||
|
||||
.beginClass <Plugin::PresetRecord> ("PresetRecord")
|
||||
.addVoidConstructor ()
|
||||
.addData ("uri", &Plugin::PresetRecord::uri, false)
|
||||
|
@ -985,10 +1067,6 @@ LuaBindings::common (lua_State* L)
|
|||
|
||||
.beginStdVector <Plugin::PresetRecord> ("PresetVector").endClass ()
|
||||
|
||||
.deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
|
||||
.addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
|
||||
.endClass ()
|
||||
|
||||
.deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
|
||||
.addVoidConstructor ()
|
||||
.addData ("label", &ParameterDescriptor::label)
|
||||
|
@ -1354,6 +1432,11 @@ LuaBindings::common (lua_State* L)
|
|||
.addConst ("MeterCustom", ARDOUR::MeterPoint(MeterCustom))
|
||||
.endNamespace ()
|
||||
|
||||
.beginNamespace ("NoteMode")
|
||||
.addConst ("Sustained", ARDOUR::NoteMode(Sustained))
|
||||
.addConst ("Percussive", ARDOUR::NoteMode(Percussive))
|
||||
.endNamespace ()
|
||||
|
||||
.beginNamespace ("PortFlags")
|
||||
.addConst ("IsInput", ARDOUR::PortFlags(IsInput))
|
||||
.addConst ("IsOutput", ARDOUR::PortFlags(IsOutput))
|
||||
|
@ -1627,6 +1710,7 @@ LuaBindings::common (lua_State* L)
|
|||
.addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
|
||||
.addFunction ("usleep", Glib::usleep)
|
||||
.addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
|
||||
.addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr)
|
||||
|
||||
.beginClass <ARDOUR::LuaAPI::Vamp> ("Vamp")
|
||||
.addConstructor <void (*) (const std::string&, float)> ()
|
||||
|
@ -1680,18 +1764,6 @@ LuaBindings::dsp (lua_State* L)
|
|||
|
||||
luabridge::getGlobalNamespace (L)
|
||||
.beginNamespace ("Evoral")
|
||||
.beginClass <Evoral::Event<framepos_t> > ("Event")
|
||||
.addFunction ("clear", &Evoral::Event<framepos_t>::clear)
|
||||
.addFunction ("size", &Evoral::Event<framepos_t>::size)
|
||||
.addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
|
||||
.addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
|
||||
.addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
|
||||
.endClass ()
|
||||
|
||||
.beginClass <Evoral::Beats> ("Beats")
|
||||
.addFunction ("to_double", &Evoral::Beats::to_double)
|
||||
.endClass ()
|
||||
|
||||
.deriveClass <Evoral::MIDIEvent<framepos_t>, Evoral::Event<framepos_t> > ("MidiEvent")
|
||||
// add Ctor?
|
||||
.addFunction ("type", &Evoral::MIDIEvent<framepos_t>::type)
|
||||
|
|
Loading…
Reference in New Issue
Block a user