diff --git a/libs/ardour/ardour/lua_api.h b/libs/ardour/ardour/lua_api.h index cbbe750164..bd71576e7c 100644 --- a/libs/ardour/ardour/lua_api.h +++ b/libs/ardour/ardour/lua_api.h @@ -28,6 +28,7 @@ #include "ardour/libardour_visibility.h" +#include "ardour/midi_model.h" #include "ardour/processor.h" #include "ardour/session.h" @@ -300,6 +301,9 @@ namespace ARDOUR { namespace LuaAPI { boost::shared_ptr > new_noteptr (uint8_t, Evoral::Beats, Evoral::Beats, uint8_t, uint8_t); + std::list > > + note_list (boost::shared_ptr); + } } /* namespace */ namespace ARDOUR { namespace LuaOSC { diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index c32a9e9338..8499e5c7ff 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -820,3 +820,17 @@ LuaAPI::new_noteptr (uint8_t chan, Evoral::Beats beat_time, Evoral::Beats length { return boost::shared_ptr > (new Evoral::Note(chan, beat_time, length, note, velocity)); } + +std::list > > +LuaAPI::note_list (boost::shared_ptr mm) +{ + typedef typename boost::shared_ptr > NotePtr; + + std::list note_ptr_list; + + const MidiModel::Notes& notes = mm->notes(); + for (MidiModel::Notes::const_iterator i = notes.begin(); i != notes.end(); ++i) { + note_ptr_list.push_back (*i); + } + return note_ptr_list; +} diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index d9f460461f..2993567876 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -35,6 +35,7 @@ #include "ardour/audio_track.h" #include "ardour/audioplaylist.h" #include "ardour/buffer_set.h" +#include "ardour/beats_frames_converter.h" #include "ardour/chan_mapping.h" #include "ardour/dB.h" #include "ardour/dsp_filter.h" @@ -165,6 +166,7 @@ CLASSKEYS(Selectable*); CLASSKEYS(std::list); CLASSKEYS(ARDOUR::AudioEngine); +CLASSKEYS(ARDOUR::BeatsFramesConverter); CLASSKEYS(ARDOUR::BufferSet); CLASSKEYS(ARDOUR::ChanCount); CLASSKEYS(ARDOUR::ChanMapping); @@ -1132,7 +1134,7 @@ LuaBindings::common (lua_State* L) .deriveWSPtrClass ("MidiRegion") .addFunction ("do_export", &MidiRegion::do_export) .addFunction ("midi_source", &MidiRegion::midi_source) - .addFunction ("model", (boost::shared_ptr (MidiRegion::*)())&MidiRegion::midi_source) + .addFunction ("model", (boost::shared_ptr (MidiRegion::*)())&MidiRegion::model) .addFunction ("start_beats", &MidiRegion::start_beats) .addFunction ("length_beats", &MidiRegion::length_beats) .endClass () @@ -1476,6 +1478,9 @@ LuaBindings::common (lua_State* L) .addVoidPtrConstructor > > () .endClass () + .beginStdList > > ("NotePtrList") + .endClass () + #if 0 // depends on Evoal:: Note, Beats see note_fixer.h // typedef Evoral::Note Note; // std::set< boost::weak_ptr > @@ -1504,6 +1509,12 @@ LuaBindings::common (lua_State* L) .addFunction ("frames_per_grid", &Meter::frames_per_grid) .endClass () + .beginClass ("BeatsFramesConverter") + .addConstructor () + .addFunction ("to", &BeatsFramesConverter::to) + .addFunction ("from", &BeatsFramesConverter::from) + .endClass () + .beginClass ("TempoMap") .addFunction ("add_tempo", &TempoMap::add_tempo) .addFunction ("add_meter", &TempoMap::add_meter) @@ -1514,6 +1525,8 @@ LuaBindings::common (lua_State* L) .addFunction ("bbt_at_frame", &TempoMap::bbt_at_frame) .addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_frame) .addFunction ("exact_qn_at_frame", &TempoMap::exact_qn_at_frame) + .addFunction ("framepos_plus_qn", &TempoMap::framepos_plus_qn) + .addFunction ("framewalk_to_qn", &TempoMap::framewalk_to_qn) .endClass () .beginClass ("MetricSection") @@ -1963,6 +1976,7 @@ LuaBindings::common (lua_State* L) .addFunction ("monotonic_time", ::g_get_monotonic_time) .addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename) .addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr) + .addFunction ("note_list", ARDOUR::LuaAPI::note_list) .addCFunction ("sample_to_timecode", ARDOUR::LuaAPI::sample_to_timecode) .addCFunction ("timecode_to_sample", ARDOUR::LuaAPI::timecode_to_sample)