Remove LocaleGuard from ARDOUR::Pannable class
[ardour.git] / libs / ardour / luabindings.cc
index ac1f27f240ff66fed08f64d0d2d869bc3c138a9b..3125ab1fe64825b87ceb0fdf6a759ebfedf7f896 100644 (file)
@@ -71,6 +71,8 @@
 #include "ardour/stripable.h"
 #include "ardour/track.h"
 #include "ardour/tempo.h"
+#include "ardour/vca.h"
+#include "ardour/vca_manager.h"
 
 #include "LuaBridge/LuaBridge.h"
 
@@ -168,6 +170,7 @@ CLASSKEYS(std::list<Selectable*>);
 
 CLASSKEYS(ARDOUR::AudioEngine);
 CLASSKEYS(ARDOUR::BeatsFramesConverter);
+CLASSKEYS(ARDOUR::DoubleBeatsFramesConverter);
 CLASSKEYS(ARDOUR::BufferSet);
 CLASSKEYS(ARDOUR::ChanCount);
 CLASSKEYS(ARDOUR::ChanMapping);
@@ -192,6 +195,8 @@ CLASSKEYS(ARDOUR::PresentationInfo);
 CLASSKEYS(ARDOUR::Session);
 CLASSKEYS(ARDOUR::SessionConfiguration);
 CLASSKEYS(ARDOUR::Source);
+CLASSKEYS(ARDOUR::VCA);
+CLASSKEYS(ARDOUR::VCAManager);
 
 CLASSKEYS(PBD::ID);
 CLASSKEYS(PBD::Configuration);
@@ -200,6 +205,7 @@ CLASSKEYS(PBD::StatefulDestructible);
 
 CLASSKEYS(Evoral::Beats);
 CLASSKEYS(Evoral::Event<framepos_t>);
+CLASSKEYS(Evoral::ControlEvent);
 
 
 CLASSKEYS(std::vector<std::string>);
@@ -208,6 +214,8 @@ CLASSKEYS(std::vector<float*>);
 CLASSKEYS(std::vector<double>);
 CLASSKEYS(std::list<int64_t>);
 
+CLASSKEYS(std::list<Evoral::ControlEvent*>);
+
 CLASSKEYS(std::vector<ARDOUR::Plugin::PresetRecord>);
 CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Processor> >);
 CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Source> >);
@@ -218,6 +226,7 @@ CLASSKEYS(std::list<ARDOUR::AudioRange>);
 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(std::list<boost::shared_ptr<ARDOUR::Stripable> >);
 CLASSKEYS(boost::shared_ptr<std::list<boost::shared_ptr<ARDOUR::Route> > >);
 
 CLASSKEYS(boost::shared_ptr<ARDOUR::AudioRegion>);
@@ -240,7 +249,9 @@ CLASSKEYS(boost::shared_ptr<Evoral::Sequence<Evoral::Beats> >);
 
 CLASSKEYS(boost::shared_ptr<ARDOUR::Playlist>);
 CLASSKEYS(boost::shared_ptr<ARDOUR::Route>);
+CLASSKEYS(boost::shared_ptr<ARDOUR::VCA>);
 CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
+CLASSKEYS(boost::weak_ptr<ARDOUR::VCA>);
 
 CLASSKEYS(Vamp::RealTime);
 CLASSKEYS(Vamp::PluginBase);
@@ -256,6 +267,12 @@ namespace LuaCairo {
        class ImageSurface;
        class PangoLayout;
 }
+
+namespace LuaDialog {
+       class Message;
+       class Dialog;
+}
+
 namespace Cairo {
        class Context;
 }
@@ -264,6 +281,9 @@ CLASSKEYS(Cairo::Context);
 CLASSKEYS(LuaCairo::ImageSurface);
 CLASSKEYS(LuaCairo::PangoLayout);
 
+CLASSKEYS(LuaDialog::Message);
+CLASSKEYS(LuaDialog::Dialog);
+
 #endif // end windows special case
 
 /* Some notes on Lua bindings for libardour and friends
@@ -500,6 +520,11 @@ LuaBindings::common (lua_State* L)
                .addFunction ("id", &Evoral::Parameter::id)
                .endClass ()
 
+               .beginClass <Evoral::ControlEvent> ("ControlEvent")
+               .addData ("when", &Evoral::ControlEvent::when)
+               .addData ("value", &Evoral::ControlEvent::value)
+               .endClass ()
+
                .beginWSPtrClass <Evoral::ControlList> ("ControlList")
                .addFunction ("add", &Evoral::ControlList::add)
                .addFunction ("thin", &Evoral::ControlList::thin)
@@ -510,7 +535,9 @@ LuaBindings::common (lua_State* L)
                .addFunction ("truncate_end", &Evoral::ControlList::truncate_end)
                .addFunction ("truncate_start", &Evoral::ControlList::truncate_start)
                .addFunction ("clear", (void (Evoral::ControlList::*)(double, double))&Evoral::ControlList::clear)
+               .addFunction ("clear_list", (void (Evoral::ControlList::*)())&Evoral::ControlList::clear)
                .addFunction ("in_write_pass", &Evoral::ControlList::in_write_pass)
+               .addFunction ("events", &Evoral::ControlList::events)
                .endClass ()
 
                .beginWSPtrClass <Evoral::ControlSet> ("ControlSet")
@@ -526,6 +553,7 @@ LuaBindings::common (lua_State* L)
                .addData ("upper", &Evoral::ParameterDescriptor::upper)
                .addData ("normal", &Evoral::ParameterDescriptor::normal)
                .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
+               .addData ("logarithmic", &Evoral::ParameterDescriptor::logarithmic)
                .endClass ()
 
                .beginClass <Evoral::Range<framepos_t> > ("Range")
@@ -761,10 +789,10 @@ LuaBindings::common (lua_State* L)
                .deriveClass <PBD::OwnedPropertyList, PBD::PropertyList> ("OwnedPropertyList")
                .endClass ()
 
-               .beginWSPtrClass <AutomationList> ("AutomationList")
+               .deriveWSPtrClass <AutomationList, Evoral::ControlList> ("AutomationList")
                .addCast<PBD::Stateful> ("to_stateful")
                .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
-               .addCast<Evoral::ControlList> ("list")
+               .addCast<Evoral::ControlList> ("list") // deprecated
                .addFunction ("get_state", &AutomationList::get_state)
                .addFunction ("memento_command", &AutomationList::memento_command)
                .addFunction ("touching", &AutomationList::touching)
@@ -906,6 +934,8 @@ LuaBindings::common (lua_State* L)
                .addFunction ("add", &RouteGroup::add)
                .addFunction ("remove", &RouteGroup::remove)
                .addFunction ("clear", &RouteGroup::clear)
+               .addFunction ("set_rgba", &RouteGroup::set_rgba)
+               .addFunction ("rgba", &RouteGroup::rgba)
                .addFunction ("has_subgroup", &RouteGroup::has_subgroup)
                .addFunction ("make_subgroup", &RouteGroup::make_subgroup)
                .addFunction ("destroy_subgroup", &RouteGroup::destroy_subgroup)
@@ -916,11 +946,14 @@ LuaBindings::common (lua_State* L)
                .addFunction ("color", &PresentationInfo::color)
                .addFunction ("set_color", &PresentationInfo::set_color)
                .addFunction ("order", &PresentationInfo::order)
+               .addFunction ("special", &PresentationInfo::special)
+               .addFunction ("flags", &PresentationInfo::flags)
                .addConst ("max_order", ARDOUR::PresentationInfo::max_order)
                .endClass ()
 
                .deriveWSPtrClass <Stripable, SessionObject> ("Stripable")
                .addCast<Route> ("to_route")
+               .addCast<VCA> ("to_vca")
                .addFunction ("is_auditioner", &Stripable::is_auditioner)
                .addFunction ("is_master", &Stripable::is_master)
                .addFunction ("is_monitor", &Stripable::is_monitor)
@@ -954,18 +987,28 @@ LuaBindings::common (lua_State* L)
                .addFunction ("comp_mode_name", &Stripable::comp_mode_name)
                .addFunction ("comp_speed_name", &Stripable::comp_speed_name)
                .addFunction ("eq_band_cnt ", &Stripable::eq_band_cnt)
+               .addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
                .addFunction ("eq_band_name", &Stripable::eq_band_name)
                .addFunction ("eq_gain_control", &Stripable::eq_gain_controllable)
                .addFunction ("eq_freq_control ", &Stripable::eq_freq_controllable )
                .addFunction ("eq_q_control ", &Stripable::eq_q_controllable )
                .addFunction ("eq_shape_control ", &Stripable::eq_shape_controllable )
-               .addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
-               .addFunction ("eq_hpf_control ", &Stripable::eq_hpf_controllable )
+               .addFunction ("filter_freq_controllable ", &Stripable::filter_freq_controllable )
+               .addFunction ("filter_slope_controllable ", &Stripable::filter_slope_controllable )
+               .addFunction ("filter_enable_controllable ", &Stripable::filter_enable_controllable )
                .addFunction ("set_presentation_order", &Stripable::set_presentation_order)
                .addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)
 
                .endClass ()
 
+               .deriveWSPtrClass <VCA, Stripable> ("VCA")
+               .addFunction ("full_name", &VCA::full_name)
+               .addFunction ("number", &VCA::number)
+               .addFunction ("gain_control", &VCA::gain_control)
+               .addFunction ("solo_control", &VCA::solo_control)
+               .addFunction ("mute_control", &VCA::mute_control)
+               .endClass ()
+
                .deriveWSPtrClass <Route, Stripable> ("Route")
                .addCast<Track> ("to_track")
                .addCast<Automatable> ("to_automatable")
@@ -1136,6 +1179,7 @@ LuaBindings::common (lua_State* L)
                .addFunction ("set_video_locked", &Region::set_video_locked)
                .addFunction ("set_position_locked", &Region::set_position_locked)
                .addFunction ("source", &Region::source)
+               .addFunction ("control", static_cast<boost::shared_ptr<Evoral::Control>(Region::*)(const Evoral::Parameter&, bool)>(&Region::control))
                .endClass ()
 
                .deriveWSPtrClass <MidiRegion, Region> ("MidiRegion")
@@ -1236,7 +1280,6 @@ LuaBindings::common (lua_State* L)
                .deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
                .addVoidConstructor ()
                .addData ("label", &ParameterDescriptor::label)
-               .addData ("logarithmic", &ParameterDescriptor::logarithmic)
                .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name)
                .endClass ()
 
@@ -1296,11 +1339,15 @@ LuaBindings::common (lua_State* L)
                .addFunction ("name", &Plugin::name)
                .addFunction ("maker", &Plugin::maker)
                .addFunction ("parameter_count", &Plugin::parameter_count)
+               .addFunction ("parameter_label", &Plugin::parameter_label)
                .addRefFunction ("nth_parameter", &Plugin::nth_parameter)
                .addFunction ("preset_by_label", &Plugin::preset_by_label)
                .addFunction ("preset_by_uri", &Plugin::preset_by_uri)
                .addFunction ("load_preset", &Plugin::load_preset)
                .addFunction ("parameter_is_input", &Plugin::parameter_is_input)
+               .addFunction ("parameter_is_output", &Plugin::parameter_is_output)
+               .addFunction ("parameter_is_control", &Plugin::parameter_is_control)
+               .addFunction ("parameter_is_audio", &Plugin::parameter_is_audio)
                .addFunction ("get_docs", &Plugin::get_docs)
                .addFunction ("get_info", &Plugin::get_info)
                .addFunction ("get_parameter_docs", &Plugin::get_parameter_docs)
@@ -1329,10 +1376,9 @@ LuaBindings::common (lua_State* L)
 
                .deriveWSPtrClass <AutomationControl, PBD::Controllable> ("AutomationControl")
                .addCast<Evoral::Control> ("to_ctrl")
+               .addCast<SlavableAutomationControl> ("to_slavable")
                .addFunction ("automation_state", &AutomationControl::automation_state)
-               .addFunction ("automation_style", &AutomationControl::automation_style)
                .addFunction ("set_automation_state", &AutomationControl::set_automation_state)
-               .addFunction ("set_automation_style", &AutomationControl::set_automation_style)
                .addFunction ("start_touch", &AutomationControl::start_touch)
                .addFunction ("stop_touch", &AutomationControl::stop_touch)
                .addFunction ("get_value", &AutomationControl::get_value)
@@ -1442,6 +1488,14 @@ LuaBindings::common (lua_State* L)
                .beginConstStdList <boost::shared_ptr<Route> > ("RouteList")
                .endClass ()
 
+               // StripableList == std::list<boost::shared_ptr<Stripable> >
+               .beginConstStdList <boost::shared_ptr<Stripable> > ("StripableList")
+               .endClass ()
+
+               // VCAList == std::list<boost::shared_ptr<VCA> >
+               .beginConstStdList <boost::shared_ptr<VCA> > ("VCAList")
+               .endClass ()
+
                // boost::shared_ptr<RouteList>
                .beginPtrStdList <boost::shared_ptr<Route> > ("RouteListPtr")
                .addVoidPtrConstructor<std::list<boost::shared_ptr <Route> > > ()
@@ -1498,6 +1552,9 @@ LuaBindings::common (lua_State* L)
                .beginStdList <boost::shared_ptr<Evoral::Note<Evoral::Beats> > > ("NotePtrList")
                .endClass ()
 
+               .beginConstStdList <Evoral::ControlEvent*> ("EventList")
+               .endClass ()
+
 #if 0  // depends on Evoal:: Note, Beats see note_fixer.h
        // typedef Evoral::Note<Evoral::Beats> Note;
        // std::set< boost::weak_ptr<Note> >
@@ -1532,6 +1589,12 @@ LuaBindings::common (lua_State* L)
                .addFunction ("from", &BeatsFramesConverter::from)
                .endClass ()
 
+               .beginClass <DoubleBeatsFramesConverter> ("DoubleBeatsFramesConverter")
+               .addConstructor <void (*) (const TempoMap&, framepos_t)> ()
+               .addFunction ("to", &DoubleBeatsFramesConverter::to)
+               .addFunction ("from", &DoubleBeatsFramesConverter::from)
+               .endClass ()
+
                .beginClass <TempoMap> ("TempoMap")
                .addFunction ("add_tempo", &TempoMap::add_tempo)
                .addFunction ("add_meter", &TempoMap::add_meter)
@@ -1600,18 +1663,12 @@ LuaBindings::common (lua_State* L)
                .addConst ("MasterOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MasterOut))
                .addConst ("MonitorOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MonitorOut))
                .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner))
-               .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected))
                .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden))
                .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet))
                .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask))
                .endNamespace ()
                .endNamespace ()
 
-               .beginNamespace ("AutoStyle")
-               .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
-               .addConst ("Trim", ARDOUR::AutoStyle(Trim))
-               .endNamespace ()
-
                .beginNamespace ("AutoState")
                .addConst ("Off", ARDOUR::AutoState(Off))
                .addConst ("Write", ARDOUR::AutoState(Write))
@@ -1849,6 +1906,15 @@ LuaBindings::common (lua_State* L)
                .addFunction ("get_last_backend_error", &AudioEngine::get_last_backend_error)
                .endClass()
 
+               .deriveClass <VCAManager, PBD::StatefulDestructible> ("VCAManager")
+#if 0 // needs non-const VCAManager reference
+               .addFunction ("create_vca", &VCAManager::create_vca)
+               .addFunction ("remove_vca", &VCAManager::remove_vca)
+#endif
+               .addFunction ("vca_by_number", &VCAManager::vca_by_number)
+               .addFunction ("vcas", &VCAManager::vcas)
+               .endClass()
+
                .deriveClass <SessionConfiguration, PBD::Configuration> ("SessionConfiguration")
 #undef  CONFIG_VARIABLE
 #undef  CONFIG_VARIABLE_SPECIAL
@@ -1901,6 +1967,7 @@ LuaBindings::common (lua_State* L)
                .addFunction ("new_midi_route", &Session::new_midi_route)
                .addFunction ("get_routes", &Session::get_routes)
                .addFunction ("get_tracks", &Session::get_tracks)
+               .addFunction ("get_stripables", (StripableList (Session::*)() const)&Session::get_stripables)
                .addFunction ("name", &Session::name)
                .addFunction ("path", &Session::path)
                .addFunction ("record_status", &Session::record_status)
@@ -1943,7 +2010,10 @@ LuaBindings::common (lua_State* L)
                .addFunction ("cfg", &Session::cfg)
                .addFunction ("route_groups", &Session::route_groups)
                .addFunction ("new_route_group", &Session::new_route_group)
+               .addFunction ("end_is_free", &Session::end_is_free)
+               .addFunction ("set_end_is_free", &Session::set_end_is_free)
                .addFunction ("remove_route_group", (void (Session::*)(RouteGroup*))&Session::remove_route_group)
+               .addFunction ("vca_manager", &Session::vca_manager)
                .addExtCFunction ("timecode_to_sample_lua", ARDOUR::LuaAPI::timecode_to_sample_lua)
                .addExtCFunction ("sample_to_timecode_lua", ARDOUR::LuaAPI::sample_to_timecode_lua)
                .endClass ()