X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fluabindings.cc;h=765402efac93285c1638455c99ef170172472865;hb=e0ff70cf86c01c42f98faf8b0eaf1a8ccf867946;hp=55c445e8340d5add7f07aa4cae578855971490a5;hpb=f80c0faa24c9e22d8c122b86a11592e7151a8e7f;p=ardour.git diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 55c445e834..765402efac 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -45,9 +45,11 @@ #include "ardour/playlist.h" #include "ardour/plugin.h" #include "ardour/plugin_insert.h" +#include "ardour/port_manager.h" #include "ardour/runtime_functions.h" #include "ardour/region.h" #include "ardour/region_factory.h" +#include "ardour/route_group.h" #include "ardour/session.h" #include "ardour/session_object.h" #include "ardour/sidechain.h" @@ -162,12 +164,15 @@ CLASSKEYS(ARDOUR::PluginInfo); CLASSKEYS(PBD::PropertyChange); CLASSKEYS(std::vector); CLASSKEYS(std::list >); +CLASSKEYS(std::list >); CLASSKEYS(boost::shared_ptr); CLASSKEYS(boost::shared_ptr); CLASSKEYS(boost::weak_ptr); CLASSKEYS(std::list >); CLASSKEYS(std::list); CLASSKEYS(Evoral::Beats); +CLASSKEYS(ARDOUR::PortEngine); +CLASSKEYS(ARDOUR::PortManager); CLASSKEYS(ARDOUR::AudioEngine); CLASSKEYS(void); CLASSKEYS(float); @@ -235,11 +240,13 @@ LuaBindings::common (lua_State* L) .endClass () .beginClass ("Stateful") + .addFunction ("id", &PBD::Stateful::id) .addFunction ("properties", &PBD::Stateful::properties) .addFunction ("clear_changes", &PBD::Stateful::clear_changes) .endClass () .beginWSPtrClass ("StatefulPtr") + .addFunction ("id", &PBD::Stateful::id) .addFunction ("properties", &PBD::Stateful::properties) .addFunction ("clear_changes", &PBD::Stateful::clear_changes) .endClass () @@ -274,6 +281,7 @@ LuaBindings::common (lua_State* L) .addFunction ("get_value", &PBD::Controllable::get_value) .endClass () + /* PBD enums */ .beginNamespace ("GroupControlDisposition") .addConst ("InverseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::InverseGroup)) .addConst ("NoGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::NoGroup)) @@ -376,7 +384,7 @@ LuaBindings::common (lua_State* L) .addVoidConstructor () .addFunction ("get", static_cast(&ChanMapping::get)) .addFunction ("set", &ChanMapping::set) - .addConst ("Invalid", 4294967295) // UINT32_MAX + .addConst ("Invalid", 4294967295U) // UINT32_MAX .endClass () .beginNamespace ("Properties") @@ -436,7 +444,10 @@ LuaBindings::common (lua_State* L) .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) + .addFunction ("first_mark_before", &Locations::first_mark_before) + .addFunction ("first_mark_at", &Locations::mark_at) + .addRefFunction ("marks_either_side", &Locations::marks_either_side) + .addRefFunction ("find_all_between", &Locations::find_all_between) .endClass () .beginWSPtrClass ("SessionObject") @@ -449,6 +460,8 @@ LuaBindings::common (lua_State* L) .endClass () .beginWSPtrClass ("Port") + .addCast ("to_midiport") + .addCast ("to_audioport") .addFunction ("name", &Port::name) .addFunction ("pretty_name", &Port::pretty_name) .addFunction ("receives_input", &Port::receives_input) @@ -461,6 +474,7 @@ LuaBindings::common (lua_State* L) .addFunction ("connected_to", (bool (Port::*)(Port*)const)&Port::connected_to) .addFunction ("connect", (int (Port::*)(Port*))&Port::connect) .addFunction ("disconnect", (int (Port::*)(Port*))&Port::disconnect) + //.addStaticFunction ("port_offset", &Port::port_offset) // static .endClass () .deriveWSPtrClass ("AudioPort") @@ -469,6 +483,7 @@ LuaBindings::common (lua_State* L) .deriveWSPtrClass ("MidiPort") .addFunction ("input_active", &MidiPort::input_active) .addFunction ("set_input_active", &MidiPort::set_input_active) + .addFunction ("get_midi_buffer", &MidiPort::get_midi_buffer) // DSP only .endClass () .beginWSPtrClass ("PortSet") @@ -496,9 +511,6 @@ LuaBindings::common (lua_State* L) .addFunction ("n_ports", &IO::n_ports) .endClass () - .deriveWSPtrClass ("RouteGroupPtr") - .endClass () - .beginClass ("RouteGroup") // stub RouteGroup* is needed for new_audio_track() .endClass () @@ -510,6 +522,8 @@ LuaBindings::common (lua_State* L) .addFunction ("active", &Route::active) .addFunction ("set_active", &Route::set_active) .addFunction ("nth_plugin", &Route::nth_plugin) + .addFunction ("nth_processor", &Route::nth_processor) + .addFunction ("nth_send", &Route::nth_send) .addFunction ("add_processor_by_index", &Route::add_processor_by_index) .addFunction ("remove_processor", &Route::remove_processor) .addFunction ("replace_processor", &Route::replace_processor) @@ -569,10 +583,10 @@ LuaBindings::common (lua_State* L) .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 ("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) .addFunction ("bounce_range", &Track::bounce_range) @@ -602,7 +616,6 @@ LuaBindings::common (lua_State* L) .addFunction ("locked", &Region::locked) .addFunction ("position_locked", &Region::position_locked) .addFunction ("video_locked", &Region::video_locked) - .addFunction ("valid_transients", &Region::valid_transients) .addFunction ("automatic", &Region::automatic) .addFunction ("whole_file", &Region::whole_file) .addFunction ("captured", &Region::captured) @@ -644,6 +657,7 @@ LuaBindings::common (lua_State* L) .endClass () .beginClass ("PresetRecord") + .addVoidConstructor () .addData ("uri", &Plugin::PresetRecord::uri, false) .addData ("label", &Plugin::PresetRecord::label, false) .addData ("user", &Plugin::PresetRecord::user, false) @@ -665,6 +679,14 @@ LuaBindings::common (lua_State* L) .addCast ("to_insert") .addCast ("to_sidechain") .addCast ("to_ioprocessor") + .addCast ("to_unknownprocessor") + .addCast ("to_amp") +#if 0 // those objects are not yet bound + .addCast ("to_monitorprocessor") + .addCast ("to_capturingprocessor") + .addCast ("to_delayline") + .addCast ("to_meter") +#endif .addFunction ("display_name", &Processor::display_name) .addFunction ("active", &Processor::active) .addFunction ("activate", &Processor::activate) @@ -734,6 +756,9 @@ LuaBindings::common (lua_State* L) .addFunction ("gain_control", (boost::shared_ptr(Amp::*)())&Amp::gain_control) .endClass () + .deriveWSPtrClass ("UnknownProcessor") + .endClass () + .deriveWSPtrClass ("PluginControl") .endClass () @@ -774,6 +799,10 @@ LuaBindings::common (lua_State* L) .beginPtrStdList > ("RegionListPtr") .endClass () + //std::list > PortList; + .beginConstStdList > ("PortList") + .endClass () + // used by Playlist::cut/copy .beginConstStdList ("AudioRangeList") .endClass () @@ -863,6 +892,14 @@ LuaBindings::common (lua_State* L) .addConst ("SrcBest", ARDOUR::SrcQuality(SrcBest)) .endNamespace () + .beginNamespace ("PortFlags") + .addConst ("IsInput", ARDOUR::PortFlags(IsInput)) + .addConst ("IsOutput", ARDOUR::PortFlags(IsOutput)) + .addConst ("IsPhysical", ARDOUR::PortFlags(IsPhysical)) + .addConst ("CanMonitor", ARDOUR::PortFlags(CanMonitor)) + .addConst ("IsTerminal", ARDOUR::PortFlags(IsTerminal)) + .endNamespace () + .beginNamespace ("PlaylistDisposition") .addConst ("CopyPlaylist", ARDOUR::PlaylistDisposition(CopyPlaylist)) .addConst ("NewPlaylist", ARDOUR::PlaylistDisposition(NewPlaylist)) @@ -880,7 +917,7 @@ LuaBindings::common (lua_State* L) .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered)) .addConst ("Destructive", ARDOUR::TrackMode(Destructive)) .endNamespace () - .endNamespace (); + .endNamespace (); // end ARDOUR luabridge::getGlobalNamespace (L) .beginNamespace ("ARDOUR") @@ -924,7 +961,29 @@ LuaBindings::common (lua_State* L) .addFunction ("set_output_device_name", &AudioBackend::set_output_device_name) .endClass() - .beginClass ("AudioEngine") + .beginClass ("PortEngine") + .endClass() + + .beginClass ("PortManager") + .addFunction ("port_engine", &PortManager::port_engine) + .addFunction ("connected", &PortManager::connected) + .addFunction ("connect", &PortManager::connect) + .addFunction ("physically_connected", &PortManager::physically_connected) + .addFunction ("disconnect", (int (PortManager::*)(const std::string&, const std::string&))&PortManager::disconnect) + .addFunction ("disconnect_port", (int (PortManager::*)(boost::shared_ptr))&PortManager::disconnect) + .addFunction ("get_port_by_name", &PortManager::get_port_by_name) + .addFunction ("get_pretty_name_by_name", &PortManager::get_pretty_name_by_name) + .addFunction ("port_is_physical", &PortManager::port_is_physical) + .addFunction ("get_physical_outputs", &PortManager::get_physical_outputs) + .addFunction ("get_physical_inputs", &PortManager::get_physical_inputs) + .addFunction ("n_physical_outputs", &PortManager::n_physical_outputs) + .addFunction ("n_physical_inputs", &PortManager::n_physical_inputs) + .addRefFunction ("get_connections", &PortManager::get_connections) + .addRefFunction ("get_ports", (int (PortManager::*)(DataType, PortManager::PortList&))&PortManager::get_ports) + .addRefFunction ("get_backend_ports", (int (PortManager::*)(const std::string&, DataType, PortFlags, std::vector&))&PortManager::get_ports) + .endClass() + + .deriveClass ("AudioEngine") .addFunction ("available_backends", &AudioEngine::available_backends) .addFunction ("current_backend_name", &AudioEngine::current_backend_name) .addFunction ("set_backend", &AudioEngine::set_backend) @@ -974,7 +1033,7 @@ LuaBindings::common (lua_State* L) .addFunction ("record_status", &Session::record_status) .addFunction ("route_by_id", &Session::route_by_id) .addFunction ("route_by_name", &Session::route_by_name) - .addFunction ("route_by_remote_id", &Session::route_by_remote_id) + // STRIPABLE .addFunction ("route_by_remote_id", &Session::route_by_remote_id) .addFunction ("track_by_diskstream_id", &Session::track_by_diskstream_id) .addFunction ("source_by_id", &Session::source_by_id) .addFunction ("controllable_by_id", &Session::controllable_by_id) @@ -989,13 +1048,19 @@ LuaBindings::common (lua_State* L) .addFunction ("abort_reversible_command", &Session::abort_reversible_command) .addFunction ("add_command", &Session::add_command) .addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command) + .addFunction ("engine", (AudioEngine& (Session::*)())&Session::engine) + .addFunction ("get_block_size", &Session::get_block_size) + .addFunction ("worst_output_latency", &Session::worst_output_latency) + .addFunction ("worst_input_latency", &Session::worst_input_latency) + .addFunction ("worst_track_latency", &Session::worst_track_latency) + .addFunction ("worst_playback_latency", &Session::worst_playback_latency) .endClass () .beginClass ("RegionFactory") .addStaticFunction ("region_by_id", &RegionFactory::region_by_id) .endClass () - /* session enums */ + /* session enums (rt-safe, common) */ .beginNamespace ("Session") .beginNamespace ("RecordState") @@ -1004,7 +1069,20 @@ LuaBindings::common (lua_State* L) .addConst ("Recording", ARDOUR::Session::RecordState(Session::Recording)) .endNamespace () - .endNamespace () // END Session enums + .endNamespace () // end Session enums + + /* ardour enums (rt-safe, common) */ + .beginNamespace ("LocationFlags") + .addConst ("IsMark", ARDOUR::Location::Flags(Location::IsMark)) + .addConst ("IsAutoPunch", ARDOUR::Location::Flags(Location::IsAutoPunch)) + .addConst ("IsAutoLoop", ARDOUR::Location::Flags(Location::IsAutoLoop)) + .addConst ("IsHidden", ARDOUR::Location::Flags(Location::IsHidden)) + .addConst ("IsCDMarker", ARDOUR::Location::Flags(Location::IsCDMarker)) + .addConst ("IsRangeMarker", ARDOUR::Location::Flags(Location::IsRangeMarker)) + .addConst ("IsSessionRange", ARDOUR::Location::Flags(Location::IsSessionRange)) + .addConst ("IsSkip", ARDOUR::Location::Flags(Location::IsSkip)) + .addConst ("IsSkipping", ARDOUR::Location::Flags(Location::IsSkipping)) + .endNamespace () .beginNamespace ("LuaAPI") .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor) @@ -1015,9 +1093,8 @@ LuaBindings::common (lua_State* L) .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param) .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation) .addFunction ("usleep", Glib::usleep) - .endNamespace () - - .endNamespace ();// END ARDOUR + .endNamespace () // end LuaAPI + .endNamespace ();// end ARDOUR } void @@ -1038,8 +1115,10 @@ LuaBindings::dsp (lua_State* L) .beginClass ("MidiBuffer") .addEqualCheck () .addFunction ("silence", &MidiBuffer::silence) - .addFunction ("empty", &MidiBuffer::empty) + .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::MIDIEvent&))&MidiBuffer::push_back) + .addFunction ("push_back", (bool (MidiBuffer::*)(framepos_t, size_t, const uint8_t*))&MidiBuffer::push_back) // TODO iterators.. + .addExtCFunction ("table", &luabridge::CFunc::listToTable, MidiBuffer>) .endClass() .beginClass ("BufferSet") @@ -1066,8 +1145,8 @@ LuaBindings::dsp (lua_State* L) // add Ctor? .addFunction ("type", &Evoral::MIDIEvent::type) .addFunction ("channel", &Evoral::MIDIEvent::channel) - .addFunction ("set_type", &Evoral::MIDIEvent::type) - .addFunction ("set_channel", &Evoral::MIDIEvent::channel) + .addFunction ("set_type", &Evoral::MIDIEvent::set_type) + .addFunction ("set_channel", &Evoral::MIDIEvent::set_channel) .endClass () .endNamespace (); @@ -1105,24 +1184,25 @@ LuaBindings::dsp (lua_State* L) .addFunction ("set_cutoff", &DSP::LowPass::set_cutoff) .addFunction ("reset", &DSP::LowPass::reset) .endClass () - .beginClass ("Biquad") + .beginClass ("Biquad") .addConstructor () - .addFunction ("run", &DSP::BiQuad::run) - .addFunction ("compute", &DSP::BiQuad::compute) - .addFunction ("reset", &DSP::BiQuad::reset) + .addFunction ("run", &DSP::Biquad::run) + .addFunction ("compute", &DSP::Biquad::compute) + .addFunction ("reset", &DSP::Biquad::reset) + .addFunction ("dB_at_freq", &DSP::Biquad::dB_at_freq) .endClass () /* DSP enums */ - .beginNamespace ("BiQuadType") - .addConst ("LowPass", ARDOUR::DSP::BiQuad::LowPass) - .addConst ("HighPass", ARDOUR::DSP::BiQuad::HighPass) - .addConst ("BandPassSkirt", ARDOUR::DSP::BiQuad::BandPassSkirt) - .addConst ("BandPass0dB", ARDOUR::DSP::BiQuad::BandPass0dB) - .addConst ("Notch", ARDOUR::DSP::BiQuad::Notch) - .addConst ("AllPass", ARDOUR::DSP::BiQuad::AllPass) - .addConst ("Peaking", ARDOUR::DSP::BiQuad::Peaking) - .addConst ("LowShelf", ARDOUR::DSP::BiQuad::LowShelf) - .addConst ("HighShelf", ARDOUR::DSP::BiQuad::HighShelf) + .beginNamespace ("BiquadType") + .addConst ("LowPass", ARDOUR::DSP::Biquad::LowPass) + .addConst ("HighPass", ARDOUR::DSP::Biquad::HighPass) + .addConst ("BandPassSkirt", ARDOUR::DSP::Biquad::BandPassSkirt) + .addConst ("BandPass0dB", ARDOUR::DSP::Biquad::BandPass0dB) + .addConst ("Notch", ARDOUR::DSP::Biquad::Notch) + .addConst ("AllPass", ARDOUR::DSP::Biquad::AllPass) + .addConst ("Peaking", ARDOUR::DSP::Biquad::Peaking) + .addConst ("LowShelf", ARDOUR::DSP::Biquad::LowShelf) + .addConst ("HighShelf", ARDOUR::DSP::Biquad::HighShelf) .endNamespace () .beginClass ("DspShm")