675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm.h>
+
#include "timecode/bbt_time.h"
+#include "pbd/stateful_diff_command.h"
#include "evoral/Control.hpp"
#include "evoral/ControlList.hpp"
+#include "evoral/Range.hpp"
+#include "ardour/amp.h"
#include "ardour/audioengine.h"
#include "ardour/audiosource.h"
#include "ardour/audio_backend.h"
#include "ardour/audio_buffer.h"
+#include "ardour/audio_port.h"
#include "ardour/audio_track.h"
#include "ardour/buffer_set.h"
#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/luaproc.h"
#include "ardour/meter.h"
#include "ardour/midi_track.h"
+#include "ardour/midi_port.h"
+#include "ardour/playlist.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/runtime_functions.h"
#include "ardour/region_factory.h"
#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"
+#ifdef PLATFORM_WINDOWS
+/* luabridge uses addresses of static functions/variables to identify classes.
+ *
+ * Static symbols on windows (even identical symbols) are not
+ * mapped to the same address when mixing .dll + .exe.
+ * So we need a single point to define those static functions.
+ * (normally they're header-only in libs/lua/LuaBridge/detail/ClassInfo.h)
+ *
+ * Really!! A static function with a static variable in a library header
+ * should never ever be replicated, even if it is a template.
+ * But then again this is windows... what else can go wrong.
+ */
+
+template <class T>
+void const*
+luabridge::ClassInfo<T>::getStaticKey ()
+{
+ static char value;
+ return &value;
+}
+
+template <class T>
+void const*
+luabridge::ClassInfo<T>::getClassKey ()
+{
+ static char value;
+ return &value;
+}
+
+template <class T>
+void const*
+luabridge::ClassInfo<T>::getConstKey ()
+{
+ static char value;
+ return &value;
+}
+
+void*
+luabridge::getIdentityKey ()
+{
+ static char value;
+ return &value;
+}
+
+/* ...and this is the ugly part of it.
+ *
+ * We need to foward declare classes from gtk2_ardour
+ * end explicily list classes which are used by gtk2_ardour's bindings.
+ *
+ * This is needed because some of the GUI classes use objects from libardour
+ * as function parameters and the .exe would re-create symbols for libardour
+ * objects.
+ *
+ * Classes which don't use libardour symbols could be moved to
+ * gtk2_ardour/luainstance.cc, but keeping this here reduces code
+ * duplication and does not give the compiler a chance to even think
+ * about replicating the symbols.
+ */
+
+#define CLASSKEYS(CLS) \
+ template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
+ template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
+ template void const* luabridge::ClassInfo< CLS >::getConstKey();
+
+#define CLASSINFO(CLS) \
+ class CLS; \
+ template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
+ template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
+ template void const* luabridge::ClassInfo< CLS >::getConstKey();
+
+CLASSINFO(MarkerSelection);
+CLASSINFO(TrackSelection);
+CLASSINFO(TrackViewList);
+CLASSINFO(TimeSelection);
+CLASSINFO(RegionSelection);
+CLASSINFO(PublicEditor);
+CLASSINFO(Selection);
+CLASSINFO(ArdourMarker);
+
+namespace Cairo {
+ class Context;
+}
+CLASSKEYS(Cairo::Context);
+CLASSKEYS(std::vector<double>);
+CLASSKEYS(std::list<ArdourMarker*>);
+CLASSKEYS(std::bitset<47ul>); // LuaSignal::LAST_SIGNAL
+CLASSKEYS(ArdourMarker*);
+CLASSKEYS(ARDOUR::RouteGroup);
+CLASSKEYS(ARDOUR::LuaProc);
+CLASSKEYS(ARDOUR::DataType);
+CLASSKEYS(ARDOUR::ChanCount);
+CLASSKEYS(boost::shared_ptr<ARDOUR::Processor>);
+CLASSKEYS(ARDOUR::ParameterDescriptor);
+CLASSKEYS(boost::shared_ptr<ARDOUR::AutomationList>);
+CLASSKEYS(boost::shared_ptr<Evoral::ControlList>);
+CLASSKEYS(ARDOUR::LuaOSC::Address);
+CLASSKEYS(ARDOUR::Session);
+CLASSKEYS(ARDOUR::BufferSet);
+CLASSKEYS(ARDOUR::ChanMapping);
+CLASSKEYS(ARDOUR::DSP::DspShm);
+CLASSKEYS(PBD::ID);
+CLASSKEYS(ARDOUR::Location);
+CLASSKEYS(ARDOUR::PluginInfo);
+CLASSKEYS(PBD::PropertyChange);
+CLASSKEYS(std::vector<std::string>);
+CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
+CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
+CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
+CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
+CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Region> >);
+CLASSKEYS(std::list<ARDOUR::AudioRange>);
+CLASSKEYS(Evoral::Beats);
+CLASSKEYS(ARDOUR::AudioEngine);
+CLASSKEYS(void);
+CLASSKEYS(float);
+
+#endif // end windows special case
+
/* Some notes on Lua bindings for libardour and friends
*
* - Prefer factory methods over Contructors whenever possible.
{
// std::list<std::string>
luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR")
+ .beginNamespace ("C")
.beginStdList <std::string> ("StringList")
.endClass ()
- .endNamespace ();
// std::vector<std::string>
- luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR")
.beginStdVector <std::string> ("StringVector")
.endClass ()
- .endNamespace ();
// register float array (float*)
- luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR")
.registerArray <float> ("FloatArray")
- .endNamespace ();
// register float array (int32_t*)
- luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR")
.registerArray <int32_t> ("IntArray")
- .endNamespace ();
-
- // std::vector<std::string>
- luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR")
- .beginStdVector <double> ("DoubleVector")
- .endClass ()
- .endNamespace ();
// TODO std::set
+ .endNamespace ();
}
void
.addFunction ("to_s", &PBD::ID::to_s) // TODO special case LUA __tostring ?
.endClass ()
- .beginWSPtrClass <PBD::Stateful> ("Stateful")
+ .beginClass <XMLNode> ("XMLNode")
+ .addFunction ("name", &XMLNode::name)
+ .endClass ()
+
+ .beginClass <PBD::Stateful> ("Stateful")
.addFunction ("properties", &PBD::Stateful::properties)
+ .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
.endClass ()
- .deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructible")
+ .beginWSPtrClass <PBD::Stateful> ("StatefulPtr")
+ .addFunction ("properties", &PBD::Stateful::properties)
+ .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
+ .endClass ()
+
+ .deriveClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructible")
+ .endClass ()
+
+ .deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructiblePtr")
+ .endClass ()
+
+ .deriveClass <Command, PBD::StatefulDestructible> ("Command")
+ .addFunction ("set_name", &Command::set_name)
+ .addFunction ("name", &Command::name)
+ .endClass ()
+
+ /* UndoTransaction::add_command() subscribes to DropReferences()
+ * and deletes the object.
+ *
+ * This object cannot be constructed by lua because lua would manage lifetime
+ * and delete the object leading to a double free.
+ *
+ * use Session::add_stateful_diff_command()
+ * and Session::abort_reversible_command()
+ */
+ .deriveClass <PBD::StatefulDiffCommand, Command> ("StatefulDiffCommand")
+ .addFunction ("undo", &PBD::StatefulDiffCommand::undo)
+ .addFunction ("empty", &PBD::StatefulDiffCommand::empty)
.endClass ()
.deriveWSPtrClass <PBD::Controllable, PBD::StatefulDestructible> ("Controllable")
+ .addFunction ("name", &PBD::Controllable::name)
.addFunction ("get_value", &PBD::Controllable::get_value)
.endClass ()
.addConst ("UseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::UseGroup))
.endNamespace ()
- .endNamespace ();
+ .endNamespace (); // PBD
luabridge::getGlobalNamespace (L)
- .beginNamespace ("ARDOUR") // XXX really libtimecode
+ .beginNamespace ("Timecode")
.beginClass <Timecode::BBT_Time> ("BBT_TIME")
.addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
.endClass ()
.endNamespace ();
luabridge::getGlobalNamespace (L)
+
+ .beginNamespace ("Evoral")
+ .beginClass <Evoral::Parameter> ("Parameter")
+ .addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
+ .addFunction ("type", &Evoral::Parameter::type)
+ .addFunction ("channel", &Evoral::Parameter::channel)
+ .addFunction ("id", &Evoral::Parameter::id)
+ .endClass ()
+
+ .beginWSPtrClass <Evoral::ControlList> ("ControlList")
+ .addFunction ("add", &Evoral::ControlList::add)
+ .addFunction ("thin", &Evoral::ControlList::thin)
+ .addFunction ("eval", &Evoral::ControlList::eval)
+ .addRefFunction ("rt_safe_eval", &Evoral::ControlList::rt_safe_eval)
+ .addFunction ("interpolation", &Evoral::ControlList::interpolation)
+ .addFunction ("set_interpolation", &Evoral::ControlList::set_interpolation)
+ .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 ("in_write_pass", &Evoral::ControlList::in_write_pass)
+ .endClass ()
+
+ .beginWSPtrClass <Evoral::ControlSet> ("ControlSet")
+ .endClass ()
+
+ .beginWSPtrClass <Evoral::Control> ("Control")
+ .addFunction ("list", (boost::shared_ptr<Evoral::ControlList>(Evoral::Control::*)())&Evoral::Control::list)
+ .endClass ()
+
+ .beginClass <Evoral::ParameterDescriptor> ("ParameterDescriptor")
+ .addVoidConstructor ()
+ .addData ("lower", &Evoral::ParameterDescriptor::lower)
+ .addData ("upper", &Evoral::ParameterDescriptor::upper)
+ .addData ("normal", &Evoral::ParameterDescriptor::normal)
+ .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
+ .endClass ()
+
+ .beginClass <Evoral::Range<framepos_t> > ("Range")
+ .addConstructor <void (*) (framepos_t, framepos_t)> ()
+ .addData ("from", &Evoral::Range<framepos_t>::from)
+ .addData ("to", &Evoral::Range<framepos_t>::to)
+ .endClass ()
+
+ /* libevoral enums */
+ .beginNamespace ("InterpolationStyle")
+ .addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete))
+ .addConst ("Linear", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Linear))
+ .addConst ("Curved", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Curved))
+ .endNamespace ()
+
+ .endNamespace () // Evoral
+
.beginNamespace ("ARDOUR")
+
+ .beginClass <InterThreadInfo> ("InterThreadInfo")
+ .addVoidConstructor ()
+ .addData ("done", const_cast<bool InterThreadInfo::*>(&InterThreadInfo::done))
+ .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel)
+ .addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress))
+ .endClass ()
+
+ .beginClass <AudioRange> ("AudioRange")
+ .addConstructor <void (*) (framepos_t, framepos_t, uint32_t)> ()
+ .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> ("PluginInfo")
.addVoidConstructor ()
.endClass ()
.endClass ()
.endNamespace ()
+ .beginClass <ChanMapping> ("ChanMapping")
+ .addVoidConstructor ()
+ .addFunction ("get", static_cast<uint32_t(ChanMapping::*)(DataType, uint32_t) const>(&ChanMapping::get))
+ .addFunction ("set", &ChanMapping::set)
+ .addConst ("Invalid", 4294967295) // UINT32_MAX
+ .endClass ()
+
.beginNamespace ("Properties")
// templated class definitions
.beginClass <PBD::PropertyDescriptor<bool> > ("BoolProperty").endClass ()
.deriveClass <PBD::OwnedPropertyList, PBD::PropertyList> ("OwnedPropertyList")
.endClass ()
- .deriveWSPtrClass <SessionObject, PBD::StatefulDestructible> ("SessionObject")
+ .beginWSPtrClass <AutomationList> ("AutomationList")
+ .addCast<PBD::Stateful> ("to_stateful")
+ .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
+ .addCast<Evoral::ControlList> ("list")
+ .addFunction ("get_state", &AutomationList::get_state)
+ .addFunction ("memento_command", &AutomationList::memento_command)
+ .addFunction ("touching", &AutomationList::touching)
+ .addFunction ("writing", &AutomationList::writing)
+ .addFunction ("touch_enabled", &AutomationList::touch_enabled)
+ .endClass ()
+
+ .deriveClass <Location, PBD::StatefulDestructible> ("Location")
+ .addFunction ("locked", &Location::locked)
+ .addFunction ("lock", &Location::lock)
+ .addFunction ("start", &Location::start)
+ .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)
+ .addFunction ("set_length", &Location::set)
+ .addFunction ("move_to", &Location::move_to)
+ .endClass ()
+
+ .deriveClass <Locations, PBD::StatefulDestructible> ("Locations")
+ .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 ()
+
+ .beginWSPtrClass <SessionObject> ("SessionObject")
+ /* SessionObject is-a PBD::StatefulDestructible,
+ * but multiple inheritance is not covered by luabridge,
+ * we need explicit casts */
+ .addCast<PBD::Stateful> ("to_stateful")
+ .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
.addFunction ("name", &SessionObject::name)
.endClass ()
+ .beginWSPtrClass <Port> ("Port")
+ .addFunction ("name", &Port::name)
+ .addFunction ("pretty_name", &Port::pretty_name)
+ .addFunction ("receives_input", &Port::receives_input)
+ .addFunction ("sends_output", &Port::sends_output)
+ .addFunction ("connected", &Port::connected)
+ .addFunction ("disconnect_all", &Port::disconnect_all)
+ .addFunction ("connected_to_name", (bool (Port::*)(std::string const &)const)&Port::connected_to)
+ .addFunction ("connect_by_name", (int (Port::*)(std::string const &))&Port::connect)
+ .addFunction ("disconnect_by_name", (int (Port::*)(std::string const &))&Port::disconnect)
+ .addFunction ("connected_to", (bool (Port::*)(Port*)const)&Port::connected_to)
+ .addFunction ("connect", (int (Port::*)(Port*))&Port::connect)
+ .addFunction ("disconnect", (int (Port::*)(Port*))&Port::disconnect)
+ .endClass ()
+
+ .deriveWSPtrClass <AudioPort, Port> ("AudioPort")
+ .endClass ()
+
+ .deriveWSPtrClass <MidiPort, Port> ("MidiPort")
+ .addFunction ("input_active", &MidiPort::input_active)
+ .addFunction ("set_input_active", &MidiPort::set_input_active)
+ .endClass ()
+
+ .beginWSPtrClass <PortSet> ("PortSet")
+ .addFunction ("num_ports", (size_t (PortSet::*)(DataType)const)&PortSet::num_ports)
+ .addFunction ("add", &PortSet::add)
+ .addFunction ("remove", &PortSet::remove)
+ .addFunction ("port", (boost::shared_ptr<Port> (PortSet::*)(DataType, size_t)const)&PortSet::port)
+ .addFunction ("contains", &PortSet::contains)
+ .addFunction ("clear", &PortSet::clear)
+ .addFunction ("empty", &PortSet::empty)
+ .endClass ()
+
+ .deriveWSPtrClass <IO, SessionObject> ("IO")
+ .addFunction ("active", &IO::active)
+ .addFunction ("add_port", &IO::add_port)
+ .addFunction ("remove_port", &IO::remove_port)
+ .addFunction ("connect", &IO::connect)
+ .addFunction ("disconnect", (int (IO::*)(boost::shared_ptr<Port>, std::string, void *))&IO::disconnect)
+ .addFunction ("physically_connected", &IO::physically_connected)
+ .addFunction ("has_port", &IO::has_port)
+ .addFunction ("nth", &IO::nth)
+ .addFunction ("audio", &IO::audio)
+ .addFunction ("midi", &IO::midi)
+ .addFunction ("port_by_name", &IO::nth)
+ .addFunction ("n_ports", &IO::n_ports)
+ .endClass ()
+
.deriveWSPtrClass <Route, SessionObject> ("Route")
+ .addCast<Track> ("to_track")
.addFunction ("set_name", &Route::set_name)
.addFunction ("comment", &Route::comment)
.addFunction ("active", &Route::active)
.addFunction ("n_inputs", &Route::n_inputs)
.addFunction ("n_outputs", &Route::n_outputs)
.addFunction ("set_comment", &Route::set_comment)
+ .addFunction ("strict_io", &Route::strict_io)
+ .addFunction ("set_strict_io", &Route::set_strict_io)
+ .addFunction ("reset_plugin_insert", &Route::reset_plugin_insert)
+ .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)
+ .addFunction ("amp", &Route::amp)
+ .addFunction ("trim", &Route::trim)
+ .endClass ()
+
+ .deriveWSPtrClass <Playlist, SessionObject> ("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<framepos_t, framepos_t>
+ //.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_touched", &Playlist::regions_touched)
+ .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<Region>, 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> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
+#if 0
+ .addFunction ("copy", &Playlist::copy)
+ .addFunction ("paste", &Playlist::paste)
+#endif
.endClass ()
.deriveWSPtrClass <Track, Route> ("Track")
+ .addCast<AudioTrack> ("to_audio_track")
+ .addCast<MidiTrack> ("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)
+ .addFunction ("bounce_range", &Track::bounce_range)
+ .addFunction ("playlist", &Track::playlist)
.endClass ()
.deriveWSPtrClass <AudioTrack, Track> ("AudioTrack")
.addFunction ("data_type", &Region::data_type)
.addFunction ("stretch", &Region::stretch)
.addFunction ("shift", &Region::shift)
- .addFunction ("sync_offset", &Region::sync_offset)
+ .addRefFunction ("sync_offset", &Region::sync_offset)
.addFunction ("sync_position", &Region::sync_position)
.addFunction ("hidden", &Region::hidden)
.addFunction ("muted", &Region::muted)
.beginWSPtrClass <Source> ("Source")
.endClass ()
- .beginClass <Evoral::Parameter> ("EvoralParameter")
- .addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
- .addFunction ("type", &Evoral::Parameter::type)
- .addFunction ("channel", &Evoral::Parameter::channel)
- .addFunction ("id", &Evoral::Parameter::id)
- .endClass ()
-
.beginClass <Plugin::PresetRecord> ("PresetRecord")
.addData ("uri", &Plugin::PresetRecord::uri, false)
.addData ("label", &Plugin::PresetRecord::label, false)
.addData ("valid", &Plugin::PresetRecord::valid, false)
.endClass ()
- .beginWSPtrClass <Evoral::ControlList> ("EvoralControlList")
- .addFunction ("add", &Evoral::ControlList::add)
- .endClass ()
-
- .beginWSPtrClass <Evoral::ControlSet> ("EvoralControlSet")
- .endClass ()
-
.deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
.addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
.endClass ()
- .beginWSPtrClass <Evoral::Control> ("EvoralControl")
- .addFunction ("list", (boost::shared_ptr<Evoral::ControlList>(Evoral::Control::*)())&Evoral::Control::list)
- .endClass ()
-
- .beginClass <Evoral::ParameterDescriptor> ("EvoralParameterDescriptor")
- .addVoidConstructor ()
- .addData ("lower", &Evoral::ParameterDescriptor::lower)
- .addData ("upper", &Evoral::ParameterDescriptor::upper)
- .addData ("normal", &Evoral::ParameterDescriptor::normal)
- .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
- .endClass ()
-
.deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
.addVoidConstructor ()
.addData ("label", &ParameterDescriptor::label)
.endClass ()
.deriveWSPtrClass <Processor, SessionObject> ("Processor")
- // TODO mult. inheritance
- .endClass ()
-
- .deriveWSPtrClass <Processor, Automatable> ("Processor")
+ .addCast<Automatable> ("to_automatable")
.addCast<PluginInsert> ("to_insert")
+ .addCast<SideChain> ("to_sidechain")
+ .addCast<IOProcessor> ("to_ioprocessor")
.addFunction ("display_name", &Processor::display_name)
.addFunction ("active", &Processor::active)
.addFunction ("activate", &Processor::activate)
.addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
.endClass ()
- .deriveWSPtrClass <Plugin, PBD::StatefulDestructible> ("PluginInsert")
+ .deriveWSPtrClass <IOProcessor, Processor> ("IOProcessor")
+ .addFunction ("natural_input_streams", &IOProcessor::natural_input_streams)
+ .addFunction ("natural_output_streams", &IOProcessor::natural_output_streams)
+ .addFunction ("input", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::input)
+ .addFunction ("output", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::output)
+ .endClass ()
+
+ .deriveWSPtrClass <SideChain, IOProcessor> ("SideChain")
+ .endClass ()
+
+ .deriveWSPtrClass <Delivery, IOProcessor> ("Delivery")
+ .endClass ()
+
+ .deriveWSPtrClass <Plugin, PBD::StatefulDestructible> ("Plugin")
.addFunction ("label", &Plugin::label)
.addFunction ("name", &Plugin::name)
.addFunction ("maker", &Plugin::maker)
.addFunction ("parameter_count", &Plugin::parameter_count)
- .addFunction ("nth_parameter", &Plugin::nth_parameter)
+ .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 ("plugin", &PluginInsert::plugin)
.addFunction ("activate", &PluginInsert::activate)
.addFunction ("deactivate", &PluginInsert::deactivate)
+ .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)
+ .addFunction ("set_input_map", &PluginInsert::set_input_map)
+ .addFunction ("set_output_map", &PluginInsert::set_output_map)
+ .addFunction ("sidechain_input", &PluginInsert::sidechain_input)
.endClass ()
- .deriveWSPtrClass <AutomationControl, Evoral::Control> ("AutomationControl")
+ .deriveWSPtrClass <AutomationControl, PBD::Controllable> ("AutomationControl")
+ .addCast<Evoral::Control> ("to_ctrl")
.addFunction ("automation_state", &AutomationControl::automation_state)
.addFunction ("automation_style", &AutomationControl::automation_style)
.addFunction ("set_automation_state", &AutomationControl::set_automation_state)
.addFunction ("get_value", &AutomationControl::get_value)
.addFunction ("set_value", &AutomationControl::set_value)
.addFunction ("writable", &AutomationControl::writable)
+ .addFunction ("alist", &AutomationControl::alist)
+ .endClass ()
+
+ .deriveWSPtrClass <GainControl, AutomationControl> ("GainControl")
+ .endClass ()
+
+ .deriveWSPtrClass <Amp, Processor> ("Amp")
+ .addFunction ("gain_control", (boost::shared_ptr<GainControl>(Amp::*)())&Amp::gain_control)
.endClass ()
.deriveWSPtrClass <PluginInsert::PluginControl, AutomationControl> ("PluginControl")
.addFunction ("n_channels", &AudioSource::n_channels)
.endClass ()
- // <std::list<boost::shared_ptr <AudioTrack> >
+ // <std::list<boost::shared_ptr <AudioTrack> >
.beginStdList <boost::shared_ptr<AudioTrack> > ("AudioTrackList")
.endClass ()
- // std::list<boost::shared_ptr <MidiTrack> >
+ // std::list<boost::shared_ptr <MidiTrack> >
.beginStdList <boost::shared_ptr<MidiTrack> > ("MidiTrackList")
.endClass ()
- // RouteList == boost::shared_ptr<std::list<boost::shared_ptr<Route> > >
+ // RouteList == std::list<boost::shared_ptr<Route> >
+ .beginConstStdList <boost::shared_ptr<Route> > ("RouteList")
+ .endClass ()
+
+ // boost::shared_ptr<RouteList>
.beginPtrStdList <boost::shared_ptr<Route> > ("RouteListPtr")
.endClass ()
- // typedef std::list<boost::weak_ptr <Route> > WeakRouteList
+ // typedef std::list<boost::weak_ptr <Route> > WeakRouteList
.beginConstStdList <boost::weak_ptr<Route> > ("WeakRouteList")
.endClass ()
- // std::list< boost::weak_ptr <AudioSource>
+ // std::list< boost::weak_ptr <AudioSource> >
.beginConstStdList <boost::weak_ptr<AudioSource> > ("WeakAudioSourceList")
.endClass ()
+ // typedef std::list<boost::shared_ptr<Region> > RegionList
+ .beginConstStdList <boost::shared_ptr<Region> > ("RegionList")
+ .endClass ()
+
+ // boost::shared_ptr <std::list<boost::shared_ptr<Region> > >
+ .beginPtrStdList <boost::shared_ptr<Region> > ("RegionListPtr")
+ .endClass ()
+
+ // used by Playlist::cut/copy
+ .beginConstStdList <AudioRange> ("AudioRangeList")
+ .endClass ()
+
+ .beginConstStdList <Location*> ("LocationList")
+ .endClass ()
+
#if 0 // depends on Evoal:: Note, Beats see note_fixer.h
// typedef Evoral::Note<Evoral::Beats> Note;
// std::set< boost::weak_ptr<Note> >
.endClass ()
#endif
- // typedef std::set<boost::weak_ptr<AudioPort> > PortSet
- .beginStdSet <boost::weak_ptr<AudioPort> > ("WeakPortSet")
- .endClass ()
-
// std::list<boost::weak_ptr<Source> >
.beginConstStdList <boost::weak_ptr<Source> > ("WeakSourceList")
.endClass ()
.endClass ()
.beginClass <ChanCount> ("ChanCount")
+ .addConstructor <void (*) (DataType, uint32_t)> ()
+ .addFunction ("get", &ChanCount::get)
+ .addFunction ("set", &ChanCount::set)
.addFunction ("n_audio", &ChanCount::n_audio)
+ .addFunction ("n_midi", &ChanCount::n_midi)
+ .addFunction ("n_total", &ChanCount::n_total)
+ .addFunction ("reset", &ChanCount::reset)
.endClass()
.beginClass <DataType> ("DataType")
.addConstructor <void (*) (std::string)> ()
+ .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 Lua __tostring
+ // TODO add uint32_t cast, add operator== !=
.endClass()
/* libardour enums */
.addConst ("Lua", ARDOUR::PluginType(Lua))
.endNamespace ()
- .beginNamespace ("Autostyle")
- .addConst ("Absolute", ARDOUR::AutoState(Absolute))
- .addConst ("Trim", ARDOUR::AutoState(Trim))
+ .beginNamespace ("AutoStyle")
+ .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
+ .addConst ("Trim", ARDOUR::AutoStyle(Trim))
.endNamespace ()
.beginNamespace ("AutoState")
.beginNamespace ("AutomationType")
.addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation))
+ .addConst ("PluginAutomation", ARDOUR::AutomationType(GainAutomation))
+ .addConst ("PluginAutomation", ARDOUR::AutomationType(TrimAutomation))
.endNamespace ()
.beginNamespace ("SrcQuality")
.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)
.endClass()
.beginStdVector <const AudioBackendInfo*> ("BackendVector").endClass ()
- .beginNamespace ("ARDOUR")
.beginClass <AudioBackend::DeviceStatus> ("DeviceStatus")
.addData ("name", &AudioBackend::DeviceStatus::name)
.addData ("available", &AudioBackend::DeviceStatus::available)
.endClass()
.beginStdVector <AudioBackend::DeviceStatus> ("DeviceStatusVector").endClass ()
- .endNamespace ()
.beginWSPtrClass <AudioBackend> ("AudioBackend")
.addFunction ("info", &AudioBackend::info)
.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)
+ .addFunction ("begin_reversible_command", (void (Session::*)(const std::string&))&Session::begin_reversible_command)
+ .addFunction ("commit_reversible_command", &Session::commit_reversible_command)
+ .addFunction ("abort_reversible_command", &Session::abort_reversible_command)
+ .addFunction ("add_command", &Session::add_command)
+ .addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command)
.endClass ()
.beginClass <RegionFactory> ("RegionFactory")
.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)
.addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
.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
.beginNamespace ("ARDOUR")
.beginClass <AudioBuffer> ("AudioBuffer")
+ .addEqualCheck ()
.addFunction ("data", (Sample*(AudioBuffer::*)(framecnt_t))&AudioBuffer::data)
.addFunction ("silence", &AudioBuffer::silence)
.addFunction ("apply_gain", &AudioBuffer::apply_gain)
+ .addFunction ("check_silence", &AudioBuffer::check_silence)
+ .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, framecnt_t, framecnt_t, framecnt_t))&AudioBuffer::check_silence)
.endClass()
.beginClass <MidiBuffer> ("MidiBuffer")
+ .addEqualCheck ()
.addFunction ("silence", &MidiBuffer::silence)
.addFunction ("empty", &MidiBuffer::empty)
// TODO iterators..
.endClass()
.beginClass <BufferSet> ("BufferSet")
+ .addEqualCheck ()
.addFunction ("get_audio", static_cast<AudioBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_audio))
.addFunction ("count", static_cast<const ChanCount&(BufferSet::*)()const>(&BufferSet::count))
.endClass()
-
- .beginClass <ChanMapping> ("ChanMapping")
- .addFunction ("get", static_cast<uint32_t(ChanMapping::*)(DataType, uint32_t)>(&ChanMapping::get))
- .addFunction ("set", &ChanMapping::set)
- .addConst ("Invalid", 4294967295) // UINT32_MAX
- .endClass ()
.endNamespace ();
luabridge::getGlobalNamespace (L)
.addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
.endClass ()
+ .beginClass <Evoral::Beats> ("Beats")
+ .addFunction ("to_double", &Evoral::Beats::to_double)
+ .endClass ()
+
.deriveClass <Evoral::MIDIEvent<framepos_t>, Evoral::Event<framepos_t> > ("MidiEvent")
// add Ctor?
.addFunction ("type", &Evoral::MIDIEvent<framepos_t>::type)
.addFunction ("reset", &DSP::BiQuad::reset)
.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)
+ .endNamespace ()
+
.beginClass <DSP::DspShm> ("DspShm")
.addFunction ("allocate", &DSP::DspShm::allocate)
.addFunction ("clear", &DSP::DspShm::clear)
LuaBindings::osc (lua_State* L)
{
luabridge::getGlobalNamespace (L)
- .beginNamespace ("OSC")
- .beginClass<LuaAPI::LuaOSCAddress> ("Address")
+ .beginNamespace ("ARDOUR")
+ .beginNamespace ("LuaOSC")
+ .beginClass<LuaOSC::Address> ("Address")
.addConstructor<void (*) (std::string)> ()
- .addCFunction ("send", &LuaAPI::LuaOSCAddress::send)
+ .addCFunction ("send", &LuaOSC::Address::send)
.endClass ()
+ .endNamespace ()
.endNamespace ();
}