X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fluabindings.cc;h=0bbfb11624cbd164e55119d73cd4eda20307a2e6;hb=c8c6bca6587450ff64303dbc994a4cd28d6ce7aa;hp=0ad43ddad3afe64fa81683ebd9193d7aee9ddc4b;hpb=dffdee85a0c2e164fa9dfb853013dd4bb4135510;p=ardour.git diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 0ad43ddad3..0bbfb11624 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -16,34 +16,182 @@ 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + #include "timecode/bbt_time.h" +#include "pbd/stateful_diff_command.h" +#include "pbd/openuri.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/phase_control.h" +#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" +#include "ardour/solo_isolate_control.h" +#include "ardour/solo_safe_control.h" +#include "ardour/stripable.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 +void const* +luabridge::ClassInfo::getStaticKey () +{ + static char value; + return &value; +} + +template +void const* +luabridge::ClassInfo::getClassKey () +{ + static char value; + return &value; +} + +template +void const* +luabridge::ClassInfo::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 LuaCairo { + class ImageSurface; + class PangoLayout; +} +CLASSKEYS(LuaCairo::ImageSurface); +CLASSKEYS(LuaCairo::PangoLayout); + +namespace Cairo { + class Context; +} +CLASSKEYS(Cairo::Context); +CLASSKEYS(std::vector); +CLASSKEYS(std::list); +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); +CLASSKEYS(ARDOUR::ParameterDescriptor); +CLASSKEYS(boost::shared_ptr); +CLASSKEYS(boost::shared_ptr); +CLASSKEYS(ARDOUR::LuaOSC::Address); +CLASSKEYS(ARDOUR::Session); +CLASSKEYS(ARDOUR::BufferSet); +CLASSKEYS(ARDOUR::ChanMapping); +CLASSKEYS(ARDOUR::DSP::DspShm); +CLASSKEYS(ARDOUR::LuaTableRef); +CLASSKEYS(PBD::ID); +CLASSKEYS(ARDOUR::Location); +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); + +#endif // end windows special case + /* Some notes on Lua bindings for libardour and friends * * - Prefer factory methods over Contructors whenever possible. @@ -72,38 +220,25 @@ LuaBindings::stddef (lua_State* L) { // std::list luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") + .beginNamespace ("C") .beginStdList ("StringList") .endClass () - .endNamespace (); // std::vector - luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") .beginStdVector ("StringVector") .endClass () - .endNamespace (); + + // register float array (uint8_t*) + .registerArray ("ByteArray") // register float array (float*) - luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") .registerArray ("FloatArray") - .endNamespace (); // register float array (int32_t*) - luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") .registerArray ("IntArray") - .endNamespace (); - - // std::vector - luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") - .beginStdVector ("DoubleVector") - .endClass () - .endNamespace (); // TODO std::set + .endNamespace (); } void @@ -111,39 +246,188 @@ LuaBindings::common (lua_State* L) { luabridge::getGlobalNamespace (L) .beginNamespace ("PBD") + + .addFunction ("open_uri", (bool (*) (const std::string&))&PBD::open_uri) + .addFunction ("open_uri", &PBD::open_folder) + .beginClass ("ID") .addConstructor () .addFunction ("to_s", &PBD::ID::to_s) // TODO special case LUA __tostring ? .endClass () - .beginWSPtrClass ("Stateful") + .beginStdVector ("IdVector").endClass () + + .beginClass ("XMLNode") + .addFunction ("name", &XMLNode::name) + .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 () - .deriveWSPtrClass ("StatefulDestructible") + .deriveClass ("StatefulDestructible") + .endClass () + + .deriveWSPtrClass ("StatefulDestructiblePtr") + .endClass () + + .deriveClass ("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 ("StatefulDiffCommand") + .addFunction ("undo", &PBD::StatefulDiffCommand::undo) + .addFunction ("empty", &PBD::StatefulDiffCommand::empty) .endClass () .deriveWSPtrClass ("Controllable") + .addFunction ("name", &PBD::Controllable::name) .addFunction ("get_value", &PBD::Controllable::get_value) .endClass () + .beginClass > ("RingBuffer8") + .addConstructor () + .addFunction ("reset", &PBD::RingBufferNPT::reset) + .addFunction ("read", &PBD::RingBufferNPT::read) + .addFunction ("write", &PBD::RingBufferNPT::write) + .addFunction ("write_one", &PBD::RingBufferNPT::write_one) + .addFunction ("write_space", &PBD::RingBufferNPT::write_space) + .addFunction ("read_space", &PBD::RingBufferNPT::read_space) + .addFunction ("increment_read_ptr", &PBD::RingBufferNPT::increment_read_ptr) + .addFunction ("increment_write_ptr", &PBD::RingBufferNPT::increment_write_ptr) + .endClass () + + .beginClass > ("RingBufferF") + .addConstructor () + .addFunction ("reset", &PBD::RingBufferNPT::reset) + .addFunction ("read", &PBD::RingBufferNPT::read) + .addFunction ("write", &PBD::RingBufferNPT::write) + .addFunction ("write_one", &PBD::RingBufferNPT::write_one) + .addFunction ("write_space", &PBD::RingBufferNPT::write_space) + .addFunction ("read_space", &PBD::RingBufferNPT::read_space) + .addFunction ("increment_read_ptr", &PBD::RingBufferNPT::increment_read_ptr) + .addFunction ("increment_write_ptr", &PBD::RingBufferNPT::increment_write_ptr) + .endClass () + + .beginClass > ("RingBufferI") + .addConstructor () + .addFunction ("reset", &PBD::RingBufferNPT::reset) + .addFunction ("read", &PBD::RingBufferNPT::read) + .addFunction ("write", &PBD::RingBufferNPT::write) + .addFunction ("write_one", &PBD::RingBufferNPT::write_one) + .addFunction ("write_space", &PBD::RingBufferNPT::write_space) + .addFunction ("read_space", &PBD::RingBufferNPT::read_space) + .addFunction ("increment_read_ptr", &PBD::RingBufferNPT::increment_read_ptr) + .addFunction ("increment_write_ptr", &PBD::RingBufferNPT::increment_write_ptr) + .endClass () + + /* PBD enums */ .beginNamespace ("GroupControlDisposition") .addConst ("InverseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::InverseGroup)) .addConst ("NoGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::NoGroup)) .addConst ("UseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::UseGroup)) .endNamespace () - .endNamespace (); + .endNamespace (); // PBD luabridge::getGlobalNamespace (L) - .beginNamespace ("ARDOUR") // XXX really libtimecode + .beginNamespace ("Timecode") .beginClass ("BBT_TIME") .addConstructor () .endClass () .endNamespace (); luabridge::getGlobalNamespace (L) + + .beginNamespace ("Evoral") + .beginClass ("Parameter") + .addConstructor () + .addFunction ("type", &Evoral::Parameter::type) + .addFunction ("channel", &Evoral::Parameter::channel) + .addFunction ("id", &Evoral::Parameter::id) + .endClass () + + .beginWSPtrClass ("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 ("ControlSet") + .endClass () + + .beginWSPtrClass ("Control") + .addFunction ("list", (boost::shared_ptr(Evoral::Control::*)())&Evoral::Control::list) + .endClass () + + .beginClass ("ParameterDescriptor") + .addVoidConstructor () + .addData ("lower", &Evoral::ParameterDescriptor::lower) + .addData ("upper", &Evoral::ParameterDescriptor::upper) + .addData ("normal", &Evoral::ParameterDescriptor::normal) + .addData ("toggled", &Evoral::ParameterDescriptor::toggled) + .endClass () + + .beginClass > ("Range") + .addConstructor () + .addData ("from", &Evoral::Range::from) + .addData ("to", &Evoral::Range::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") + .addVoidConstructor () + .addData ("done", const_cast(&InterThreadInfo::done)) +#if 0 // currently unused, lua is single-threaded, no custom UIs. + .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel) +#endif + .addData ("progress", const_cast(&InterThreadInfo::progress)) + .endClass () + + .beginClass ("AudioRange") + .addConstructor () + .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") .addVoidConstructor () .endClass () @@ -154,6 +438,16 @@ LuaBindings::common (lua_State* L) .endClass () .endNamespace () + .beginClass ("ChanMapping") + .addVoidConstructor () + .addFunction ("get", static_cast(&ChanMapping::get)) + .addFunction ("set", &ChanMapping::set) + .addFunction ("count", &ChanMapping::count) + .addFunction ("n_total", &ChanMapping::n_total) + .addFunction ("is_monotonic", &ChanMapping::is_monotonic) + .addConst ("Invalid", 4294967295U) // UINT32_MAX + .endClass () + .beginNamespace ("Properties") // templated class definitions .beginClass > ("BoolProperty").endClass () @@ -183,31 +477,206 @@ LuaBindings::common (lua_State* L) .deriveClass ("OwnedPropertyList") .endClass () - .deriveWSPtrClass ("SessionObject") + .beginWSPtrClass ("AutomationList") + .addCast ("to_stateful") + .addCast ("to_statefuldestructible") + .addCast ("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") + .addFunction ("locked", &Location::locked) + .addFunction ("lock", &Location::lock) + .addFunction ("unlock", &Location::unlock) + .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) + .addFunction ("matches", &Location::matches) + .addFunction ("flags", &Location::flags) + .addFunction ("is_auto_punch", &Location::is_auto_punch) + .addFunction ("is_auto_loop", &Location::is_auto_loop) + .addFunction ("is_mark", &Location::is_mark) + .addFunction ("is_hidden", &Location::is_hidden) + .addFunction ("is_cd_marker", &Location::is_cd_marker) + .addFunction ("is_session_range", &Location::is_session_range) + .addFunction ("is_range_marker", &Location::is_range_marker) + .endClass () + + .deriveClass ("Locations") + .addFunction ("list", static_cast(&Locations::list)) + .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_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") + /* SessionObject is-a PBD::StatefulDestructible, + * but multiple inheritance is not covered by luabridge, + * we need explicit casts */ + .addCast ("to_stateful") + .addCast ("to_statefuldestructible") .addFunction ("name", &SessionObject::name) .endClass () - .deriveWSPtrClass ("Route") + .beginWSPtrClass ("Port") + .addCast ("to_midiport") + .addCast ("to_audioport") + .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) + //.addStaticFunction ("port_offset", &Port::port_offset) // static + .endClass () + + .deriveWSPtrClass ("AudioPort") + .endClass () + + .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") + .addFunction ("num_ports", (size_t (PortSet::*)(DataType)const)&PortSet::num_ports) + .addFunction ("add", &PortSet::add) + .addFunction ("remove", &PortSet::remove) + .addFunction ("port", (boost::shared_ptr (PortSet::*)(DataType, size_t)const)&PortSet::port) + .addFunction ("contains", &PortSet::contains) + .addFunction ("clear", &PortSet::clear) + .addFunction ("empty", &PortSet::empty) + .endClass () + + .deriveWSPtrClass ("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, 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 () + + .beginClass ("RouteGroup") + // stub RouteGroup* is needed for new_audio_track() + .endClass () + + .deriveWSPtrClass ("Stripable") + .addCast ("to_route") + .addFunction ("is_auditioner", &Stripable::is_auditioner) + .addFunction ("is_master", &Stripable::is_master) + .addFunction ("is_monitor", &Stripable::is_monitor) + .addFunction ("is_hidden", &Stripable::is_hidden) + .addFunction ("is_selected", &Stripable::is_selected) + .addFunction ("gain_control", &Stripable::gain_control) + .addFunction ("solo_control", &Stripable::solo_control) + .addFunction ("solo_isolate_control", &Stripable::solo_isolate_control) + .addFunction ("solo_safe_control", &Stripable::solo_safe_control) + .addFunction ("mute_control", &Stripable::mute_control) + .addFunction ("phase_control", &Stripable::phase_control) + .addFunction ("trim_control", &Stripable::trim_control) + .addFunction ("rec_enable_control", &Stripable::rec_enable_control) + .addFunction ("rec_safe_control", &Stripable::rec_safe_control) + .endClass () + + .deriveWSPtrClass ("Route") + .addCast ("to_track") .addFunction ("set_name", &Route::set_name) .addFunction ("comment", &Route::comment) .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) .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") + .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 + .addFunction ("region_list", &Playlist::region_list) + .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, 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::*)(std::list&, bool))&Playlist::cut) +#if 0 + .addFunction ("copy", &Playlist::copy) + .addFunction ("paste", &Playlist::paste) +#endif .endClass () .deriveWSPtrClass ("Track") + .addCast ("to_audio_track") + .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 ("bounceable", &Track::bounceable) + .addFunction ("bounce", &Track::bounce) + .addFunction ("bounce_range", &Track::bounce_range) + .addFunction ("playlist", &Track::playlist) .endClass () .deriveWSPtrClass ("AudioTrack") @@ -225,7 +694,7 @@ LuaBindings::common (lua_State* L) .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) @@ -233,7 +702,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) @@ -274,69 +742,63 @@ LuaBindings::common (lua_State* L) .beginWSPtrClass ("Source") .endClass () - .beginClass ("EvoralParameter") - .addConstructor () - .addFunction ("type", &Evoral::Parameter::type) - .addFunction ("channel", &Evoral::Parameter::channel) - .addFunction ("id", &Evoral::Parameter::id) - .endClass () - .beginClass ("PresetRecord") + .addVoidConstructor () .addData ("uri", &Plugin::PresetRecord::uri, false) .addData ("label", &Plugin::PresetRecord::label, false) .addData ("user", &Plugin::PresetRecord::user, false) .addData ("valid", &Plugin::PresetRecord::valid, false) .endClass () - .beginWSPtrClass ("EvoralControlList") - .addFunction ("add", &Evoral::ControlList::add) - .endClass () - - .beginWSPtrClass ("EvoralControlSet") - .endClass () - .deriveWSPtrClass ("Automatable") .addFunction ("automation_control", (boost::shared_ptr(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control) .endClass () - .beginWSPtrClass ("EvoralControl") - .addFunction ("list", (boost::shared_ptr(Evoral::Control::*)())&Evoral::Control::list) - .endClass () - - .beginClass ("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") .addVoidConstructor () .addData ("label", &ParameterDescriptor::label) .addData ("logarithmic", &ParameterDescriptor::logarithmic) + .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name) .endClass () .deriveWSPtrClass ("Processor") - // TODO mult. inheritance - .endClass () - - .deriveWSPtrClass ("Processor") + .addCast ("to_automatable") .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) .addFunction ("deactivate", &Processor::deactivate) - .addFunction ("control", (boost::shared_ptr(Evoral::ControlSet::*)(const Evoral::Parameter&, bool))&Evoral::ControlSet::control) - .addFunction ("automation_control", (boost::shared_ptr(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control) .endClass () - .deriveWSPtrClass ("PluginInsert") + .deriveWSPtrClass ("IOProcessor") + .addFunction ("natural_input_streams", &IOProcessor::natural_input_streams) + .addFunction ("natural_output_streams", &IOProcessor::natural_output_streams) + .addFunction ("input", (boost::shared_ptr(IOProcessor::*)())&IOProcessor::input) + .addFunction ("output", (boost::shared_ptr(IOProcessor::*)())&IOProcessor::output) + .endClass () + + .deriveWSPtrClass ("SideChain") + .endClass () + + .deriveWSPtrClass ("Delivery") + .endClass () + + .deriveWSPtrClass ("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) @@ -350,9 +812,16 @@ LuaBindings::common (lua_State* L) .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") + .deriveWSPtrClass ("AutomationControl") + .addCast ("to_ctrl") .addFunction ("automation_state", &AutomationControl::automation_state) .addFunction ("automation_style", &AutomationControl::automation_style) .addFunction ("set_automation_state", &AutomationControl::set_automation_state) @@ -362,6 +831,53 @@ LuaBindings::common (lua_State* L) .addFunction ("get_value", &AutomationControl::get_value) .addFunction ("set_value", &AutomationControl::set_value) .addFunction ("writable", &AutomationControl::writable) + .addFunction ("alist", &AutomationControl::alist) + .endClass () + + .deriveWSPtrClass ("SlavableAutomationControl,") + .addFunction ("add_master", &SlavableAutomationControl::add_master) + .addFunction ("remove_master", &SlavableAutomationControl::remove_master) + .addFunction ("clear_masters", &SlavableAutomationControl::clear_masters) + .addFunction ("slaved_to", &SlavableAutomationControl::slaved_to) + .addFunction ("slaved", &SlavableAutomationControl::slaved) + .addFunction ("get_masters_value", &SlavableAutomationControl::get_masters_value) + .addFunction ("get_boolean_masters", &SlavableAutomationControl::get_boolean_masters) + //.addFunction ("masters", &SlavableAutomationControl::masters) // not implemented + .endClass () + + .deriveWSPtrClass ("PhaseControl") + .addFunction ("set_phase_invert", (void(PhaseControl::*)(uint32_t, bool))&PhaseControl::set_phase_invert) + .addFunction ("inverted", &PhaseControl::inverted) + .endClass () + + .deriveWSPtrClass ("GainControl") + .endClass () + + .deriveWSPtrClass ("SoloControl") + .addFunction ("can_solo", &SoloControl::can_solo) + .addFunction ("soloed", &SoloControl::soloed) + .addFunction ("self_soloed", &SoloControl::self_soloed) + .endClass () + + .deriveWSPtrClass ("MuteControl") + .addFunction ("muted", &MuteControl::muted) + .addFunction ("muted_by_self", &MuteControl::muted_by_self) + .endClass () + + .deriveWSPtrClass ("SoloIsolateControl") + .addFunction ("solo_isolated", &SoloIsolateControl::solo_isolated) + .addFunction ("self_solo_isolated", &SoloIsolateControl::self_solo_isolated) + .endClass () + + .deriveWSPtrClass ("SoloSafeControl") + .addFunction ("solo_safe", &SoloSafeControl::solo_safe) + .endClass () + + .deriveWSPtrClass ("Amp") + .addFunction ("gain_control", (boost::shared_ptr(Amp::*)())&Amp::gain_control) + .endClass () + + .deriveWSPtrClass ("UnknownProcessor") .endClass () .deriveWSPtrClass ("PluginControl") @@ -372,26 +888,49 @@ LuaBindings::common (lua_State* L) .addFunction ("n_channels", &AudioSource::n_channels) .endClass () - // > + // > .beginStdList > ("AudioTrackList") .endClass () - // std::list > + // std::list > .beginStdList > ("MidiTrackList") .endClass () - // RouteList == boost::shared_ptr > > + // RouteList == std::list > + .beginConstStdList > ("RouteList") + .endClass () + + // boost::shared_ptr .beginPtrStdList > ("RouteListPtr") .endClass () - // typedef std::list > WeakRouteList + // typedef std::list > WeakRouteList .beginConstStdList > ("WeakRouteList") .endClass () - // std::list< boost::weak_ptr + // std::list< boost::weak_ptr > .beginConstStdList > ("WeakAudioSourceList") .endClass () + // typedef std::list > RegionList + .beginConstStdList > ("RegionList") + .endClass () + + // boost::shared_ptr > > + .beginPtrStdList > ("RegionListPtr") + .endClass () + + //std::list > PortList; + .beginConstStdList > ("PortList") + .endClass () + + // used by Playlist::cut/copy + .beginConstStdList ("AudioRangeList") + .endClass () + + .beginConstStdList ("LocationList") + .endClass () + #if 0 // depends on Evoal:: Note, Beats see note_fixer.h // typedef Evoral::Note Note; // std::set< boost::weak_ptr > @@ -399,10 +938,6 @@ LuaBindings::common (lua_State* L) .endClass () #endif - // typedef std::set > PortSet - .beginStdSet > ("WeakPortSet") - .endClass () - // std::list > .beginConstStdList > ("WeakSourceList") .endClass () @@ -425,14 +960,43 @@ LuaBindings::common (lua_State* L) .beginClass ("TempoMap") .addFunction ("add_tempo", &TempoMap::add_tempo) .addFunction ("add_meter", &TempoMap::add_meter) + .addFunction ("tempo_section_at_frame", &TempoMap::tempo_section_at_frame) + .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_frame) + .addFunction ("meter_section_at_beat", &TempoMap::meter_section_at_beat) + .endClass () + + .beginClass ("MetricSection") + .addFunction ("pulse", &MetricSection::pulse) + .addFunction ("set_pulse", &MetricSection::set_pulse) + .endClass () + + .deriveClass ("TempoSection") + .addFunction ("c_func", (double(TempoSection::*)()const)&TempoSection::c_func) + .endClass () + + .deriveClass ("MeterSection") + .addCast ("to_meter") + .addFunction ("set_pulse", &MeterSection::set_pulse) + .addFunction ("set_beat", (void(MeterSection::*)(double))&MeterSection::set_beat) .endClass () .beginClass ("ChanCount") + .addConstructor () + .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") .addConstructor () + .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 */ @@ -445,9 +1009,26 @@ LuaBindings::common (lua_State* L) .addConst ("Lua", ARDOUR::PluginType(Lua)) .endNamespace () - .beginNamespace ("Autostyle") - .addConst ("Absolute", ARDOUR::AutoState(Absolute)) - .addConst ("Trim", ARDOUR::AutoState(Trim)) + .beginNamespace ("PresentationInfo") + .beginNamespace ("Flag") + .addConst ("AudioTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioTrack)) + .addConst ("MidiTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiTrack)) + .addConst ("AudioBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioBus)) + .addConst ("MidiBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiBus)) + .addConst ("VCA", ARDOUR::PresentationInfo::Flag(PresentationInfo::VCA)) + .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") @@ -458,18 +1039,62 @@ LuaBindings::common (lua_State* L) .endNamespace () .beginNamespace ("AutomationType") + .addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation)) .addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation)) + .addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation)) + .addConst ("SoloIsolateAutomation", ARDOUR::AutomationType(SoloIsolateAutomation)) + .addConst ("SoloSafeAutomation", ARDOUR::AutomationType(SoloSafeAutomation)) + .addConst ("MuteAutomation", ARDOUR::AutomationType(MuteAutomation)) + .addConst ("RecEnableAutomation", ARDOUR::AutomationType(RecEnableAutomation)) + .addConst ("RecSafeAutomation", ARDOUR::AutomationType(RecSafeAutomation)) + .addConst ("TrimAutomation", ARDOUR::AutomationType(TrimAutomation)) + .addConst ("PhaseAutomation", ARDOUR::AutomationType(PhaseAutomation)) .endNamespace () .beginNamespace ("SrcQuality") .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)) .addConst ("SharePlaylist", ARDOUR::PlaylistDisposition(SharePlaylist)) - .endNamespace (); + .endNamespace () + + .beginNamespace ("RegionPoint") + .addConst ("Start", ARDOUR::RegionPoint(Start)) + .addConst ("End", ARDOUR::RegionPoint(End)) + .addConst ("SyncPoint", ARDOUR::RegionPoint(SyncPoint)) + .endNamespace () + + .beginNamespace ("TempoSection") + .beginNamespace ("PositionLockStyle") + .addConst ("AudioTime", ARDOUR::PositionLockStyle(AudioTime)) + .addConst ("MusicTime", ARDOUR::PositionLockStyle(MusicTime)) + .endNamespace () + .endNamespace () + + .beginNamespace ("TempoSection") + .beginNamespace ("Type") + .addConst ("Ramp", ARDOUR::TempoSection::Type(TempoSection::Ramp)) + .addConst ("Constant", ARDOUR::TempoSection::Type(TempoSection::Constant)) + .endNamespace () + .endNamespace () + + .beginNamespace ("TrackMode") + .addConst ("Normal", ARDOUR::TrackMode(Start)) + .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered)) + .addConst ("Destructive", ARDOUR::TrackMode(Destructive)) + .endNamespace () + .endNamespace (); // end ARDOUR luabridge::getGlobalNamespace (L) .beginNamespace ("ARDOUR") @@ -478,13 +1103,11 @@ LuaBindings::common (lua_State* L) .endClass() .beginStdVector ("BackendVector").endClass () - .beginNamespace ("ARDOUR") .beginClass ("DeviceStatus") .addData ("name", &AudioBackend::DeviceStatus::name) .addData ("available", &AudioBackend::DeviceStatus::available) .endClass() .beginStdVector ("DeviceStatusVector").endClass () - .endNamespace () .beginWSPtrClass ("AudioBackend") .addFunction ("info", &AudioBackend::info) @@ -515,7 +1138,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) @@ -554,6 +1199,10 @@ LuaBindings::common (lua_State* L) .addFunction ("current_start_frame", &Session::current_start_frame) .addFunction ("current_end_frame", &Session::current_end_frame) .addFunction ("actively_recording", &Session::actively_recording) + .addFunction ("new_audio_track", &Session::new_audio_track) + .addFunction ("new_audio_route", &Session::new_audio_route) + .addFunction ("new_midi_track", &Session::new_midi_track) + .addFunction ("new_midi_route", &Session::new_midi_route) .addFunction ("get_routes", &Session::get_routes) .addFunction ("get_tracks", &Session::get_tracks) .addFunction ("name", &Session::name) @@ -561,20 +1210,36 @@ 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) + .addFunction ("get_remote_nth_stripable", &Session::get_remote_nth_stripable) + .addFunction ("get_remote_nth_route", &Session::get_remote_nth_route) + .addFunction ("route_by_selected_count", &Session::route_by_selected_count) .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) .addFunction ("processor_by_id", &Session::processor_by_id) .addFunction ("snap_name", &Session::snap_name) + .addFunction ("monitor_out", &Session::monitor_out) + .addFunction ("master_out", &Session::master_out) .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) + .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") @@ -583,16 +1248,33 @@ 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) .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) - .endNamespace () - - .endNamespace ();// END ARDOUR + .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation) + .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba) + .addFunction ("usleep", Glib::usleep) + .endNamespace () // end LuaAPI + .endNamespace ();// end ARDOUR } void @@ -602,27 +1284,33 @@ LuaBindings::dsp (lua_State* L) .beginNamespace ("ARDOUR") .beginClass ("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") + .addEqualCheck () .addFunction ("silence", &MidiBuffer::silence) + .addFunction ("size", &MidiBuffer::size) .addFunction ("empty", &MidiBuffer::empty) + .addFunction ("resize", &MidiBuffer::resize) + .addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy) + .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") + .addEqualCheck () .addFunction ("get_audio", static_cast(&BufferSet::get_audio)) + .addFunction ("get_midi", static_cast(&BufferSet::get_midi)) .addFunction ("count", static_cast(&BufferSet::count)) .endClass() - - .beginClass ("ChanMapping") - .addFunction ("get", static_cast(&ChanMapping::get)) - .addFunction ("set", &ChanMapping::set) - .addConst ("Invalid", 4294967295) // UINT32_MAX - .endClass () .endNamespace (); luabridge::getGlobalNamespace (L) @@ -632,14 +1320,19 @@ LuaBindings::dsp (lua_State* L) .addFunction ("size", &Evoral::Event::size) .addFunction ("set_buffer", &Evoral::Event::set_buffer) .addFunction ("buffer", (uint8_t*(Evoral::Event::*)())&Evoral::Event::buffer) + .addFunction ("time", (framepos_t (Evoral::Event::*)())&Evoral::MIDIEvent::time) + .endClass () + + .beginClass ("Beats") + .addFunction ("to_double", &Evoral::Beats::to_double) .endClass () .deriveClass , Evoral::Event > ("MidiEvent") // 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 (); @@ -668,6 +1361,7 @@ LuaBindings::dsp (lua_State* L) .addFunction ("mmult", &DSP::mmult) .addFunction ("log_meter", &DSP::log_meter) .addFunction ("log_meter_coeff", &DSP::log_meter_coeff) + .addFunction ("process_map", &DSP::process_map) .addRefFunction ("peaks", &DSP::peaks) .beginClass ("LowPass") @@ -677,14 +1371,37 @@ 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 ("configure", &DSP::Biquad::configure) + .addFunction ("reset", &DSP::Biquad::reset) + .addFunction ("dB_at_freq", &DSP::Biquad::dB_at_freq) + .endClass () + .beginClass ("FFTSpectrum") + .addConstructor () + .addFunction ("set_data_hann", &DSP::FFTSpectrum::set_data_hann) + .addFunction ("execute", &DSP::FFTSpectrum::execute) + .addFunction ("power_at_bin", &DSP::FFTSpectrum::power_at_bin) + .addFunction ("freq_at_bin", &DSP::FFTSpectrum::freq_at_bin) .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 ("DspShm") + .addConstructor () .addFunction ("allocate", &DSP::DspShm::allocate) .addFunction ("clear", &DSP::DspShm::clear) .addFunction ("to_float", &DSP::DspShm::to_float) @@ -694,6 +1411,12 @@ LuaBindings::dsp (lua_State* L) .endClass () .endNamespace () // DSP + + .beginClass ("LuaTableRef") + .addCFunction ("get", &LuaTableRef::get) + .addCFunction ("set", &LuaTableRef::set) + .endClass () + .endNamespace (); // ARDOUR } @@ -720,11 +1443,13 @@ void LuaBindings::osc (lua_State* L) { luabridge::getGlobalNamespace (L) - .beginNamespace ("OSC") - .beginClass ("Address") + .beginNamespace ("ARDOUR") + .beginNamespace ("LuaOSC") + .beginClass ("Address") .addConstructor () - .addCFunction ("send", &LuaAPI::LuaOSCAddress::send) + .addCFunction ("send", &LuaOSC::Address::send) .endClass () + .endNamespace () .endNamespace (); }