Only show user-presets in favorite sidebar
[ardour.git] / libs / ardour / luabindings.cc
index 1c39403c27ac9673764f6f9d06835db94d237c0d..9fb807e5debddb9e648133e96a3481a5176d10fb 100644 (file)
 #include "ardour/buffer_set.h"
 #include "ardour/beats_samples_converter.h"
 #include "ardour/chan_mapping.h"
+#include "ardour/convolver.h"
 #include "ardour/dB.h"
 #include "ardour/delayline.h"
 #include "ardour/disk_reader.h"
 #include "ardour/disk_writer.h"
 #include "ardour/dsp_filter.h"
 #include "ardour/file_source.h"
+#include "ardour/filesystem_paths.h"
 #include "ardour/fluid_synth.h"
 #include "ardour/interthread_info.h"
+#include "ardour/ltc_file_reader.h"
 #include "ardour/lua_api.h"
 #include "ardour/luabindings.h"
 #include "ardour/luaproc.h"
@@ -169,7 +172,8 @@ CLASSINFO(TrackSelection);
 CLASSINFO(TrackViewList);
 
 
-CLASSKEYS(std::bitset<48ul>); // LuaSignal::LAST_SIGNAL
+/* this needs to match gtk2_ardour/luasignal.h */
+CLASSKEYS(std::bitset<49ul>); // LuaSignal::LAST_SIGNAL
 
 CLASSKEYS(void);
 CLASSKEYS(float);
@@ -232,6 +236,7 @@ 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> >);
+CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::PluginInfo> >); // PluginInfoList
 
 CLASSKEYS(std::list<ArdourMarker*>);
 CLASSKEYS(std::list<TimeAxisView*>);
@@ -1016,29 +1021,29 @@ LuaBindings::common (lua_State* L)
                .addFunction ("pan_width_control", &Stripable::pan_width_control)
                .addFunction ("pan_frontback_control", &Stripable::pan_frontback_control)
                .addFunction ("pan_lfe_control", &Stripable::pan_lfe_control)
-               .addFunction ("send_level_control", &Stripable::send_level_controllable)
-               .addFunction ("send_enable_control", &Stripable::send_level_controllable)
+               .addFunction ("send_level_controllable", &Stripable::send_level_controllable)
+               .addFunction ("send_enable_controllable", &Stripable::send_enable_controllable)
                .addFunction ("send_name", &Stripable::send_name)
                .addFunction ("monitor_control", &Stripable::monitor_control)
-               .addFunction ("master_send_enable_control ", &Stripable::master_send_enable_controllable )
-               .addFunction ("comp_enable_control ", &Stripable::comp_enable_controllable )
-               .addFunction ("comp_threshold_control ", &Stripable::comp_threshold_controllable )
-               .addFunction ("comp_speed_control ", &Stripable::comp_speed_controllable )
-               .addFunction ("comp_mode_control ", &Stripable::comp_mode_controllable )
-               .addFunction ("comp_makeup_control ", &Stripable::comp_makeup_controllable )
-               .addFunction ("comp_redux_control ", &Stripable::comp_redux_controllable )
+               .addFunction ("master_send_enable_controllable", &Stripable::master_send_enable_controllable)
+               .addFunction ("comp_enable_controllabl", &Stripable::comp_enable_controllable)
+               .addFunction ("comp_threshold_controllable", &Stripable::comp_threshold_controllable)
+               .addFunction ("comp_speed_controllable", &Stripable::comp_speed_controllable)
+               .addFunction ("comp_mode_controllable", &Stripable::comp_mode_controllable)
+               .addFunction ("comp_makeup_controllable", &Stripable::comp_makeup_controllable)
+               .addFunction ("comp_redux_controllable", &Stripable::comp_redux_controllable)
                .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_cnt", &Stripable::eq_band_cnt)
+               .addFunction ("eq_enable_controllable", &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 ("filter_freq_controllable ", &Stripable::filter_freq_controllable )
-               .addFunction ("filter_slope_controllable ", &Stripable::filter_slope_controllable )
-               .addFunction ("filter_enable_controllable ", &Stripable::filter_enable_controllable )
+               .addFunction ("eq_gain_controllable", &Stripable::eq_gain_controllable)
+               .addFunction ("eq_freq_controllable", &Stripable::eq_freq_controllable)
+               .addFunction ("eq_q_controllable", &Stripable::eq_q_controllable)
+               .addFunction ("eq_shape_controllable", &Stripable::eq_shape_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)
 
@@ -1122,7 +1127,7 @@ LuaBindings::common (lua_State* L)
                .addFunction ("combine", &Playlist::combine)
                .addFunction ("uncombine", &Playlist::uncombine)
                .addFunction ("split_region", &Playlist::split_region)
-               .addFunction ("split", (void (Playlist::*)(samplepos_t))&Playlist::split)
+               //.addFunction ("split", &Playlist::split) // XXX needs MusicSample
                .addFunction ("cut", (boost::shared_ptr<Playlist> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
 #if 0
                .addFunction ("copy", &Playlist::copy)
@@ -1324,6 +1329,7 @@ LuaBindings::common (lua_State* L)
                .endClass ()
 
                .beginStdVector <Plugin::PresetRecord> ("PresetVector").endClass ()
+               .beginStdList <boost::shared_ptr<ARDOUR::PluginInfo> > ("PluginInfoList").endClass ()
 
                .deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
                .addVoidConstructor ()
@@ -1445,6 +1451,8 @@ LuaBindings::common (lua_State* L)
                .addFunction ("plugin", &PluginInsert::plugin)
                .addFunction ("activate", &PluginInsert::activate)
                .addFunction ("deactivate", &PluginInsert::deactivate)
+               .addFunction ("enable", &PluginInsert::enable)
+               .addFunction ("enabled", &PluginInsert::enabled)
                .addFunction ("strict_io_configured", &PluginInsert::strict_io_configured)
                .addFunction ("input_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::input_map)
                .addFunction ("output_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::output_map)
@@ -1453,6 +1461,15 @@ LuaBindings::common (lua_State* L)
                .addFunction ("natural_output_streams", &PluginInsert::natural_output_streams)
                .addFunction ("natural_input_streams", &PluginInsert::natural_input_streams)
                .addFunction ("reset_parameters_to_default", &PluginInsert::reset_parameters_to_default)
+               .addFunction ("has_sidechain", &PluginInsert::has_sidechain)
+               .addFunction ("is_instrument", &PluginInsert::is_instrument)
+               .addFunction ("type", &PluginInsert::type)
+               .addFunction ("signal_latency", &PluginInsert::signal_latency)
+               .addFunction ("get_count", &PluginInsert::get_count)
+               .addFunction ("is_channelstrip", &PluginInsert::is_channelstrip)
+               .addFunction ("is_nonbypassable", &PluginInsert::is_nonbypassable)
+               .addFunction ("clear_stats", &PluginInsert::clear_stats)
+               .addRefFunction ("get_stats", &PluginInsert::get_stats)
                .endClass ()
 
                .deriveWSPtrClass <ReadOnlyControl, PBD::StatefulDestructible> ("ReadOnlyControl")
@@ -1764,6 +1781,7 @@ LuaBindings::common (lua_State* L)
                .addConst ("LV2", ARDOUR::PluginType(LV2))
                .addConst ("Windows_VST", ARDOUR::PluginType(Windows_VST))
                .addConst ("LXVST", ARDOUR::PluginType(LXVST))
+               .addConst ("MacVST", ARDOUR::PluginType(MacVST))
                .addConst ("Lua", ARDOUR::PluginType(Lua))
                .endNamespace ()
 
@@ -1930,6 +1948,7 @@ LuaBindings::common (lua_State* L)
                .addConst ("RF64", ARDOUR::HeaderFormat(RF64))
                .addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
                .addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
+               .addConst ("FLAC", ARDOUR::HeaderFormat(FLAC))
                .endNamespace ()
 
                .beginNamespace ("InsertMergePolicy")
@@ -2044,6 +2063,12 @@ LuaBindings::common (lua_State* L)
 
                .endNamespace (); // end ARDOUR
 
+       luabridge::getGlobalNamespace (L)
+               .beginNamespace ("ARDOUR")
+               .addFunction ("user_config_directory", &ARDOUR::user_config_directory)
+               .addFunction ("user_cache_directory", &ARDOUR::user_cache_directory)
+               .endNamespace (); // end ARDOUR
+
        luabridge::getGlobalNamespace (L)
                .beginNamespace ("ARDOUR")
                .beginClass <AudioBackendInfo> ("AudioBackendInfo")
@@ -2215,6 +2240,8 @@ LuaBindings::common (lua_State* L)
                .addFunction ("get_routes", &Session::get_routes)
                .addFunction ("get_tracks", &Session::get_tracks)
                .addFunction ("get_stripables", (StripableList (Session::*)() const)&Session::get_stripables)
+               .addFunction ("get_routelist", &Session::get_routelist)
+
                .addFunction ("name", &Session::name)
                .addFunction ("path", &Session::path)
                .addFunction ("record_status", &Session::record_status)
@@ -2298,6 +2325,7 @@ LuaBindings::common (lua_State* L)
                .beginNamespace ("LuaAPI")
                .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor)
                .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc)
+               .addFunction ("list_plugins", ARDOUR::LuaAPI::list_plugins)
                .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info)
                .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
                .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
@@ -2308,6 +2336,7 @@ LuaBindings::common (lua_State* L)
                .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
                .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
                .addCFunction ("color_to_rgba", ARDOUR::LuaAPI::color_to_rgba)
+               .addFunction ("ascii_dtostr", ARDOUR::LuaAPI::ascii_dtostr)
                .addFunction ("usleep", Glib::usleep)
                .addFunction ("monotonic_time", ::g_get_monotonic_time)
                .addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
@@ -2377,6 +2406,22 @@ LuaBindings::common (lua_State* L)
                .addFunction ("set_type", &DSP::Generator::set_type)
                .endClass ()
 
+               .beginClass <ARDOUR::LTCReader> ("LTCReader")
+               .addConstructor <void (*) (int, LTC_TV_STANDARD)> ()
+               .addFunction ("write", &ARDOUR::LTCReader::write)
+               .addRefFunction ("read", &ARDOUR::LTCReader::read)
+               .endClass ()
+
+               .beginClass <DSP::Convolver> ("Convolver")
+               .addConstructor <void (*) (Session&, std::string const&, DSP::Convolver::IRChannelConfig, uint32_t)> ()
+               .addFunction ("run", &ARDOUR::DSP::Convolver::run)
+               .addFunction ("run_stereo", &ARDOUR::DSP::Convolver::run_stereo)
+               .addFunction ("latency", &ARDOUR::DSP::Convolver::latency)
+               .addFunction ("n_inputs", &ARDOUR::DSP::Convolver::n_inputs)
+               .addFunction ("n_outputs", &ARDOUR::DSP::Convolver::n_outputs)
+               .addFunction ("ready", &ARDOUR::DSP::Convolver::ready)
+               .endClass ()
+
                /* DSP enums */
                .beginNamespace ("BiquadType")
                .addConst ("LowPass", ARDOUR::DSP::Biquad::LowPass)
@@ -2396,6 +2441,19 @@ LuaBindings::common (lua_State* L)
                .addConst ("PinkNoise", ARDOUR::DSP::Generator::PinkNoise)
                .endNamespace ()
 
+               .beginNamespace ("LTC_TV_STANDARD")
+               .addConst ("LTC_TV_525_60", LTC_TV_525_60)
+               .addConst ("LTC_TV_625_50", LTC_TV_625_50)
+               .addConst ("LTC_TV_1125_60", LTC_TV_1125_60)
+               .addConst ("LTC_TV_FILM_24", LTC_TV_FILM_24)
+               .endNamespace ()
+
+               .beginNamespace ("IRChannelConfig")
+               .addConst ("Mono", DSP::Convolver::Mono)
+               .addConst ("MonoToStereo", DSP::Convolver::MonoToStereo)
+               .addConst ("Stereo", DSP::Convolver::Stereo)
+               .endNamespace ()
+
                .beginClass <DSP::DspShm> ("DspShm")
                .addConstructor<void (*) (size_t)> ()
                .addFunction ("allocate", &DSP::DspShm::allocate)
@@ -2422,7 +2480,7 @@ LuaBindings::dsp (lua_State* L)
                .addFunction ("silence", &AudioBuffer::silence)
                .addFunction ("apply_gain", &AudioBuffer::apply_gain)
                .addFunction ("check_silence", &AudioBuffer::check_silence)
-               .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, samplecnt_t, samplecnt_t, samplecnt_t))&AudioBuffer::check_silence)
+               .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, samplecnt_t, samplecnt_t, samplecnt_t))&AudioBuffer::read_from)
                .endClass()
 
                .beginClass <MidiBuffer> ("MidiBuffer")