From ac7765bcebff8e21d9948873277c34cbf60501ba Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 9 Apr 2016 15:42:32 +0200 Subject: add some more libardour lua bindings --- libs/ardour/luabindings.cc | 121 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 7 deletions(-) (limited to 'libs/ardour/luabindings.cc') diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index e2144d35b0..7e1379912f 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -19,6 +19,7 @@ #include "timecode/bbt_time.h" #include "evoral/Control.hpp" #include "evoral/ControlList.hpp" +#include "evoral/Range.hpp" #include "ardour/audioengine.h" #include "ardour/audiosource.h" @@ -29,10 +30,12 @@ #include "ardour/chan_mapping.h" #include "ardour/dB.h" #include "ardour/dsp_filter.h" +#include "ardour/interthread_info.h" #include "ardour/lua_api.h" #include "ardour/luabindings.h" #include "ardour/meter.h" #include "ardour/midi_track.h" +#include "ardour/playlist.h" #include "ardour/plugin.h" #include "ardour/plugin_insert.h" #include "ardour/runtime_functions.h" @@ -41,6 +44,7 @@ #include "ardour/session.h" #include "ardour/session_object.h" #include "ardour/sidechain.h" +#include "ardour/track.h" #include "ardour/tempo.h" #include "LuaBridge/LuaBridge.h" @@ -163,9 +167,32 @@ LuaBindings::common (lua_State* L) .addData ("toggled", &Evoral::ParameterDescriptor::toggled) .endClass () + .beginClass > ("Range") + .addConstructor () + .addData ("from", &Evoral::Range::from) + .addData ("to", &Evoral::Range::to) + .endClass () + .endNamespace () // Evoral .beginNamespace ("ARDOUR") + + .beginClass ("InterThreadInfo") + .addVoidConstructor () + .addData ("done", const_cast(&InterThreadInfo::done)) + .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel) + .addData ("progress", const_cast(&InterThreadInfo::progress)) + .endClass () + + .beginClass ("AudioRange") + .addConstructor () + .addFunction ("length", &AudioRange::length) + .addFunction ("equal", &AudioRange::equal) + .addData ("start", &AudioRange::start) + .addData ("_end", &AudioRange::end) // XXX "end" is a lua reserved word + .addData ("id", &AudioRange::id) + .endClass () + .beginWSPtrClass ("PluginInfo") .addVoidConstructor () .endClass () @@ -216,7 +243,7 @@ LuaBindings::common (lua_State* L) .addFunction ("locked", &Location::locked) .addFunction ("lock", &Location::lock) .addFunction ("start", &Location::start) - .addFunction ("end", &Location::end) + .addFunction ("_end", &Location::end) // XXX "end" is a lua reserved word .addFunction ("length", &Location::length) .addFunction ("set_start", &Location::set_start) .addFunction ("set_end", &Location::set_end) @@ -224,6 +251,14 @@ LuaBindings::common (lua_State* L) .addFunction ("move_to", &Location::move_to) .endClass () + .deriveClass ("Location") + .addFunction ("auto_loop_location", &Locations::auto_loop_location) + .addFunction ("auto_punch_location", &Locations::auto_punch_location) + .addFunction ("session_range_location", &Locations::session_range_location) + .addFunction ("first_mark_after", &Locations::first_mark_after) + .addFunction ("first_mark_after", &Locations::first_mark_after) + .endClass () + .deriveWSPtrClass ("SessionObject") .addFunction ("name", &SessionObject::name) .endClass () @@ -238,6 +273,7 @@ LuaBindings::common (lua_State* L) .endClass () .deriveWSPtrClass ("Route") + .addCast ("to_track") .addFunction ("set_name", &Route::set_name) .addFunction ("comment", &Route::comment) .addFunction ("active", &Route::active) @@ -255,15 +291,58 @@ LuaBindings::common (lua_State* L) .addFunction ("customize_plugin_insert", &Route::customize_plugin_insert) .addFunction ("add_sidechain", &Route::add_sidechain) .addFunction ("remove_sidechain", &Route::remove_sidechain) + .addFunction ("main_outs", &Route::main_outs) + .addFunction ("muted", &Route::muted) + .addFunction ("soloed", &Route::soloed) + .endClass () + + .deriveWSPtrClass ("Playlist") + .addFunction ("region_by_id", &Playlist::region_by_id) + .addFunction ("data_type", &Playlist::data_type) + .addFunction ("n_regions", &Playlist::n_regions) + //.addFunction ("get_extent", &Playlist::get_extent) // pair + //.addFunction ("region_list", &Playlist::region_list) // RegionListProperty& + .addFunction ("add_region", &Playlist::add_region) + .addFunction ("remove_region", &Playlist::remove_region) + .addFunction ("regions_at", &Playlist::regions_at) + .addFunction ("top_region_at", &Playlist::top_region_at) + .addFunction ("top_unmuted_region_at", &Playlist::top_unmuted_region_at) + .addFunction ("find_next_region", &Playlist::find_next_region) + .addFunction ("find_next_region_boundary", &Playlist::find_next_region_boundary) + .addFunction ("count_regions_at", &Playlist::count_regions_at) + .addFunction ("regions_with_start_within", &Playlist::regions_with_start_within) + .addFunction ("regions_with_end_within", &Playlist::regions_with_end_within) + .addFunction ("raise_region", &Playlist::raise_region) + .addFunction ("lower_region", &Playlist::lower_region) + .addFunction ("raise_region_to_top", &Playlist::raise_region_to_top) + .addFunction ("lower_region_to_bottom", &Playlist::lower_region_to_bottom) + .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr, framepos_t, framecnt_t, float))&Playlist::duplicate) + .addFunction ("duplicate_until", &Playlist::duplicate_until) + .addFunction ("duplicate_range", &Playlist::duplicate_range) + .addFunction ("combine", &Playlist::combine) + .addFunction ("uncombine", &Playlist::uncombine) + .addFunction ("split_region", &Playlist::split_region) + .addFunction ("split", (void (Playlist::*)(framepos_t))&Playlist::split) + .addFunction ("cut", (boost::shared_ptr (Playlist::*)(std::list&, bool))&Playlist::cut) +#if 0 + .addFunction ("copy", &Playlist::copy) + .addFunction ("paste", &Playlist::paste) +#endif .endClass () .deriveWSPtrClass ("Track") + .addCast ("to_audio_track") + .addCast ("to_midi_track") .addFunction ("set_name", &Track::set_name) .addFunction ("can_record", &Track::can_record) .addFunction ("record_enabled", &Track::record_enabled) .addFunction ("record_safe", &Track::record_safe) .addFunction ("set_record_enabled", &Track::set_record_enabled) .addFunction ("set_record_safe", &Track::set_record_safe) + .addFunction ("bounceable", &Track::bounceable) + .addFunction ("bounce", &Track::bounce_range) + .addFunction ("bounce_range", &Track::bounce_range) + .addFunction ("playlist", &Track::playlist) .endClass () .deriveWSPtrClass ("AudioTrack") @@ -373,6 +452,9 @@ LuaBindings::common (lua_State* L) .deriveWSPtrClass ("SideChain") .endClass () + .deriveWSPtrClass ("Delivery") + .endClass () + .deriveWSPtrClass ("Plugin") .addFunction ("label", &Plugin::label) .addFunction ("name", &Plugin::name) @@ -418,30 +500,45 @@ LuaBindings::common (lua_State* L) .addFunction ("n_channels", &AudioSource::n_channels) .endClass () - // > + // > .beginStdList > ("AudioTrackList") .endClass () - // std::list > + // std::list > .beginStdList > ("MidiTrackList") .endClass () - // RouteList == std::list > + // RouteList == std::list > .beginConstStdList > ("RouteList") .endClass () - // boost::shared_ptr + // boost::shared_ptr .beginPtrStdList > ("RouteListPtr") .endClass () - // typedef std::list > WeakRouteList + // typedef std::list > WeakRouteList .beginConstStdList > ("WeakRouteList") .endClass () - // std::list< boost::weak_ptr + // std::list< boost::weak_ptr > .beginConstStdList > ("WeakAudioSourceList") .endClass () + // typedef std::list > RegionList + .beginConstStdList > ("RegionList") + .endClass () + + // boost::shared_ptr > > + .beginPtrStdList > ("RegionListPtr") + .endClass () + + // used by Playlist::cut/copy + .beginConstStdList ("AudioRangeList") + .endClass () + + .beginConstStdList ("LocationList") + .endClass () + #if 0 // depends on Evoal:: Note, Beats see note_fixer.h // typedef Evoral::Note Note; // std::set< boost::weak_ptr > @@ -492,6 +589,8 @@ LuaBindings::common (lua_State* L) .addStaticCFunction ("null", &LuaAPI::datatype_ctor_null) // "nil" is a lua reseved word .addStaticCFunction ("audio", &LuaAPI::datatype_ctor_audio) .addStaticCFunction ("midi", &LuaAPI::datatype_ctor_midi) + .addFunction ("to_string", &DataType::to_string) + // TODO add uint32_t cast, add operator== != .endClass() /* libardour enums */ @@ -528,6 +627,12 @@ LuaBindings::common (lua_State* L) .addConst ("CopyPlaylist", ARDOUR::PlaylistDisposition(CopyPlaylist)) .addConst ("NewPlaylist", ARDOUR::PlaylistDisposition(NewPlaylist)) .addConst ("SharePlaylist", ARDOUR::PlaylistDisposition(SharePlaylist)) + .endNamespace () + + .beginNamespace ("RegionPoint") + .addConst ("Start", ARDOUR::RegionPoint(Start)) + .addConst ("End", ARDOUR::RegionPoint(End)) + .addConst ("SyncPoint", ARDOUR::RegionPoint(SyncPoint)) .endNamespace (); luabridge::getGlobalNamespace (L) @@ -625,6 +730,7 @@ LuaBindings::common (lua_State* L) .addFunction ("processor_by_id", &Session::processor_by_id) .addFunction ("snap_name", &Session::snap_name) .addFunction ("tempo_map", (TempoMap& (Session::*)())&Session::tempo_map) + .addFunction ("locations", &Session::locations) .endClass () .beginClass ("RegionFactory") @@ -643,6 +749,7 @@ LuaBindings::common (lua_State* L) .endNamespace () // END Session enums .beginNamespace ("LuaAPI") + .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor) .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc) .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info) .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin) -- cgit v1.2.3