Add automatable click-free bypass/enable feature to a-eq
[ardour.git] / libs / ardour / luabindings.cc
index 6f34b57f06b9dae9c0a3a62c65ea0049efa4898e..d316c855c0a6514ff961a111ff4241a202b3a315 100644 (file)
@@ -36,6 +36,7 @@
 #include "ardour/chan_mapping.h"
 #include "ardour/dB.h"
 #include "ardour/dsp_filter.h"
+#include "ardour/fluid_synth.h"
 #include "ardour/interthread_info.h"
 #include "ardour/lua_api.h"
 #include "ardour/luabindings.h"
@@ -169,6 +170,7 @@ CLASSKEYS(ARDOUR::LuaOSC::Address);
 CLASSKEYS(ARDOUR::Session);
 CLASSKEYS(ARDOUR::BufferSet);
 CLASSKEYS(ARDOUR::ChanMapping);
+CLASSKEYS(ARDOUR::FluidSynth);
 CLASSKEYS(ARDOUR::DSP::DspShm);
 CLASSKEYS(ARDOUR::LuaTableRef);
 CLASSKEYS(PBD::Configuration);
@@ -177,10 +179,14 @@ CLASSKEYS(ARDOUR::SessionConfiguration);
 CLASSKEYS(PBD::ID);
 CLASSKEYS(ARDOUR::Location);
 CLASSKEYS(ARDOUR::PluginInfo);
+CLASSKEYS(ARDOUR::MonitorProcessor);
+CLASSKEYS(ARDOUR::Plugin::PresetRecord);
+CLASSKEYS(std::vector<ARDOUR::Plugin::PresetRecord>);
 CLASSKEYS(PBD::PropertyChange);
 CLASSKEYS(std::vector<std::string>);
 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Port> >);
+CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Processor> >);
 CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
 CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
 CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
@@ -192,6 +198,7 @@ CLASSKEYS(ARDOUR::PortManager);
 CLASSKEYS(ARDOUR::AudioEngine);
 CLASSKEYS(void);
 CLASSKEYS(float);
+CLASSKEYS(unsigned char);
 
 #endif // end windows special case
 
@@ -359,6 +366,21 @@ LuaBindings::common (lua_State* L)
                .beginClass <Timecode::BBT_Time> ("BBT_TIME")
                .addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
                .endClass ()
+
+               /* libtimecode enums */
+               .beginNamespace ("TimecodeFormat")
+               .addConst ("TC23976", Timecode::TimecodeFormat(Timecode::timecode_23976))
+               .addConst ("TC24", Timecode::TimecodeFormat(Timecode::timecode_24))
+               .addConst ("TC24976", Timecode::TimecodeFormat(Timecode::timecode_24976))
+               .addConst ("TC25", Timecode::TimecodeFormat(Timecode::timecode_25))
+               .addConst ("TC2997", Timecode::TimecodeFormat(Timecode::timecode_2997))
+               .addConst ("TC2997DF", Timecode::TimecodeFormat(Timecode::timecode_2997drop))
+               .addConst ("TC2997000", Timecode::TimecodeFormat(Timecode::timecode_2997000))
+               .addConst ("TC2997000DF", Timecode::TimecodeFormat(Timecode::timecode_2997000drop))
+               .addConst ("TC30", Timecode::TimecodeFormat(Timecode::timecode_30))
+               .addConst ("TC5994", Timecode::TimecodeFormat(Timecode::timecode_5994))
+               .addConst ("TC60", Timecode::TimecodeFormat(Timecode::timecode_60))
+               .endNamespace ()
                .endNamespace ();
 
        luabridge::getGlobalNamespace (L)
@@ -436,6 +458,16 @@ LuaBindings::common (lua_State* L)
 
                .beginWSPtrClass <PluginInfo> ("PluginInfo")
                .addVoidConstructor ()
+               .addData ("name", &PluginInfo::name, false)
+               .addData ("category", &PluginInfo::category, false)
+               .addData ("creator", &PluginInfo::creator, false)
+               .addData ("path", &PluginInfo::path, false)
+               .addData ("n_inputs", &PluginInfo::n_inputs, false)
+               .addData ("n_outputs", &PluginInfo::n_outputs, false)
+               .addData ("type", &PluginInfo::type, false)
+               .addData ("unique_id", &PluginInfo::unique_id, false)
+               .addFunction ("is_instrument", &PluginInfo::is_instrument)
+               .addFunction ("get_presets", &PluginInfo::get_presets)
                .endClass ()
 
                .beginNamespace ("Route")
@@ -615,6 +647,32 @@ LuaBindings::common (lua_State* L)
                .addFunction ("trim_control", &Stripable::trim_control)
                .addFunction ("rec_enable_control", &Stripable::rec_enable_control)
                .addFunction ("rec_safe_control", &Stripable::rec_safe_control)
+               .addFunction ("pan_azimuth_control", &Stripable::pan_azimuth_control)
+               .addFunction ("pan_elevation_control", &Stripable::pan_elevation_control)
+               .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_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 ("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_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 ("set_presentation_order", &Stripable::set_presentation_order)
                .addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)
 
@@ -765,6 +823,8 @@ LuaBindings::common (lua_State* L)
                .addData ("valid", &Plugin::PresetRecord::valid, false)
                .endClass ()
 
+               .beginStdVector <Plugin::PresetRecord> ("PresetVector").endClass ()
+
                .deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
                .addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
                .endClass ()
@@ -776,6 +836,8 @@ LuaBindings::common (lua_State* L)
                .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name)
                .endClass ()
 
+               .beginStdVector <boost::shared_ptr<ARDOUR::Processor> > ("ProcessorVector").endClass ()
+
                .deriveWSPtrClass <Processor, SessionObject> ("Processor")
                .addCast<Automatable> ("to_automatable")
                .addCast<PluginInsert> ("to_insert")
@@ -783,8 +845,8 @@ LuaBindings::common (lua_State* L)
                .addCast<IOProcessor> ("to_ioprocessor")
                .addCast<UnknownProcessor> ("to_unknownprocessor")
                .addCast<Amp> ("to_amp")
-#if 0 // those objects are not yet bound
                .addCast<MonitorProcessor> ("to_monitorprocessor")
+#if 0 // those objects are not yet bound
                .addCast<CapturingProcessor> ("to_capturingprocessor")
                .addCast<DelayLine> ("to_delayline")
                .addCast<PeakMeter> ("to_meter")
@@ -819,6 +881,7 @@ LuaBindings::common (lua_State* L)
                .addFunction ("load_preset", &Plugin::load_preset)
                .addFunction ("parameter_is_input", &Plugin::parameter_is_input)
                .addFunction ("get_docs", &Plugin::get_docs)
+               .addFunction ("get_info", &Plugin::get_info)
                .addFunction ("get_parameter_docs", &Plugin::get_parameter_docs)
                .addRefFunction ("get_parameter_descriptor", &Plugin::get_parameter_descriptor)
                .endClass ()
@@ -892,6 +955,35 @@ LuaBindings::common (lua_State* L)
                .addFunction ("gain_control", (boost::shared_ptr<GainControl>(Amp::*)())&Amp::gain_control)
                .endClass ()
 
+               .deriveWSPtrClass <MonitorProcessor, Processor> ("MonitorProcessor")
+               .addFunction ("set_cut_all", &MonitorProcessor::set_cut_all)
+               .addFunction ("set_dim_all", &MonitorProcessor::set_dim_all)
+               .addFunction ("set_polarity", &MonitorProcessor::set_polarity)
+               .addFunction ("set_cut", &MonitorProcessor::set_cut)
+               .addFunction ("set_dim", &MonitorProcessor::set_dim)
+               .addFunction ("set_solo", &MonitorProcessor::set_solo)
+               .addFunction ("set_mono", &MonitorProcessor::set_mono)
+               .addFunction ("dim_level", &MonitorProcessor::dim_level)
+               .addFunction ("solo_boost_level", &MonitorProcessor::solo_boost_level)
+               .addFunction ("dimmed", &MonitorProcessor::dimmed)
+               .addFunction ("soloed", &MonitorProcessor::soloed)
+               .addFunction ("inverted", &MonitorProcessor::inverted)
+               .addFunction ("cut", &MonitorProcessor::cut)
+               .addFunction ("cut_all", &MonitorProcessor::cut_all)
+               .addFunction ("dim_all", &MonitorProcessor::dim_all)
+               .addFunction ("mono", &MonitorProcessor::mono)
+               .addFunction ("monitor_active", &MonitorProcessor::monitor_active)
+               .addFunction ("channel_cut_control", &MonitorProcessor::channel_cut_control)
+               .addFunction ("channel_dim_control", &MonitorProcessor::channel_dim_control)
+               .addFunction ("channel_polarity_control", &MonitorProcessor::channel_polarity_control)
+               .addFunction ("channel_solo_control", &MonitorProcessor::channel_solo_control)
+               .addFunction ("dim_control", &MonitorProcessor::dim_control)
+               .addFunction ("cut_control", &MonitorProcessor::cut_control)
+               .addFunction ("mono_control", &MonitorProcessor::mono_control)
+               .addFunction ("dim_level_control", &MonitorProcessor::dim_level_control)
+               .addFunction ("solo_boost_control", &MonitorProcessor::solo_boost_control)
+               .endClass ()
+
                .deriveWSPtrClass <UnknownProcessor, Processor> ("UnknownProcessor")
                .endClass ()
 
@@ -1109,6 +1201,34 @@ LuaBindings::common (lua_State* L)
                .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered))
                .addConst ("Destructive", ARDOUR::TrackMode(Destructive))
                .endNamespace ()
+
+               .beginNamespace ("SampleFormat")
+               .addConst ("Float", ARDOUR::SampleFormat(FormatFloat))
+               .addConst ("Int24", ARDOUR::SampleFormat(FormatInt24))
+               .addConst ("Int16", ARDOUR::SampleFormat(FormatInt16))
+               .endNamespace ()
+
+               .beginNamespace ("HeaderFormat")
+               .addConst ("BWF", ARDOUR::HeaderFormat(BWF))
+               .addConst ("WAVE", ARDOUR::HeaderFormat(WAVE))
+               .addConst ("WAVE64", ARDOUR::HeaderFormat(WAVE64))
+               .addConst ("CAF", ARDOUR::HeaderFormat(CAF))
+               .addConst ("AIFF", ARDOUR::HeaderFormat(AIFF))
+               .addConst ("iXML", ARDOUR::HeaderFormat(iXML))
+               .addConst ("RF64", ARDOUR::HeaderFormat(RF64))
+               .addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
+               .addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
+               .endNamespace ()
+
+               .beginNamespace ("InsertMergePolicy")
+               .addConst ("Reject", ARDOUR::InsertMergePolicy(InsertMergeReject))
+               .addConst ("Relax", ARDOUR::InsertMergePolicy(InsertMergeRelax))
+               .addConst ("Replace", ARDOUR::InsertMergePolicy(InsertMergeReplace))
+               .addConst ("TruncateExisting", ARDOUR::InsertMergePolicy(InsertMergeTruncateExisting))
+               .addConst ("TruncateAddition", ARDOUR::InsertMergePolicy(InsertMergeTruncateAddition))
+               .addConst ("Extend", ARDOUR::InsertMergePolicy(InsertMergeExtend))
+               .endNamespace ()
+
                .endNamespace (); // end ARDOUR
 
        luabridge::getGlobalNamespace (L)
@@ -1380,6 +1500,20 @@ LuaBindings::dsp (lua_State* L)
                .endClass ()
                .endNamespace ();
 
+       luabridge::getGlobalNamespace (L)
+               .beginNamespace ("ARDOUR")
+               .beginClass <FluidSynth> ("FluidSynth")
+               .addConstructor <void (*) (float, int)> ()
+               .addFunction ("load_sf2", &FluidSynth::load_sf2)
+               .addFunction ("synth", &FluidSynth::synth)
+               .addFunction ("midi_event", &FluidSynth::midi_event)
+               .addFunction ("panic", &FluidSynth::panic)
+               .addFunction ("select_program", &FluidSynth::select_program)
+               .addFunction ("program_count", &FluidSynth::program_count)
+               .addFunction ("program_name", &FluidSynth::program_name)
+               .endClass ()
+               .endNamespace ();
+
        luabridge::getGlobalNamespace (L)
                .beginNamespace ("ARDOUR")
                .beginNamespace ("DSP")
@@ -1466,7 +1600,7 @@ LuaBindings::session (lua_State* L)
                .addFunction ("set_dirty", &Session::set_dirty)
                .addFunction ("unknown_processors", &Session::unknown_processors)
 
-               .addFunction<RouteList (Session::*)(uint32_t, const std::string&, const std::string&, PlaylistDisposition)> ("new_route_from_template", &Session::new_route_from_template)
+               .addFunction<RouteList (Session::*)(uint32_t, PresentationInfo::order_t, const std::string&, const std::string&, PlaylistDisposition)> ("new_route_from_template", &Session::new_route_from_template)
                // TODO  session_add_audio_track  session_add_midi_track  session_add_mixed_track
                //.addFunction ("new_midi_track", &Session::new_midi_track)
                .endClass ()