mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 21:56:30 +01:00
Lua bindings to access MIDI region/source note-events
This commit is contained in:
parent
940707e327
commit
6ceade76b3
3 changed files with 33 additions and 1 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "ardour/libardour_visibility.h"
|
#include "ardour/libardour_visibility.h"
|
||||||
|
|
||||||
|
#include "ardour/midi_model.h"
|
||||||
#include "ardour/processor.h"
|
#include "ardour/processor.h"
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
|
|
||||||
|
|
@ -300,6 +301,9 @@ namespace ARDOUR { namespace LuaAPI {
|
||||||
boost::shared_ptr<Evoral::Note<Evoral::Beats> >
|
boost::shared_ptr<Evoral::Note<Evoral::Beats> >
|
||||||
new_noteptr (uint8_t, Evoral::Beats, Evoral::Beats, uint8_t, uint8_t);
|
new_noteptr (uint8_t, Evoral::Beats, Evoral::Beats, uint8_t, uint8_t);
|
||||||
|
|
||||||
|
std::list<boost::shared_ptr< Evoral::Note<Evoral::Beats> > >
|
||||||
|
note_list (boost::shared_ptr<ARDOUR::MidiModel>);
|
||||||
|
|
||||||
} } /* namespace */
|
} } /* namespace */
|
||||||
|
|
||||||
namespace ARDOUR { namespace LuaOSC {
|
namespace ARDOUR { namespace LuaOSC {
|
||||||
|
|
|
||||||
|
|
@ -820,3 +820,17 @@ LuaAPI::new_noteptr (uint8_t chan, Evoral::Beats beat_time, Evoral::Beats length
|
||||||
{
|
{
|
||||||
return boost::shared_ptr<Evoral::Note<Evoral::Beats> > (new Evoral::Note<Evoral::Beats>(chan, beat_time, length, note, velocity));
|
return boost::shared_ptr<Evoral::Note<Evoral::Beats> > (new Evoral::Note<Evoral::Beats>(chan, beat_time, length, note, velocity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<boost::shared_ptr<Evoral::Note<Evoral::Beats> > >
|
||||||
|
LuaAPI::note_list (boost::shared_ptr<MidiModel> mm)
|
||||||
|
{
|
||||||
|
typedef typename boost::shared_ptr<Evoral::Note<Evoral::Beats> > NotePtr;
|
||||||
|
|
||||||
|
std::list<NotePtr> 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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "ardour/audio_track.h"
|
#include "ardour/audio_track.h"
|
||||||
#include "ardour/audioplaylist.h"
|
#include "ardour/audioplaylist.h"
|
||||||
#include "ardour/buffer_set.h"
|
#include "ardour/buffer_set.h"
|
||||||
|
#include "ardour/beats_frames_converter.h"
|
||||||
#include "ardour/chan_mapping.h"
|
#include "ardour/chan_mapping.h"
|
||||||
#include "ardour/dB.h"
|
#include "ardour/dB.h"
|
||||||
#include "ardour/dsp_filter.h"
|
#include "ardour/dsp_filter.h"
|
||||||
|
|
@ -165,6 +166,7 @@ CLASSKEYS(Selectable*);
|
||||||
CLASSKEYS(std::list<Selectable*>);
|
CLASSKEYS(std::list<Selectable*>);
|
||||||
|
|
||||||
CLASSKEYS(ARDOUR::AudioEngine);
|
CLASSKEYS(ARDOUR::AudioEngine);
|
||||||
|
CLASSKEYS(ARDOUR::BeatsFramesConverter);
|
||||||
CLASSKEYS(ARDOUR::BufferSet);
|
CLASSKEYS(ARDOUR::BufferSet);
|
||||||
CLASSKEYS(ARDOUR::ChanCount);
|
CLASSKEYS(ARDOUR::ChanCount);
|
||||||
CLASSKEYS(ARDOUR::ChanMapping);
|
CLASSKEYS(ARDOUR::ChanMapping);
|
||||||
|
|
@ -1132,7 +1134,7 @@ LuaBindings::common (lua_State* L)
|
||||||
.deriveWSPtrClass <MidiRegion, Region> ("MidiRegion")
|
.deriveWSPtrClass <MidiRegion, Region> ("MidiRegion")
|
||||||
.addFunction ("do_export", &MidiRegion::do_export)
|
.addFunction ("do_export", &MidiRegion::do_export)
|
||||||
.addFunction ("midi_source", &MidiRegion::midi_source)
|
.addFunction ("midi_source", &MidiRegion::midi_source)
|
||||||
.addFunction ("model", (boost::shared_ptr<MidiModel> (MidiRegion::*)())&MidiRegion::midi_source)
|
.addFunction ("model", (boost::shared_ptr<MidiModel> (MidiRegion::*)())&MidiRegion::model)
|
||||||
.addFunction ("start_beats", &MidiRegion::start_beats)
|
.addFunction ("start_beats", &MidiRegion::start_beats)
|
||||||
.addFunction ("length_beats", &MidiRegion::length_beats)
|
.addFunction ("length_beats", &MidiRegion::length_beats)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
@ -1476,6 +1478,9 @@ LuaBindings::common (lua_State* L)
|
||||||
.addVoidPtrConstructor<std::list<boost::shared_ptr <AutomationControl> > > ()
|
.addVoidPtrConstructor<std::list<boost::shared_ptr <AutomationControl> > > ()
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
|
.beginStdList <boost::shared_ptr<Evoral::Note<Evoral::Beats> > > ("NotePtrList")
|
||||||
|
.endClass ()
|
||||||
|
|
||||||
#if 0 // depends on Evoal:: Note, Beats see note_fixer.h
|
#if 0 // depends on Evoal:: Note, Beats see note_fixer.h
|
||||||
// typedef Evoral::Note<Evoral::Beats> Note;
|
// typedef Evoral::Note<Evoral::Beats> Note;
|
||||||
// std::set< boost::weak_ptr<Note> >
|
// std::set< boost::weak_ptr<Note> >
|
||||||
|
|
@ -1504,6 +1509,12 @@ LuaBindings::common (lua_State* L)
|
||||||
.addFunction ("frames_per_grid", &Meter::frames_per_grid)
|
.addFunction ("frames_per_grid", &Meter::frames_per_grid)
|
||||||
.endClass ()
|
.endClass ()
|
||||||
|
|
||||||
|
.beginClass <BeatsFramesConverter> ("BeatsFramesConverter")
|
||||||
|
.addConstructor <void (*) (const TempoMap&, framepos_t)> ()
|
||||||
|
.addFunction ("to", &BeatsFramesConverter::to)
|
||||||
|
.addFunction ("from", &BeatsFramesConverter::from)
|
||||||
|
.endClass ()
|
||||||
|
|
||||||
.beginClass <TempoMap> ("TempoMap")
|
.beginClass <TempoMap> ("TempoMap")
|
||||||
.addFunction ("add_tempo", &TempoMap::add_tempo)
|
.addFunction ("add_tempo", &TempoMap::add_tempo)
|
||||||
.addFunction ("add_meter", &TempoMap::add_meter)
|
.addFunction ("add_meter", &TempoMap::add_meter)
|
||||||
|
|
@ -1514,6 +1525,8 @@ LuaBindings::common (lua_State* L)
|
||||||
.addFunction ("bbt_at_frame", &TempoMap::bbt_at_frame)
|
.addFunction ("bbt_at_frame", &TempoMap::bbt_at_frame)
|
||||||
.addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_frame)
|
.addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_frame)
|
||||||
.addFunction ("exact_qn_at_frame", &TempoMap::exact_qn_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 ()
|
.endClass ()
|
||||||
|
|
||||||
.beginClass <MetricSection> ("MetricSection")
|
.beginClass <MetricSection> ("MetricSection")
|
||||||
|
|
@ -1963,6 +1976,7 @@ LuaBindings::common (lua_State* L)
|
||||||
.addFunction ("monotonic_time", ::g_get_monotonic_time)
|
.addFunction ("monotonic_time", ::g_get_monotonic_time)
|
||||||
.addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
|
.addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
|
||||||
.addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr)
|
.addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr)
|
||||||
|
.addFunction ("note_list", ARDOUR::LuaAPI::note_list)
|
||||||
.addCFunction ("sample_to_timecode", ARDOUR::LuaAPI::sample_to_timecode)
|
.addCFunction ("sample_to_timecode", ARDOUR::LuaAPI::sample_to_timecode)
|
||||||
.addCFunction ("timecode_to_sample", ARDOUR::LuaAPI::timecode_to_sample)
|
.addCFunction ("timecode_to_sample", ARDOUR::LuaAPI::timecode_to_sample)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue