2 Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "timecode/bbt_time.h"
22 #include "pbd/stateful_diff_command.h"
23 #include "pbd/openuri.h"
24 #include "evoral/Control.hpp"
25 #include "evoral/ControlList.hpp"
26 #include "evoral/Range.hpp"
28 #include "ardour/amp.h"
29 #include "ardour/audioengine.h"
30 #include "ardour/audiosource.h"
31 #include "ardour/audio_backend.h"
32 #include "ardour/audio_buffer.h"
33 #include "ardour/audio_port.h"
34 #include "ardour/audio_track.h"
35 #include "ardour/buffer_set.h"
36 #include "ardour/chan_mapping.h"
37 #include "ardour/dB.h"
38 #include "ardour/dsp_filter.h"
39 #include "ardour/fluid_synth.h"
40 #include "ardour/interthread_info.h"
41 #include "ardour/lua_api.h"
42 #include "ardour/luabindings.h"
43 #include "ardour/luaproc.h"
44 #include "ardour/meter.h"
45 #include "ardour/midi_track.h"
46 #include "ardour/midi_port.h"
47 #include "ardour/phase_control.h"
48 #include "ardour/playlist.h"
49 #include "ardour/plugin.h"
50 #include "ardour/plugin_insert.h"
51 #include "ardour/port_manager.h"
52 #include "ardour/runtime_functions.h"
53 #include "ardour/region.h"
54 #include "ardour/region_factory.h"
55 #include "ardour/route_group.h"
56 #include "ardour/session.h"
57 #include "ardour/session_object.h"
58 #include "ardour/sidechain.h"
59 #include "ardour/solo_isolate_control.h"
60 #include "ardour/solo_safe_control.h"
61 #include "ardour/stripable.h"
62 #include "ardour/track.h"
63 #include "ardour/tempo.h"
65 #include "LuaBridge/LuaBridge.h"
67 #ifdef PLATFORM_WINDOWS
68 /* luabridge uses addresses of static functions/variables to identify classes.
70 * Static symbols on windows (even identical symbols) are not
71 * mapped to the same address when mixing .dll + .exe.
72 * So we need a single point to define those static functions.
73 * (normally they're header-only in libs/lua/LuaBridge/detail/ClassInfo.h)
75 * Really!! A static function with a static variable in a library header
76 * should never ever be replicated, even if it is a template.
77 * But then again this is windows... what else can go wrong.
82 luabridge::ClassInfo<T>::getStaticKey ()
90 luabridge::ClassInfo<T>::getClassKey ()
98 luabridge::ClassInfo<T>::getConstKey ()
105 luabridge::getIdentityKey ()
111 /* ...and this is the ugly part of it.
113 * We need to foward declare classes from gtk2_ardour
114 * end explicily list classes which are used by gtk2_ardour's bindings.
116 * This is needed because some of the GUI classes use objects from libardour
117 * as function parameters and the .exe would re-create symbols for libardour
120 * Classes which don't use libardour symbols could be moved to
121 * gtk2_ardour/luainstance.cc, but keeping this here reduces code
122 * duplication and does not give the compiler a chance to even think
123 * about replicating the symbols.
126 #define CLASSKEYS(CLS) \
127 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
128 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
129 template void const* luabridge::ClassInfo< CLS >::getConstKey();
131 #define CLASSINFO(CLS) \
133 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
134 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
135 template void const* luabridge::ClassInfo< CLS >::getConstKey();
137 CLASSINFO(MarkerSelection);
138 CLASSINFO(TrackSelection);
139 CLASSINFO(TrackViewList);
140 CLASSINFO(TimeSelection);
141 CLASSINFO(RegionSelection);
142 CLASSINFO(PublicEditor);
143 CLASSINFO(Selection);
144 CLASSINFO(ArdourMarker);
150 CLASSKEYS(LuaCairo::ImageSurface);
151 CLASSKEYS(LuaCairo::PangoLayout);
156 CLASSKEYS(Cairo::Context);
157 CLASSKEYS(std::vector<double>);
158 CLASSKEYS(std::list<ArdourMarker*>);
159 CLASSKEYS(std::bitset<47ul>); // LuaSignal::LAST_SIGNAL
160 CLASSKEYS(ArdourMarker*);
161 CLASSKEYS(ARDOUR::RouteGroup);
162 CLASSKEYS(ARDOUR::LuaProc);
163 CLASSKEYS(ARDOUR::DataType);
164 CLASSKEYS(ARDOUR::ChanCount);
165 CLASSKEYS(boost::shared_ptr<ARDOUR::Processor>);
166 CLASSKEYS(ARDOUR::ParameterDescriptor);
167 CLASSKEYS(boost::shared_ptr<ARDOUR::AutomationList>);
168 CLASSKEYS(boost::shared_ptr<Evoral::ControlList>);
169 CLASSKEYS(ARDOUR::LuaOSC::Address);
170 CLASSKEYS(ARDOUR::Session);
171 CLASSKEYS(ARDOUR::PeakMeter);
172 CLASSKEYS(ARDOUR::BufferSet);
173 CLASSKEYS(ARDOUR::ChanMapping);
174 CLASSKEYS(ARDOUR::FluidSynth);
175 CLASSKEYS(ARDOUR::DSP::DspShm);
176 CLASSKEYS(ARDOUR::LuaTableRef);
177 CLASSKEYS(PBD::Configuration);
178 CLASSKEYS(ARDOUR::PresentationInfo);
179 CLASSKEYS(ARDOUR::SessionConfiguration);
181 CLASSKEYS(ARDOUR::Location);
182 CLASSKEYS(ARDOUR::PluginInfo);
183 CLASSKEYS(ARDOUR::MonitorProcessor);
184 CLASSKEYS(ARDOUR::Plugin::PresetRecord);
185 CLASSKEYS(std::vector<ARDOUR::Plugin::PresetRecord>);
186 CLASSKEYS(PBD::PropertyChange);
187 CLASSKEYS(std::vector<std::string>);
188 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
189 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Port> >);
190 CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Processor> >);
191 CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
192 CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
193 CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
194 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Region> >);
195 CLASSKEYS(std::list<ARDOUR::AudioRange>);
196 CLASSKEYS(Evoral::Beats);
197 CLASSKEYS(ARDOUR::PortEngine);
198 CLASSKEYS(ARDOUR::PortManager);
199 CLASSKEYS(ARDOUR::AudioEngine);
202 CLASSKEYS(unsigned char);
204 #endif // end windows special case
206 /* Some notes on Lua bindings for libardour and friends
208 * - Prefer factory methods over Contructors whenever possible.
209 * Don't expose the constructor method unless required.
211 * e.g. Don't allow the script to construct a "Track" Object directly
212 * but do allow to create a "BBT_TIME" object.
214 * - Do not dereference Shared or Weak Pointers. Pass the pointer to Lua.
215 * - Define Objects as boost:shared_ptr Object whenever possible.
217 * Storing a boost::shared_ptr in a Lua-variable keeps the reference
218 * until that variable is set to 'nil'.
219 * (if the script were to keep a direct pointer to the object instance, the
220 * behaviour is undefined if the actual object goes away)
222 * Methods of the actual class are indirectly exposed,
223 * boost::*_ptr get() and ::lock() is implicit when the class is exported
224 * as LuaBridge's "WSPtrClass".
227 using namespace ARDOUR;
230 LuaBindings::stddef (lua_State* L)
232 // std::list<std::string>
233 luabridge::getGlobalNamespace (L)
234 .beginNamespace ("C")
235 .beginStdList <std::string> ("StringList")
238 // std::vector<std::string>
239 .beginStdVector <std::string> ("StringVector")
242 // register float array (uint8_t*)
243 .registerArray <uint8_t> ("ByteArray")
245 // register float array (float*)
246 .registerArray <float> ("FloatArray")
248 // register float array (int32_t*)
249 .registerArray <int32_t> ("IntArray")
256 LuaBindings::common (lua_State* L)
258 luabridge::getGlobalNamespace (L)
259 .beginNamespace ("PBD")
261 .addFunction ("open_uri", (bool (*) (const std::string&))&PBD::open_uri)
262 .addFunction ("open_uri", &PBD::open_folder)
264 .beginClass <PBD::ID> ("ID")
265 .addConstructor <void (*) (std::string)> ()
266 .addFunction ("to_s", &PBD::ID::to_s) // TODO special case LUA __tostring ?
269 .beginStdVector <PBD::ID> ("IdVector").endClass ()
271 .beginClass <XMLNode> ("XMLNode")
272 .addFunction ("name", &XMLNode::name)
275 .beginClass <PBD::Stateful> ("Stateful")
276 .addFunction ("id", &PBD::Stateful::id)
277 .addFunction ("properties", &PBD::Stateful::properties)
278 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
281 .beginWSPtrClass <PBD::Stateful> ("StatefulPtr")
282 .addFunction ("id", &PBD::Stateful::id)
283 .addFunction ("properties", &PBD::Stateful::properties)
284 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
287 .deriveClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructible")
290 .deriveClass <PBD::Configuration, PBD::Stateful> ("Configuration")
293 .deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructiblePtr")
296 .deriveClass <Command, PBD::StatefulDestructible> ("Command")
297 .addFunction ("set_name", &Command::set_name)
298 .addFunction ("name", &Command::name)
301 /* UndoTransaction::add_command() subscribes to DropReferences()
302 * and deletes the object.
304 * This object cannot be constructed by lua because lua would manage lifetime
305 * and delete the object leading to a double free.
307 * use Session::add_stateful_diff_command()
308 * and Session::abort_reversible_command()
310 .deriveClass <PBD::StatefulDiffCommand, Command> ("StatefulDiffCommand")
311 .addFunction ("undo", &PBD::StatefulDiffCommand::undo)
312 .addFunction ("empty", &PBD::StatefulDiffCommand::empty)
315 .deriveWSPtrClass <PBD::Controllable, PBD::StatefulDestructible> ("Controllable")
316 .addFunction ("name", &PBD::Controllable::name)
317 .addFunction ("get_value", &PBD::Controllable::get_value)
320 .beginClass <PBD::RingBufferNPT <uint8_t> > ("RingBuffer8")
321 .addConstructor <void (*) (size_t)> ()
322 .addFunction ("reset", &PBD::RingBufferNPT<uint8_t>::reset)
323 .addFunction ("read", &PBD::RingBufferNPT<uint8_t>::read)
324 .addFunction ("write", &PBD::RingBufferNPT<uint8_t>::write)
325 .addFunction ("write_one", &PBD::RingBufferNPT<uint8_t>::write_one)
326 .addFunction ("write_space", &PBD::RingBufferNPT<uint8_t>::write_space)
327 .addFunction ("read_space", &PBD::RingBufferNPT<uint8_t>::read_space)
328 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<uint8_t>::increment_read_ptr)
329 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<uint8_t>::increment_write_ptr)
332 .beginClass <PBD::RingBufferNPT <float> > ("RingBufferF")
333 .addConstructor <void (*) (size_t)> ()
334 .addFunction ("reset", &PBD::RingBufferNPT<float>::reset)
335 .addFunction ("read", &PBD::RingBufferNPT<float>::read)
336 .addFunction ("write", &PBD::RingBufferNPT<float>::write)
337 .addFunction ("write_one", &PBD::RingBufferNPT<float>::write_one)
338 .addFunction ("write_space", &PBD::RingBufferNPT<float>::write_space)
339 .addFunction ("read_space", &PBD::RingBufferNPT<float>::read_space)
340 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<float>::increment_read_ptr)
341 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<float>::increment_write_ptr)
344 .beginClass <PBD::RingBufferNPT <int> > ("RingBufferI")
345 .addConstructor <void (*) (size_t)> ()
346 .addFunction ("reset", &PBD::RingBufferNPT<int>::reset)
347 .addFunction ("read", &PBD::RingBufferNPT<int>::read)
348 .addFunction ("write", &PBD::RingBufferNPT<int>::write)
349 .addFunction ("write_one", &PBD::RingBufferNPT<int>::write_one)
350 .addFunction ("write_space", &PBD::RingBufferNPT<int>::write_space)
351 .addFunction ("read_space", &PBD::RingBufferNPT<int>::read_space)
352 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<int>::increment_read_ptr)
353 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<int>::increment_write_ptr)
357 .beginNamespace ("GroupControlDisposition")
358 .addConst ("InverseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::InverseGroup))
359 .addConst ("NoGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::NoGroup))
360 .addConst ("UseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::UseGroup))
363 .endNamespace (); // PBD
365 luabridge::getGlobalNamespace (L)
366 .beginNamespace ("Timecode")
367 .beginClass <Timecode::BBT_Time> ("BBT_TIME")
368 .addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
371 /* libtimecode enums */
372 .beginNamespace ("TimecodeFormat")
373 .addConst ("TC23976", Timecode::TimecodeFormat(Timecode::timecode_23976))
374 .addConst ("TC24", Timecode::TimecodeFormat(Timecode::timecode_24))
375 .addConst ("TC24976", Timecode::TimecodeFormat(Timecode::timecode_24976))
376 .addConst ("TC25", Timecode::TimecodeFormat(Timecode::timecode_25))
377 .addConst ("TC2997", Timecode::TimecodeFormat(Timecode::timecode_2997))
378 .addConst ("TC2997DF", Timecode::TimecodeFormat(Timecode::timecode_2997drop))
379 .addConst ("TC2997000", Timecode::TimecodeFormat(Timecode::timecode_2997000))
380 .addConst ("TC2997000DF", Timecode::TimecodeFormat(Timecode::timecode_2997000drop))
381 .addConst ("TC30", Timecode::TimecodeFormat(Timecode::timecode_30))
382 .addConst ("TC5994", Timecode::TimecodeFormat(Timecode::timecode_5994))
383 .addConst ("TC60", Timecode::TimecodeFormat(Timecode::timecode_60))
387 luabridge::getGlobalNamespace (L)
389 .beginNamespace ("Evoral")
390 .beginClass <Evoral::Parameter> ("Parameter")
391 .addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
392 .addFunction ("type", &Evoral::Parameter::type)
393 .addFunction ("channel", &Evoral::Parameter::channel)
394 .addFunction ("id", &Evoral::Parameter::id)
397 .beginWSPtrClass <Evoral::ControlList> ("ControlList")
398 .addFunction ("add", &Evoral::ControlList::add)
399 .addFunction ("thin", &Evoral::ControlList::thin)
400 .addFunction ("eval", &Evoral::ControlList::eval)
401 .addRefFunction ("rt_safe_eval", &Evoral::ControlList::rt_safe_eval)
402 .addFunction ("interpolation", &Evoral::ControlList::interpolation)
403 .addFunction ("set_interpolation", &Evoral::ControlList::set_interpolation)
404 .addFunction ("truncate_end", &Evoral::ControlList::truncate_end)
405 .addFunction ("truncate_start", &Evoral::ControlList::truncate_start)
406 .addFunction ("clear", (void (Evoral::ControlList::*)(double, double))&Evoral::ControlList::clear)
407 .addFunction ("in_write_pass", &Evoral::ControlList::in_write_pass)
410 .beginWSPtrClass <Evoral::ControlSet> ("ControlSet")
413 .beginWSPtrClass <Evoral::Control> ("Control")
414 .addFunction ("list", (boost::shared_ptr<Evoral::ControlList>(Evoral::Control::*)())&Evoral::Control::list)
417 .beginClass <Evoral::ParameterDescriptor> ("ParameterDescriptor")
418 .addVoidConstructor ()
419 .addData ("lower", &Evoral::ParameterDescriptor::lower)
420 .addData ("upper", &Evoral::ParameterDescriptor::upper)
421 .addData ("normal", &Evoral::ParameterDescriptor::normal)
422 .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
425 .beginClass <Evoral::Range<framepos_t> > ("Range")
426 .addConstructor <void (*) (framepos_t, framepos_t)> ()
427 .addData ("from", &Evoral::Range<framepos_t>::from)
428 .addData ("to", &Evoral::Range<framepos_t>::to)
431 /* libevoral enums */
432 .beginNamespace ("InterpolationStyle")
433 .addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete))
434 .addConst ("Linear", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Linear))
435 .addConst ("Curved", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Curved))
438 .endNamespace () // Evoral
440 .beginNamespace ("ARDOUR")
442 .beginClass <InterThreadInfo> ("InterThreadInfo")
443 .addVoidConstructor ()
444 .addData ("done", const_cast<bool InterThreadInfo::*>(&InterThreadInfo::done))
445 #if 0 // currently unused, lua is single-threaded, no custom UIs.
446 .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel)
448 .addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress))
451 .beginClass <AudioRange> ("AudioRange")
452 .addConstructor <void (*) (framepos_t, framepos_t, uint32_t)> ()
453 .addFunction ("length", &AudioRange::length)
454 .addFunction ("equal", &AudioRange::equal)
455 .addData ("start", &AudioRange::start)
456 .addData ("_end", &AudioRange::end) // XXX "end" is a lua reserved word
457 .addData ("id", &AudioRange::id)
460 .beginWSPtrClass <PluginInfo> ("PluginInfo")
461 .addVoidConstructor ()
462 .addData ("name", &PluginInfo::name, false)
463 .addData ("category", &PluginInfo::category, false)
464 .addData ("creator", &PluginInfo::creator, false)
465 .addData ("path", &PluginInfo::path, false)
466 .addData ("n_inputs", &PluginInfo::n_inputs, false)
467 .addData ("n_outputs", &PluginInfo::n_outputs, false)
468 .addData ("type", &PluginInfo::type, false)
469 .addData ("unique_id", &PluginInfo::unique_id, false)
470 .addFunction ("is_instrument", &PluginInfo::is_instrument)
471 .addFunction ("get_presets", &PluginInfo::get_presets)
474 .beginNamespace ("Route")
475 .beginClass <Route::ProcessorStreams> ("ProcessorStreams")
476 .addVoidConstructor ()
480 .beginClass <ChanMapping> ("ChanMapping")
481 .addVoidConstructor ()
482 .addFunction ("get", static_cast<uint32_t(ChanMapping::*)(DataType, uint32_t) const>(&ChanMapping::get))
483 .addFunction ("set", &ChanMapping::set)
484 .addFunction ("count", &ChanMapping::count)
485 .addFunction ("n_total", &ChanMapping::n_total)
486 .addFunction ("is_monotonic", &ChanMapping::is_monotonic)
487 .addConst ("Invalid", 4294967295U) // UINT32_MAX
490 .beginNamespace ("Properties")
491 // templated class definitions
492 .beginClass <PBD::PropertyDescriptor<bool> > ("BoolProperty").endClass ()
493 .beginClass <PBD::PropertyDescriptor<float> > ("FloatProperty").endClass ()
494 .beginClass <PBD::PropertyDescriptor<framepos_t> > ("FrameposProperty").endClass ()
495 // actual references (TODO: also expose GQuark for std::set)
497 .addConst ("Start", &ARDOUR::Properties::start)
498 .addConst ("Length", &ARDOUR::Properties::length)
499 .addConst ("Position", &ARDOUR::Properties::position)
502 .beginClass <PBD::PropertyChange> ("PropertyChange")
503 // TODO add special handling (std::set<PropertyID>), PropertyID is a GQuark.
504 // -> direct map to lua table beginStdSet()A
506 // expand templated PropertyDescriptor<T>
507 .addFunction ("containsBool", &PBD::PropertyChange::contains<bool>)
508 .addFunction ("containsFloat", &PBD::PropertyChange::contains<float>)
509 .addFunction ("containsFramePos", &PBD::PropertyChange::contains<framepos_t>)
512 .beginClass <PBD::PropertyList> ("PropertyList")
513 // is-a std::map<PropertyID, PropertyBase*>
516 .deriveClass <PBD::OwnedPropertyList, PBD::PropertyList> ("OwnedPropertyList")
519 .beginWSPtrClass <AutomationList> ("AutomationList")
520 .addCast<PBD::Stateful> ("to_stateful")
521 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
522 .addCast<Evoral::ControlList> ("list")
523 .addFunction ("get_state", &AutomationList::get_state)
524 .addFunction ("memento_command", &AutomationList::memento_command)
525 .addFunction ("touching", &AutomationList::touching)
526 .addFunction ("writing", &AutomationList::writing)
527 .addFunction ("touch_enabled", &AutomationList::touch_enabled)
530 .deriveClass <Location, PBD::StatefulDestructible> ("Location")
531 .addFunction ("locked", &Location::locked)
532 .addFunction ("lock", &Location::lock)
533 .addFunction ("unlock", &Location::unlock)
534 .addFunction ("start", &Location::start)
535 .addFunction ("_end", &Location::end) // XXX "end" is a lua reserved word
536 .addFunction ("length", &Location::length)
537 .addFunction ("set_start", &Location::set_start)
538 .addFunction ("set_end", &Location::set_end)
539 .addFunction ("set_length", &Location::set)
540 .addFunction ("move_to", &Location::move_to)
541 .addFunction ("matches", &Location::matches)
542 .addFunction ("flags", &Location::flags)
543 .addFunction ("is_auto_punch", &Location::is_auto_punch)
544 .addFunction ("is_auto_loop", &Location::is_auto_loop)
545 .addFunction ("is_mark", &Location::is_mark)
546 .addFunction ("is_hidden", &Location::is_hidden)
547 .addFunction ("is_cd_marker", &Location::is_cd_marker)
548 .addFunction ("is_session_range", &Location::is_session_range)
549 .addFunction ("is_range_marker", &Location::is_range_marker)
552 .deriveClass <Locations, PBD::StatefulDestructible> ("Locations")
553 .addFunction ("list", static_cast<Locations::LocationList (Locations::*)()>(&Locations::list))
554 .addFunction ("auto_loop_location", &Locations::auto_loop_location)
555 .addFunction ("auto_punch_location", &Locations::auto_punch_location)
556 .addFunction ("session_range_location", &Locations::session_range_location)
557 .addFunction ("first_mark_after", &Locations::first_mark_after)
558 .addFunction ("first_mark_before", &Locations::first_mark_before)
559 .addFunction ("first_mark_at", &Locations::mark_at)
560 .addFunction ("remove", &Locations::remove)
561 .addRefFunction ("marks_either_side", &Locations::marks_either_side)
562 .addRefFunction ("find_all_between", &Locations::find_all_between)
565 .beginWSPtrClass <SessionObject> ("SessionObject")
566 /* SessionObject is-a PBD::StatefulDestructible,
567 * but multiple inheritance is not covered by luabridge,
568 * we need explicit casts */
569 .addCast<PBD::Stateful> ("to_stateful")
570 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
571 .addFunction ("name", &SessionObject::name)
574 .beginWSPtrClass <Port> ("Port")
575 .addCast<MidiPort> ("to_midiport")
576 .addCast<AudioPort> ("to_audioport")
577 .addFunction ("name", &Port::name)
578 .addFunction ("pretty_name", &Port::pretty_name)
579 .addFunction ("receives_input", &Port::receives_input)
580 .addFunction ("sends_output", &Port::sends_output)
581 .addFunction ("connected", &Port::connected)
582 .addFunction ("disconnect_all", &Port::disconnect_all)
583 .addFunction ("connected_to_name", (bool (Port::*)(std::string const &)const)&Port::connected_to)
584 .addFunction ("connect_by_name", (int (Port::*)(std::string const &))&Port::connect)
585 .addFunction ("disconnect_by_name", (int (Port::*)(std::string const &))&Port::disconnect)
586 .addFunction ("connected_to", (bool (Port::*)(Port*)const)&Port::connected_to)
587 .addFunction ("connect", (int (Port::*)(Port*))&Port::connect)
588 .addFunction ("disconnect", (int (Port::*)(Port*))&Port::disconnect)
589 //.addStaticFunction ("port_offset", &Port::port_offset) // static
592 .deriveWSPtrClass <AudioPort, Port> ("AudioPort")
595 .deriveWSPtrClass <MidiPort, Port> ("MidiPort")
596 .addFunction ("input_active", &MidiPort::input_active)
597 .addFunction ("set_input_active", &MidiPort::set_input_active)
598 .addFunction ("get_midi_buffer", &MidiPort::get_midi_buffer) // DSP only
601 .beginWSPtrClass <PortSet> ("PortSet")
602 .addFunction ("num_ports", (size_t (PortSet::*)(DataType)const)&PortSet::num_ports)
603 .addFunction ("add", &PortSet::add)
604 .addFunction ("remove", &PortSet::remove)
605 .addFunction ("port", (boost::shared_ptr<Port> (PortSet::*)(DataType, size_t)const)&PortSet::port)
606 .addFunction ("contains", &PortSet::contains)
607 .addFunction ("clear", &PortSet::clear)
608 .addFunction ("empty", &PortSet::empty)
611 .deriveWSPtrClass <IO, SessionObject> ("IO")
612 .addFunction ("active", &IO::active)
613 .addFunction ("add_port", &IO::add_port)
614 .addFunction ("remove_port", &IO::remove_port)
615 .addFunction ("connect", &IO::connect)
616 .addFunction ("disconnect", (int (IO::*)(boost::shared_ptr<Port>, std::string, void *))&IO::disconnect)
617 .addFunction ("physically_connected", &IO::physically_connected)
618 .addFunction ("has_port", &IO::has_port)
619 .addFunction ("nth", &IO::nth)
620 .addFunction ("audio", &IO::audio)
621 .addFunction ("midi", &IO::midi)
622 .addFunction ("port_by_name", &IO::nth)
623 .addFunction ("n_ports", &IO::n_ports)
626 .beginClass <RouteGroup> ("RouteGroup")
627 // stub RouteGroup* is needed for new_audio_track()
630 .deriveClass <PresentationInfo, PBD::Stateful> ("PresentationInfo")
631 .addFunction ("color", &PresentationInfo::color)
632 .addFunction ("set_color", &PresentationInfo::set_color)
633 .addFunction ("order", &PresentationInfo::order)
636 .deriveWSPtrClass <Stripable, SessionObject> ("Stripable")
637 .addCast<Route> ("to_route")
638 .addFunction ("is_auditioner", &Stripable::is_auditioner)
639 .addFunction ("is_master", &Stripable::is_master)
640 .addFunction ("is_monitor", &Stripable::is_monitor)
641 .addFunction ("is_hidden", &Stripable::is_hidden)
642 .addFunction ("is_selected", &Stripable::is_selected)
643 .addFunction ("gain_control", &Stripable::gain_control)
644 .addFunction ("solo_control", &Stripable::solo_control)
645 .addFunction ("solo_isolate_control", &Stripable::solo_isolate_control)
646 .addFunction ("solo_safe_control", &Stripable::solo_safe_control)
647 .addFunction ("mute_control", &Stripable::mute_control)
648 .addFunction ("phase_control", &Stripable::phase_control)
649 .addFunction ("trim_control", &Stripable::trim_control)
650 .addFunction ("rec_enable_control", &Stripable::rec_enable_control)
651 .addFunction ("rec_safe_control", &Stripable::rec_safe_control)
652 .addFunction ("pan_azimuth_control", &Stripable::pan_azimuth_control)
653 .addFunction ("pan_elevation_control", &Stripable::pan_elevation_control)
654 .addFunction ("pan_width_control", &Stripable::pan_width_control)
655 .addFunction ("pan_frontback_control", &Stripable::pan_frontback_control)
656 .addFunction ("pan_lfe_control", &Stripable::pan_lfe_control)
657 .addFunction ("send_level_control", &Stripable::send_level_controllable)
658 .addFunction ("send_enable_control", &Stripable::send_level_controllable)
659 .addFunction ("send_name", &Stripable::send_name)
660 .addFunction ("monitor_control", &Stripable::monitor_control)
661 .addFunction ("master_send_enable_control ", &Stripable::master_send_enable_controllable )
662 .addFunction ("comp_enable_control ", &Stripable::comp_enable_controllable )
663 .addFunction ("comp_threshold_control ", &Stripable::comp_threshold_controllable )
664 .addFunction ("comp_speed_control ", &Stripable::comp_speed_controllable )
665 .addFunction ("comp_mode_control ", &Stripable::comp_mode_controllable )
666 .addFunction ("comp_makeup_control ", &Stripable::comp_makeup_controllable )
667 .addFunction ("comp_redux_control ", &Stripable::comp_redux_controllable )
668 .addFunction ("comp_mode_name", &Stripable::comp_mode_name)
669 .addFunction ("comp_speed_name", &Stripable::comp_speed_name)
670 .addFunction ("eq_band_cnt ", &Stripable::eq_band_cnt)
671 .addFunction ("eq_band_name", &Stripable::eq_band_name)
672 .addFunction ("eq_gain_control", &Stripable::eq_gain_controllable)
673 .addFunction ("eq_freq_control ", &Stripable::eq_freq_controllable )
674 .addFunction ("eq_q_control ", &Stripable::eq_q_controllable )
675 .addFunction ("eq_shape_control ", &Stripable::eq_shape_controllable )
676 .addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
677 .addFunction ("eq_hpf_control ", &Stripable::eq_hpf_controllable )
678 .addFunction ("set_presentation_order", &Stripable::set_presentation_order)
679 .addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)
683 .deriveWSPtrClass <Route, Stripable> ("Route")
684 .addCast<Track> ("to_track")
685 .addFunction ("set_name", &Route::set_name)
686 .addFunction ("comment", &Route::comment)
687 .addFunction ("active", &Route::active)
688 .addFunction ("set_active", &Route::set_active)
689 .addFunction ("nth_plugin", &Route::nth_plugin)
690 .addFunction ("nth_processor", &Route::nth_processor)
691 .addFunction ("nth_send", &Route::nth_send)
692 .addFunction ("add_processor_by_index", &Route::add_processor_by_index)
693 .addFunction ("remove_processor", &Route::remove_processor)
694 .addFunction ("replace_processor", &Route::replace_processor)
695 .addFunction ("n_inputs", &Route::n_inputs)
696 .addFunction ("n_outputs", &Route::n_outputs)
697 .addFunction ("set_comment", &Route::set_comment)
698 .addFunction ("strict_io", &Route::strict_io)
699 .addFunction ("set_strict_io", &Route::set_strict_io)
700 .addFunction ("reset_plugin_insert", &Route::reset_plugin_insert)
701 .addFunction ("customize_plugin_insert", &Route::customize_plugin_insert)
702 .addFunction ("add_sidechain", &Route::add_sidechain)
703 .addFunction ("remove_sidechain", &Route::remove_sidechain)
704 .addFunction ("main_outs", &Route::main_outs)
705 .addFunction ("muted", &Route::muted)
706 .addFunction ("soloed", &Route::soloed)
707 .addFunction ("amp", &Route::amp)
708 .addFunction ("trim", &Route::trim)
709 .addFunction ("peak_meter", (boost::shared_ptr<PeakMeter> (Route::*)())&Route::peak_meter)
710 .addFunction ("set_meter_point", &Route::set_meter_point)
713 .deriveWSPtrClass <Playlist, SessionObject> ("Playlist")
714 .addFunction ("region_by_id", &Playlist::region_by_id)
715 .addFunction ("data_type", &Playlist::data_type)
716 .addFunction ("n_regions", &Playlist::n_regions)
717 //.addFunction ("get_extent", &Playlist::get_extent) // pair<framepos_t, framepos_t>
718 .addFunction ("region_list", &Playlist::region_list)
719 .addFunction ("add_region", &Playlist::add_region)
720 .addFunction ("remove_region", &Playlist::remove_region)
721 .addFunction ("regions_at", &Playlist::regions_at)
722 .addFunction ("top_region_at", &Playlist::top_region_at)
723 .addFunction ("top_unmuted_region_at", &Playlist::top_unmuted_region_at)
724 .addFunction ("find_next_region", &Playlist::find_next_region)
725 .addFunction ("find_next_region_boundary", &Playlist::find_next_region_boundary)
726 .addFunction ("count_regions_at", &Playlist::count_regions_at)
727 .addFunction ("regions_touched", &Playlist::regions_touched)
728 .addFunction ("regions_with_start_within", &Playlist::regions_with_start_within)
729 .addFunction ("regions_with_end_within", &Playlist::regions_with_end_within)
730 .addFunction ("raise_region", &Playlist::raise_region)
731 .addFunction ("lower_region", &Playlist::lower_region)
732 .addFunction ("raise_region_to_top", &Playlist::raise_region_to_top)
733 .addFunction ("lower_region_to_bottom", &Playlist::lower_region_to_bottom)
734 .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr<Region>, framepos_t, framecnt_t, float))&Playlist::duplicate)
735 .addFunction ("duplicate_until", &Playlist::duplicate_until)
736 .addFunction ("duplicate_range", &Playlist::duplicate_range)
737 .addFunction ("combine", &Playlist::combine)
738 .addFunction ("uncombine", &Playlist::uncombine)
739 .addFunction ("split_region", &Playlist::split_region)
740 .addFunction ("split", (void (Playlist::*)(framepos_t))&Playlist::split)
741 .addFunction ("cut", (boost::shared_ptr<Playlist> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
743 .addFunction ("copy", &Playlist::copy)
744 .addFunction ("paste", &Playlist::paste)
748 .deriveWSPtrClass <Track, Route> ("Track")
749 .addCast<AudioTrack> ("to_audio_track")
750 .addCast<MidiTrack> ("to_midi_track")
751 .addFunction ("set_name", &Track::set_name)
752 .addFunction ("can_record", &Track::can_record)
753 .addFunction ("bounceable", &Track::bounceable)
754 .addFunction ("bounce", &Track::bounce)
755 .addFunction ("bounce_range", &Track::bounce_range)
756 .addFunction ("playlist", &Track::playlist)
759 .deriveWSPtrClass <AudioTrack, Track> ("AudioTrack")
762 .deriveWSPtrClass <MidiTrack, Track> ("MidiTrack")
765 .deriveWSPtrClass <Region, SessionObject> ("Region")
767 .addFunction ("position", &Region::position)
768 .addFunction ("start", &Region::start)
769 .addFunction ("length", &Region::length)
770 .addFunction ("layer", &Region::layer)
771 .addFunction ("data_type", &Region::data_type)
772 .addFunction ("stretch", &Region::stretch)
773 .addFunction ("shift", &Region::shift)
774 .addRefFunction ("sync_offset", &Region::sync_offset)
775 .addFunction ("sync_position", &Region::sync_position)
776 .addFunction ("hidden", &Region::hidden)
777 .addFunction ("muted", &Region::muted)
778 .addFunction ("opaque", &Region::opaque)
779 .addFunction ("locked", &Region::locked)
780 .addFunction ("position_locked", &Region::position_locked)
781 .addFunction ("video_locked", &Region::video_locked)
782 .addFunction ("automatic", &Region::automatic)
783 .addFunction ("whole_file", &Region::whole_file)
784 .addFunction ("captured", &Region::captured)
785 .addFunction ("can_move", &Region::can_move)
786 .addFunction ("sync_marked", &Region::sync_marked)
787 .addFunction ("external", &Region::external)
788 .addFunction ("import", &Region::import)
789 .addFunction ("covers", &Region::covers)
790 .addFunction ("at_natural_position", &Region::at_natural_position)
791 .addFunction ("is_compound", &Region::is_compound)
792 /* editing operations */
793 .addFunction ("set_length", &Region::set_length)
794 .addFunction ("set_start", &Region::set_start)
795 .addFunction ("set_position", &Region::set_position)
796 .addFunction ("set_initial_position", &Region::set_initial_position)
797 .addFunction ("nudge_position", &Region::nudge_position)
798 .addFunction ("move_to_natural_position", &Region::move_to_natural_position)
799 .addFunction ("move_start", &Region::move_start)
800 .addFunction ("trim_front", &Region::trim_front)
801 .addFunction ("trim_end", &Region::trim_end)
802 .addFunction ("trim_to", &Region::trim_to)
803 .addFunction ("cut_front", &Region::cut_front)
804 .addFunction ("cut_end", &Region::cut_end)
805 .addFunction ("raise", &Region::raise)
806 .addFunction ("lower", &Region::lower)
807 .addFunction ("raise_to_top", &Region::raise_to_top)
808 .addFunction ("lower_to_bottom", &Region::lower_to_bottom)
809 .addFunction ("set_sync_position", &Region::set_sync_position)
810 .addFunction ("clear_sync_position", &Region::clear_sync_position)
811 .addFunction ("set_hidden", &Region::set_hidden)
812 .addFunction ("set_muted", &Region::set_muted)
813 .addFunction ("set_opaque", &Region::set_opaque)
814 .addFunction ("set_locked", &Region::set_locked)
815 .addFunction ("set_video_locked", &Region::set_video_locked)
816 .addFunction ("set_position_locked", &Region::set_position_locked)
819 .beginWSPtrClass <Source> ("Source")
822 .beginClass <Plugin::PresetRecord> ("PresetRecord")
823 .addVoidConstructor ()
824 .addData ("uri", &Plugin::PresetRecord::uri, false)
825 .addData ("label", &Plugin::PresetRecord::label, false)
826 .addData ("user", &Plugin::PresetRecord::user, false)
827 .addData ("valid", &Plugin::PresetRecord::valid, false)
830 .beginStdVector <Plugin::PresetRecord> ("PresetVector").endClass ()
832 .deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
833 .addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
836 .deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
837 .addVoidConstructor ()
838 .addData ("label", &ParameterDescriptor::label)
839 .addData ("logarithmic", &ParameterDescriptor::logarithmic)
840 .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name)
843 .beginStdVector <boost::shared_ptr<ARDOUR::Processor> > ("ProcessorVector").endClass ()
845 .deriveWSPtrClass <Processor, SessionObject> ("Processor")
846 .addCast<Automatable> ("to_automatable")
847 .addCast<PluginInsert> ("to_insert")
848 .addCast<SideChain> ("to_sidechain")
849 .addCast<IOProcessor> ("to_ioprocessor")
850 .addCast<UnknownProcessor> ("to_unknownprocessor")
851 .addCast<Amp> ("to_amp")
852 .addCast<PeakMeter> ("to_peakmeter")
853 .addCast<MonitorProcessor> ("to_monitorprocessor")
854 #if 0 // those objects are not yet bound
855 .addCast<CapturingProcessor> ("to_capturingprocessor")
856 .addCast<DelayLine> ("to_delayline")
857 .addCast<PeakMeter> ("to_meter")
859 .addFunction ("display_name", &Processor::display_name)
860 .addFunction ("active", &Processor::active)
861 .addFunction ("activate", &Processor::activate)
862 .addFunction ("deactivate", &Processor::deactivate)
865 .deriveWSPtrClass <IOProcessor, Processor> ("IOProcessor")
866 .addFunction ("natural_input_streams", &IOProcessor::natural_input_streams)
867 .addFunction ("natural_output_streams", &IOProcessor::natural_output_streams)
868 .addFunction ("input", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::input)
869 .addFunction ("output", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::output)
872 .deriveWSPtrClass <SideChain, IOProcessor> ("SideChain")
875 .deriveWSPtrClass <Delivery, IOProcessor> ("Delivery")
878 .deriveWSPtrClass <Plugin, PBD::StatefulDestructible> ("Plugin")
879 .addFunction ("label", &Plugin::label)
880 .addFunction ("name", &Plugin::name)
881 .addFunction ("maker", &Plugin::maker)
882 .addFunction ("parameter_count", &Plugin::parameter_count)
883 .addRefFunction ("nth_parameter", &Plugin::nth_parameter)
884 .addFunction ("preset_by_label", &Plugin::preset_by_label)
885 .addFunction ("preset_by_uri", &Plugin::preset_by_uri)
886 .addFunction ("load_preset", &Plugin::load_preset)
887 .addFunction ("parameter_is_input", &Plugin::parameter_is_input)
888 .addFunction ("get_docs", &Plugin::get_docs)
889 .addFunction ("get_info", &Plugin::get_info)
890 .addFunction ("get_parameter_docs", &Plugin::get_parameter_docs)
891 .addRefFunction ("get_parameter_descriptor", &Plugin::get_parameter_descriptor)
894 .deriveWSPtrClass <PluginInsert, Processor> ("PluginInsert")
895 .addFunction ("plugin", &PluginInsert::plugin)
896 .addFunction ("activate", &PluginInsert::activate)
897 .addFunction ("deactivate", &PluginInsert::deactivate)
898 .addFunction ("strict_io_configured", &PluginInsert::strict_io_configured)
899 .addFunction ("input_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::input_map)
900 .addFunction ("output_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::output_map)
901 .addFunction ("set_input_map", &PluginInsert::set_input_map)
902 .addFunction ("set_output_map", &PluginInsert::set_output_map)
903 .addFunction ("sidechain_input", &PluginInsert::sidechain_input)
906 .deriveWSPtrClass <AutomationControl, PBD::Controllable> ("AutomationControl")
907 .addCast<Evoral::Control> ("to_ctrl")
908 .addFunction ("automation_state", &AutomationControl::automation_state)
909 .addFunction ("automation_style", &AutomationControl::automation_style)
910 .addFunction ("set_automation_state", &AutomationControl::set_automation_state)
911 .addFunction ("set_automation_style", &AutomationControl::set_automation_style)
912 .addFunction ("start_touch", &AutomationControl::start_touch)
913 .addFunction ("stop_touch", &AutomationControl::stop_touch)
914 .addFunction ("get_value", &AutomationControl::get_value)
915 .addFunction ("set_value", &AutomationControl::set_value)
916 .addFunction ("writable", &AutomationControl::writable)
917 .addFunction ("alist", &AutomationControl::alist)
920 .deriveWSPtrClass <SlavableAutomationControl, AutomationControl> ("SlavableAutomationControl,")
921 .addFunction ("add_master", &SlavableAutomationControl::add_master)
922 .addFunction ("remove_master", &SlavableAutomationControl::remove_master)
923 .addFunction ("clear_masters", &SlavableAutomationControl::clear_masters)
924 .addFunction ("slaved_to", &SlavableAutomationControl::slaved_to)
925 .addFunction ("slaved", &SlavableAutomationControl::slaved)
926 .addFunction ("get_masters_value", &SlavableAutomationControl::get_masters_value)
927 .addFunction ("get_boolean_masters", &SlavableAutomationControl::get_boolean_masters)
928 //.addFunction ("masters", &SlavableAutomationControl::masters) // not implemented
931 .deriveWSPtrClass <PhaseControl, AutomationControl> ("PhaseControl")
932 .addFunction ("set_phase_invert", (void(PhaseControl::*)(uint32_t, bool))&PhaseControl::set_phase_invert)
933 .addFunction ("inverted", &PhaseControl::inverted)
936 .deriveWSPtrClass <GainControl, SlavableAutomationControl> ("GainControl")
939 .deriveWSPtrClass <SoloControl, SlavableAutomationControl> ("SoloControl")
940 .addFunction ("can_solo", &SoloControl::can_solo)
941 .addFunction ("soloed", &SoloControl::soloed)
942 .addFunction ("self_soloed", &SoloControl::self_soloed)
945 .deriveWSPtrClass <MuteControl, SlavableAutomationControl> ("MuteControl")
946 .addFunction ("muted", &MuteControl::muted)
947 .addFunction ("muted_by_self", &MuteControl::muted_by_self)
950 .deriveWSPtrClass <SoloIsolateControl, SlavableAutomationControl> ("SoloIsolateControl")
951 .addFunction ("solo_isolated", &SoloIsolateControl::solo_isolated)
952 .addFunction ("self_solo_isolated", &SoloIsolateControl::self_solo_isolated)
955 .deriveWSPtrClass <SoloSafeControl, SlavableAutomationControl> ("SoloSafeControl")
956 .addFunction ("solo_safe", &SoloSafeControl::solo_safe)
959 .deriveWSPtrClass <Amp, Processor> ("Amp")
960 .addFunction ("gain_control", (boost::shared_ptr<GainControl>(Amp::*)())&Amp::gain_control)
963 .deriveWSPtrClass <PeakMeter, Processor> ("PeakMeter")
964 .addFunction ("meter_level", &PeakMeter::meter_level)
965 .addFunction ("set_type", &PeakMeter::set_type)
966 .addFunction ("reset_max", &PeakMeter::reset_max)
969 .deriveWSPtrClass <MonitorProcessor, Processor> ("MonitorProcessor")
970 .addFunction ("set_cut_all", &MonitorProcessor::set_cut_all)
971 .addFunction ("set_dim_all", &MonitorProcessor::set_dim_all)
972 .addFunction ("set_polarity", &MonitorProcessor::set_polarity)
973 .addFunction ("set_cut", &MonitorProcessor::set_cut)
974 .addFunction ("set_dim", &MonitorProcessor::set_dim)
975 .addFunction ("set_solo", &MonitorProcessor::set_solo)
976 .addFunction ("set_mono", &MonitorProcessor::set_mono)
977 .addFunction ("dim_level", &MonitorProcessor::dim_level)
978 .addFunction ("solo_boost_level", &MonitorProcessor::solo_boost_level)
979 .addFunction ("dimmed", &MonitorProcessor::dimmed)
980 .addFunction ("soloed", &MonitorProcessor::soloed)
981 .addFunction ("inverted", &MonitorProcessor::inverted)
982 .addFunction ("cut", &MonitorProcessor::cut)
983 .addFunction ("cut_all", &MonitorProcessor::cut_all)
984 .addFunction ("dim_all", &MonitorProcessor::dim_all)
985 .addFunction ("mono", &MonitorProcessor::mono)
986 .addFunction ("monitor_active", &MonitorProcessor::monitor_active)
987 .addFunction ("channel_cut_control", &MonitorProcessor::channel_cut_control)
988 .addFunction ("channel_dim_control", &MonitorProcessor::channel_dim_control)
989 .addFunction ("channel_polarity_control", &MonitorProcessor::channel_polarity_control)
990 .addFunction ("channel_solo_control", &MonitorProcessor::channel_solo_control)
991 .addFunction ("dim_control", &MonitorProcessor::dim_control)
992 .addFunction ("cut_control", &MonitorProcessor::cut_control)
993 .addFunction ("mono_control", &MonitorProcessor::mono_control)
994 .addFunction ("dim_level_control", &MonitorProcessor::dim_level_control)
995 .addFunction ("solo_boost_control", &MonitorProcessor::solo_boost_control)
998 .deriveWSPtrClass <UnknownProcessor, Processor> ("UnknownProcessor")
1001 .deriveWSPtrClass <PluginInsert::PluginControl, AutomationControl> ("PluginControl")
1004 .deriveWSPtrClass <AudioSource, Source> ("AudioSource")
1005 .addFunction ("readable_length", &AudioSource::readable_length)
1006 .addFunction ("n_channels", &AudioSource::n_channels)
1009 // <std::list<boost::shared_ptr <AudioTrack> >
1010 .beginStdList <boost::shared_ptr<AudioTrack> > ("AudioTrackList")
1013 // std::list<boost::shared_ptr <MidiTrack> >
1014 .beginStdList <boost::shared_ptr<MidiTrack> > ("MidiTrackList")
1017 // RouteList == std::list<boost::shared_ptr<Route> >
1018 .beginConstStdList <boost::shared_ptr<Route> > ("RouteList")
1021 // boost::shared_ptr<RouteList>
1022 .beginPtrStdList <boost::shared_ptr<Route> > ("RouteListPtr")
1025 // typedef std::list<boost::weak_ptr <Route> > WeakRouteList
1026 .beginConstStdList <boost::weak_ptr<Route> > ("WeakRouteList")
1029 // std::list< boost::weak_ptr <AudioSource> >
1030 .beginConstStdList <boost::weak_ptr<AudioSource> > ("WeakAudioSourceList")
1033 // typedef std::list<boost::shared_ptr<Region> > RegionList
1034 .beginConstStdList <boost::shared_ptr<Region> > ("RegionList")
1037 // boost::shared_ptr <std::list<boost::shared_ptr<Region> > >
1038 .beginPtrStdList <boost::shared_ptr<Region> > ("RegionListPtr")
1041 //std::list<boost::shared_ptr<Port> > PortList;
1042 .beginConstStdList <boost::shared_ptr<Port> > ("PortList")
1045 // used by Playlist::cut/copy
1046 .beginConstStdList <AudioRange> ("AudioRangeList")
1049 .beginConstStdList <Location*> ("LocationList")
1052 #if 0 // depends on Evoal:: Note, Beats see note_fixer.h
1053 // typedef Evoral::Note<Evoral::Beats> Note;
1054 // std::set< boost::weak_ptr<Note> >
1055 .beginStdSet <boost::weak_ptr<Note> > ("WeakNoteSet")
1059 // std::list<boost::weak_ptr<Source> >
1060 .beginConstStdList <boost::weak_ptr<Source> > ("WeakSourceList")
1063 .beginClass <Tempo> ("Tempo")
1064 .addConstructor <void (*) (double, double)> ()
1065 .addFunction ("note_type", &Tempo::note_type)
1066 .addFunction ("beats_per_minute", &Tempo::beats_per_minute)
1067 .addFunction ("frames_per_beat", &Tempo::frames_per_beat)
1070 .beginClass <Meter> ("Meter")
1071 .addConstructor <void (*) (double, double)> ()
1072 .addFunction ("divisions_per_bar", &Meter::divisions_per_bar)
1073 .addFunction ("note_divisor", &Meter::note_divisor)
1074 .addFunction ("frames_per_bar", &Meter::frames_per_bar)
1075 .addFunction ("frames_per_grid", &Meter::frames_per_grid)
1078 .beginClass <TempoMap> ("TempoMap")
1079 .addFunction ("add_tempo", &TempoMap::add_tempo)
1080 .addFunction ("add_meter", &TempoMap::add_meter)
1081 .addFunction ("tempo_section_at_frame", &TempoMap::tempo_section_at_frame)
1082 .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_frame)
1083 .addFunction ("meter_section_at_beat", &TempoMap::meter_section_at_beat)
1086 .beginClass <MetricSection> ("MetricSection")
1087 .addFunction ("pulse", &MetricSection::pulse)
1088 .addFunction ("set_pulse", &MetricSection::set_pulse)
1091 .deriveClass <TempoSection, MetricSection> ("TempoSection")
1092 .addFunction ("c_func", (double(TempoSection::*)()const)&TempoSection::c_func)
1095 .deriveClass <MeterSection, MetricSection> ("MeterSection")
1096 .addCast<Meter> ("to_meter")
1097 .addFunction ("set_pulse", &MeterSection::set_pulse)
1098 .addFunction ("set_beat", (void(MeterSection::*)(double))&MeterSection::set_beat)
1101 .beginClass <ChanCount> ("ChanCount")
1102 .addConstructor <void (*) (DataType, uint32_t)> ()
1103 .addFunction ("get", &ChanCount::get)
1104 .addFunction ("set", &ChanCount::set)
1105 .addFunction ("n_audio", &ChanCount::n_audio)
1106 .addFunction ("n_midi", &ChanCount::n_midi)
1107 .addFunction ("n_total", &ChanCount::n_total)
1108 .addFunction ("reset", &ChanCount::reset)
1111 .beginClass <DataType> ("DataType")
1112 .addConstructor <void (*) (std::string)> ()
1113 .addStaticCFunction ("null", &LuaAPI::datatype_ctor_null) // "nil" is a lua reseved word
1114 .addStaticCFunction ("audio", &LuaAPI::datatype_ctor_audio)
1115 .addStaticCFunction ("midi", &LuaAPI::datatype_ctor_midi)
1116 .addFunction ("to_string", &DataType::to_string) // TODO Lua __tostring
1117 // TODO add uint32_t cast, add operator== !=
1120 /* libardour enums */
1121 .beginNamespace ("PluginType")
1122 .addConst ("AudioUnit", ARDOUR::PluginType(AudioUnit))
1123 .addConst ("LADSPA", ARDOUR::PluginType(LADSPA))
1124 .addConst ("LV2", ARDOUR::PluginType(LV2))
1125 .addConst ("Windows_VST", ARDOUR::PluginType(Windows_VST))
1126 .addConst ("LXVST", ARDOUR::PluginType(LXVST))
1127 .addConst ("Lua", ARDOUR::PluginType(Lua))
1130 .beginNamespace ("PresentationInfo")
1131 .beginNamespace ("Flag")
1132 .addConst ("AudioTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioTrack))
1133 .addConst ("MidiTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiTrack))
1134 .addConst ("AudioBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioBus))
1135 .addConst ("MidiBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiBus))
1136 .addConst ("VCA", ARDOUR::PresentationInfo::Flag(PresentationInfo::VCA))
1137 .addConst ("MasterOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MasterOut))
1138 .addConst ("MonitorOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MonitorOut))
1139 .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner))
1140 .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected))
1141 .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden))
1142 .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet))
1143 .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask))
1147 .beginNamespace ("AutoStyle")
1148 .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
1149 .addConst ("Trim", ARDOUR::AutoStyle(Trim))
1152 .beginNamespace ("AutoState")
1153 .addConst ("Off", ARDOUR::AutoState(Off))
1154 .addConst ("Write", ARDOUR::AutoState(Write))
1155 .addConst ("Touch", ARDOUR::AutoState(Touch))
1156 .addConst ("Play", ARDOUR::AutoState(Play))
1159 .beginNamespace ("AutomationType")
1160 .addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation))
1161 .addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation))
1162 .addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation))
1163 .addConst ("SoloIsolateAutomation", ARDOUR::AutomationType(SoloIsolateAutomation))
1164 .addConst ("SoloSafeAutomation", ARDOUR::AutomationType(SoloSafeAutomation))
1165 .addConst ("MuteAutomation", ARDOUR::AutomationType(MuteAutomation))
1166 .addConst ("RecEnableAutomation", ARDOUR::AutomationType(RecEnableAutomation))
1167 .addConst ("RecSafeAutomation", ARDOUR::AutomationType(RecSafeAutomation))
1168 .addConst ("TrimAutomation", ARDOUR::AutomationType(TrimAutomation))
1169 .addConst ("PhaseAutomation", ARDOUR::AutomationType(PhaseAutomation))
1172 .beginNamespace ("SrcQuality")
1173 .addConst ("SrcBest", ARDOUR::SrcQuality(SrcBest))
1176 .beginNamespace ("MeterType")
1177 .addConst ("MeterMaxSignal", ARDOUR::MeterType(MeterMaxSignal))
1178 .addConst ("MeterMaxPeak", ARDOUR::MeterType(MeterMaxPeak))
1179 .addConst ("MeterPeak", ARDOUR::MeterType(MeterPeak))
1180 .addConst ("MeterKrms", ARDOUR::MeterType(MeterKrms))
1181 .addConst ("MeterK20", ARDOUR::MeterType(MeterK20))
1182 .addConst ("MeterK14", ARDOUR::MeterType(MeterK14))
1183 .addConst ("MeterIEC1DIN", ARDOUR::MeterType(MeterIEC1DIN))
1184 .addConst ("MeterIEC1NOR", ARDOUR::MeterType(MeterIEC1NOR))
1185 .addConst ("MeterIEC2BBC", ARDOUR::MeterType(MeterIEC2BBC))
1186 .addConst ("MeterIEC2EBU", ARDOUR::MeterType(MeterIEC2EBU))
1187 .addConst ("MeterVU", ARDOUR::MeterType(MeterVU))
1188 .addConst ("MeterK12", ARDOUR::MeterType(MeterK12))
1189 .addConst ("MeterPeak0dB", ARDOUR::MeterType(MeterPeak0dB))
1190 .addConst ("MeterMCP", ARDOUR::MeterType(MeterMCP))
1193 .beginNamespace ("MeterPoint")
1194 .addConst ("MeterInput", ARDOUR::MeterPoint(MeterInput))
1195 .addConst ("MeterPreFader", ARDOUR::MeterPoint(MeterPreFader))
1196 .addConst ("MeterPostFader", ARDOUR::MeterPoint(MeterPostFader))
1197 .addConst ("MeterOutput", ARDOUR::MeterPoint(MeterOutput))
1198 .addConst ("MeterCustom", ARDOUR::MeterPoint(MeterCustom))
1201 .beginNamespace ("PortFlags")
1202 .addConst ("IsInput", ARDOUR::PortFlags(IsInput))
1203 .addConst ("IsOutput", ARDOUR::PortFlags(IsOutput))
1204 .addConst ("IsPhysical", ARDOUR::PortFlags(IsPhysical))
1205 .addConst ("CanMonitor", ARDOUR::PortFlags(CanMonitor))
1206 .addConst ("IsTerminal", ARDOUR::PortFlags(IsTerminal))
1209 .beginNamespace ("PlaylistDisposition")
1210 .addConst ("CopyPlaylist", ARDOUR::PlaylistDisposition(CopyPlaylist))
1211 .addConst ("NewPlaylist", ARDOUR::PlaylistDisposition(NewPlaylist))
1212 .addConst ("SharePlaylist", ARDOUR::PlaylistDisposition(SharePlaylist))
1215 .beginNamespace ("RegionPoint")
1216 .addConst ("Start", ARDOUR::RegionPoint(Start))
1217 .addConst ("End", ARDOUR::RegionPoint(End))
1218 .addConst ("SyncPoint", ARDOUR::RegionPoint(SyncPoint))
1221 .beginNamespace ("TempoSection")
1222 .beginNamespace ("PositionLockStyle")
1223 .addConst ("AudioTime", ARDOUR::PositionLockStyle(AudioTime))
1224 .addConst ("MusicTime", ARDOUR::PositionLockStyle(MusicTime))
1228 .beginNamespace ("TempoSection")
1229 .beginNamespace ("Type")
1230 .addConst ("Ramp", ARDOUR::TempoSection::Type(TempoSection::Ramp))
1231 .addConst ("Constant", ARDOUR::TempoSection::Type(TempoSection::Constant))
1235 .beginNamespace ("TrackMode")
1236 .addConst ("Normal", ARDOUR::TrackMode(Start))
1237 .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered))
1238 .addConst ("Destructive", ARDOUR::TrackMode(Destructive))
1241 .beginNamespace ("SampleFormat")
1242 .addConst ("Float", ARDOUR::SampleFormat(FormatFloat))
1243 .addConst ("Int24", ARDOUR::SampleFormat(FormatInt24))
1244 .addConst ("Int16", ARDOUR::SampleFormat(FormatInt16))
1247 .beginNamespace ("HeaderFormat")
1248 .addConst ("BWF", ARDOUR::HeaderFormat(BWF))
1249 .addConst ("WAVE", ARDOUR::HeaderFormat(WAVE))
1250 .addConst ("WAVE64", ARDOUR::HeaderFormat(WAVE64))
1251 .addConst ("CAF", ARDOUR::HeaderFormat(CAF))
1252 .addConst ("AIFF", ARDOUR::HeaderFormat(AIFF))
1253 .addConst ("iXML", ARDOUR::HeaderFormat(iXML))
1254 .addConst ("RF64", ARDOUR::HeaderFormat(RF64))
1255 .addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
1256 .addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
1259 .beginNamespace ("InsertMergePolicy")
1260 .addConst ("Reject", ARDOUR::InsertMergePolicy(InsertMergeReject))
1261 .addConst ("Relax", ARDOUR::InsertMergePolicy(InsertMergeRelax))
1262 .addConst ("Replace", ARDOUR::InsertMergePolicy(InsertMergeReplace))
1263 .addConst ("TruncateExisting", ARDOUR::InsertMergePolicy(InsertMergeTruncateExisting))
1264 .addConst ("TruncateAddition", ARDOUR::InsertMergePolicy(InsertMergeTruncateAddition))
1265 .addConst ("Extend", ARDOUR::InsertMergePolicy(InsertMergeExtend))
1268 .endNamespace (); // end ARDOUR
1270 luabridge::getGlobalNamespace (L)
1271 .beginNamespace ("ARDOUR")
1272 .beginClass <AudioBackendInfo> ("AudioBackendInfo")
1273 .addData ("name", &AudioBackendInfo::name)
1275 .beginStdVector <const AudioBackendInfo*> ("BackendVector").endClass ()
1277 .beginClass <AudioBackend::DeviceStatus> ("DeviceStatus")
1278 .addData ("name", &AudioBackend::DeviceStatus::name)
1279 .addData ("available", &AudioBackend::DeviceStatus::available)
1281 .beginStdVector <AudioBackend::DeviceStatus> ("DeviceStatusVector").endClass ()
1283 .beginWSPtrClass <AudioBackend> ("AudioBackend")
1284 .addFunction ("info", &AudioBackend::info)
1285 .addFunction ("sample_rate", &AudioBackend::sample_rate)
1286 .addFunction ("buffer_size", &AudioBackend::buffer_size)
1287 .addFunction ("period_size", &AudioBackend::period_size)
1288 .addFunction ("input_channels", &AudioBackend::input_channels)
1289 .addFunction ("output_channels", &AudioBackend::output_channels)
1290 .addFunction ("dsp_load", &AudioBackend::dsp_load)
1292 .addFunction ("set_sample_rate", &AudioBackend::set_sample_rate)
1293 .addFunction ("set_buffer_size", &AudioBackend::set_buffer_size)
1294 .addFunction ("set_peridod_size", &AudioBackend::set_peridod_size)
1296 .addFunction ("enumerate_drivers", &AudioBackend::enumerate_drivers)
1297 .addFunction ("driver_name", &AudioBackend::driver_name)
1298 .addFunction ("set_driver", &AudioBackend::set_driver)
1300 .addFunction ("use_separate_input_and_output_devices", &AudioBackend::use_separate_input_and_output_devices)
1301 .addFunction ("enumerate_devices", &AudioBackend::enumerate_devices)
1302 .addFunction ("enumerate_input_devices", &AudioBackend::enumerate_input_devices)
1303 .addFunction ("enumerate_output_devices", &AudioBackend::enumerate_output_devices)
1304 .addFunction ("device_name", &AudioBackend::device_name)
1305 .addFunction ("input_device_name", &AudioBackend::input_device_name)
1306 .addFunction ("output_device_name", &AudioBackend::output_device_name)
1307 .addFunction ("set_device_name", &AudioBackend::set_device_name)
1308 .addFunction ("set_input_device_name", &AudioBackend::set_input_device_name)
1309 .addFunction ("set_output_device_name", &AudioBackend::set_output_device_name)
1312 .beginClass <PortEngine> ("PortEngine")
1315 .beginClass <PortManager> ("PortManager")
1316 .addFunction ("port_engine", &PortManager::port_engine)
1317 .addFunction ("connected", &PortManager::connected)
1318 .addFunction ("connect", &PortManager::connect)
1319 .addFunction ("physically_connected", &PortManager::physically_connected)
1320 .addFunction ("disconnect", (int (PortManager::*)(const std::string&, const std::string&))&PortManager::disconnect)
1321 .addFunction ("disconnect_port", (int (PortManager::*)(boost::shared_ptr<Port>))&PortManager::disconnect)
1322 .addFunction ("get_port_by_name", &PortManager::get_port_by_name)
1323 .addFunction ("get_pretty_name_by_name", &PortManager::get_pretty_name_by_name)
1324 .addFunction ("port_is_physical", &PortManager::port_is_physical)
1325 .addFunction ("get_physical_outputs", &PortManager::get_physical_outputs)
1326 .addFunction ("get_physical_inputs", &PortManager::get_physical_inputs)
1327 .addFunction ("n_physical_outputs", &PortManager::n_physical_outputs)
1328 .addFunction ("n_physical_inputs", &PortManager::n_physical_inputs)
1329 .addRefFunction ("get_connections", &PortManager::get_connections)
1330 .addRefFunction ("get_ports", (int (PortManager::*)(DataType, PortManager::PortList&))&PortManager::get_ports)
1331 .addRefFunction ("get_backend_ports", (int (PortManager::*)(const std::string&, DataType, PortFlags, std::vector<std::string>&))&PortManager::get_ports)
1334 .deriveClass <AudioEngine, PortManager> ("AudioEngine")
1335 .addFunction ("available_backends", &AudioEngine::available_backends)
1336 .addFunction ("current_backend_name", &AudioEngine::current_backend_name)
1337 .addFunction ("set_backend", &AudioEngine::set_backend)
1338 .addFunction ("setup_required", &AudioEngine::setup_required)
1339 .addFunction ("start", &AudioEngine::start)
1340 .addFunction ("stop", &AudioEngine::stop)
1341 .addFunction ("get_dsp_load", &AudioEngine::get_dsp_load)
1342 .addFunction ("set_device_name", &AudioEngine::set_device_name)
1343 .addFunction ("set_sample_rate", &AudioEngine::set_sample_rate)
1344 .addFunction ("set_buffer_size", &AudioEngine::set_buffer_size)
1345 .addFunction ("get_last_backend_error", &AudioEngine::get_last_backend_error)
1348 .deriveClass <SessionConfiguration, PBD::Configuration> ("SessionConfiguration")
1349 #undef CONFIG_VARIABLE
1350 #undef CONFIG_VARIABLE_SPECIAL
1351 #define CONFIG_VARIABLE(Type,var,name,value) \
1352 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1353 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1354 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1356 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
1357 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1358 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1359 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1361 #include "ardour/session_configuration_vars.h"
1363 #undef CONFIG_VARIABLE
1364 #undef CONFIG_VARIABLE_SPECIAL
1368 // basic representation of Session
1369 // functions which can be used from realtime and non-realtime contexts
1370 luabridge::getGlobalNamespace (L)
1371 .beginNamespace ("ARDOUR")
1372 .beginClass <Session> ("Session")
1373 .addFunction ("scripts_changed", &Session::scripts_changed) // used internally
1374 .addFunction ("transport_rolling", &Session::transport_rolling)
1375 .addFunction ("request_transport_speed", &Session::request_transport_speed)
1376 .addFunction ("transport_frame", &Session::transport_frame)
1377 .addFunction ("transport_speed", &Session::transport_speed)
1378 .addFunction ("frame_rate", &Session::frame_rate)
1379 .addFunction ("nominal_frame_rate", &Session::nominal_frame_rate)
1380 .addFunction ("frames_per_timecode_frame", &Session::frames_per_timecode_frame)
1381 .addFunction ("timecode_frames_per_hour", &Session::timecode_frames_per_hour)
1382 .addFunction ("timecode_frames_per_second", &Session::timecode_frames_per_second)
1383 .addFunction ("timecode_drop_frames", &Session::timecode_drop_frames)
1384 .addFunction ("request_locate", &Session::request_locate)
1385 .addFunction ("request_stop", &Session::request_stop)
1386 .addFunction ("request_play_loop", &Session::request_play_loop)
1387 .addFunction ("get_play_loop", &Session::get_play_loop)
1388 .addFunction ("last_transport_start", &Session::last_transport_start)
1389 .addFunction ("goto_start", &Session::goto_start)
1390 .addFunction ("goto_end", &Session::goto_end)
1391 .addFunction ("current_start_frame", &Session::current_start_frame)
1392 .addFunction ("current_end_frame", &Session::current_end_frame)
1393 .addFunction ("actively_recording", &Session::actively_recording)
1394 .addFunction ("new_audio_track", &Session::new_audio_track)
1395 .addFunction ("new_audio_route", &Session::new_audio_route)
1396 .addFunction ("new_midi_track", &Session::new_midi_track)
1397 .addFunction ("new_midi_route", &Session::new_midi_route)
1398 .addFunction ("get_routes", &Session::get_routes)
1399 .addFunction ("get_tracks", &Session::get_tracks)
1400 .addFunction ("name", &Session::name)
1401 .addFunction ("path", &Session::path)
1402 .addFunction ("record_status", &Session::record_status)
1403 .addFunction ("maybe_enable_record", &Session::maybe_enable_record)
1404 .addFunction ("disable_record", &Session::disable_record)
1405 .addFunction ("route_by_id", &Session::route_by_id)
1406 .addFunction ("route_by_name", &Session::route_by_name)
1407 .addFunction ("get_remote_nth_stripable", &Session::get_remote_nth_stripable)
1408 .addFunction ("get_remote_nth_route", &Session::get_remote_nth_route)
1409 .addFunction ("route_by_selected_count", &Session::route_by_selected_count)
1410 .addFunction ("track_by_diskstream_id", &Session::track_by_diskstream_id)
1411 .addFunction ("source_by_id", &Session::source_by_id)
1412 .addFunction ("controllable_by_id", &Session::controllable_by_id)
1413 .addFunction ("processor_by_id", &Session::processor_by_id)
1414 .addFunction ("snap_name", &Session::snap_name)
1415 .addFunction ("monitor_out", &Session::monitor_out)
1416 .addFunction ("master_out", &Session::master_out)
1417 .addFunction ("tempo_map", (TempoMap& (Session::*)())&Session::tempo_map)
1418 .addFunction ("locations", &Session::locations)
1419 .addFunction ("begin_reversible_command", (void (Session::*)(const std::string&))&Session::begin_reversible_command)
1420 .addFunction ("commit_reversible_command", &Session::commit_reversible_command)
1421 .addFunction ("abort_reversible_command", &Session::abort_reversible_command)
1422 .addFunction ("add_command", &Session::add_command)
1423 .addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command)
1424 .addFunction ("engine", (AudioEngine& (Session::*)())&Session::engine)
1425 .addFunction ("get_block_size", &Session::get_block_size)
1426 .addFunction ("worst_output_latency", &Session::worst_output_latency)
1427 .addFunction ("worst_input_latency", &Session::worst_input_latency)
1428 .addFunction ("worst_track_latency", &Session::worst_track_latency)
1429 .addFunction ("worst_playback_latency", &Session::worst_playback_latency)
1430 .addFunction ("cfg", &Session::cfg)
1433 .beginClass <RegionFactory> ("RegionFactory")
1434 .addStaticFunction ("region_by_id", &RegionFactory::region_by_id)
1437 /* session enums (rt-safe, common) */
1438 .beginNamespace ("Session")
1440 .beginNamespace ("RecordState")
1441 .addConst ("Disabled", ARDOUR::Session::RecordState(Session::Disabled))
1442 .addConst ("Enabled", ARDOUR::Session::RecordState(Session::Enabled))
1443 .addConst ("Recording", ARDOUR::Session::RecordState(Session::Recording))
1446 .endNamespace () // end Session enums
1448 /* ardour enums (rt-safe, common) */
1449 .beginNamespace ("LocationFlags")
1450 .addConst ("IsMark", ARDOUR::Location::Flags(Location::IsMark))
1451 .addConst ("IsAutoPunch", ARDOUR::Location::Flags(Location::IsAutoPunch))
1452 .addConst ("IsAutoLoop", ARDOUR::Location::Flags(Location::IsAutoLoop))
1453 .addConst ("IsHidden", ARDOUR::Location::Flags(Location::IsHidden))
1454 .addConst ("IsCDMarker", ARDOUR::Location::Flags(Location::IsCDMarker))
1455 .addConst ("IsRangeMarker", ARDOUR::Location::Flags(Location::IsRangeMarker))
1456 .addConst ("IsSessionRange", ARDOUR::Location::Flags(Location::IsSessionRange))
1457 .addConst ("IsSkip", ARDOUR::Location::Flags(Location::IsSkip))
1458 .addConst ("IsSkipping", ARDOUR::Location::Flags(Location::IsSkipping))
1461 .beginNamespace ("LuaAPI")
1462 .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor)
1463 .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc)
1464 .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info)
1465 .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
1466 .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
1467 .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param)
1468 .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
1469 .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
1470 .addFunction ("usleep", Glib::usleep)
1471 .endNamespace () // end LuaAPI
1472 .endNamespace ();// end ARDOUR
1476 LuaBindings::dsp (lua_State* L)
1478 luabridge::getGlobalNamespace (L)
1479 .beginNamespace ("ARDOUR")
1481 .beginClass <AudioBuffer> ("AudioBuffer")
1483 .addFunction ("data", (Sample*(AudioBuffer::*)(framecnt_t))&AudioBuffer::data)
1484 .addFunction ("silence", &AudioBuffer::silence)
1485 .addFunction ("apply_gain", &AudioBuffer::apply_gain)
1486 .addFunction ("check_silence", &AudioBuffer::check_silence)
1487 .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, framecnt_t, framecnt_t, framecnt_t))&AudioBuffer::check_silence)
1490 .beginClass <MidiBuffer> ("MidiBuffer")
1492 .addFunction ("silence", &MidiBuffer::silence)
1493 .addFunction ("size", &MidiBuffer::size)
1494 .addFunction ("empty", &MidiBuffer::empty)
1495 .addFunction ("resize", &MidiBuffer::resize)
1496 .addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy)
1497 .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::MIDIEvent<framepos_t>&))&MidiBuffer::push_back)
1498 .addFunction ("push_back", (bool (MidiBuffer::*)(framepos_t, size_t, const uint8_t*))&MidiBuffer::push_back)
1500 .addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::MIDIEvent<framepos_t>, MidiBuffer>)
1503 .beginClass <BufferSet> ("BufferSet")
1505 .addFunction ("get_audio", static_cast<AudioBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_audio))
1506 .addFunction ("get_midi", static_cast<MidiBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_midi))
1507 .addFunction ("count", static_cast<const ChanCount&(BufferSet::*)()const>(&BufferSet::count))
1511 luabridge::getGlobalNamespace (L)
1512 .beginNamespace ("Evoral")
1513 .beginClass <Evoral::Event<framepos_t> > ("Event")
1514 .addFunction ("clear", &Evoral::Event<framepos_t>::clear)
1515 .addFunction ("size", &Evoral::Event<framepos_t>::size)
1516 .addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
1517 .addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
1518 .addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
1521 .beginClass <Evoral::Beats> ("Beats")
1522 .addFunction ("to_double", &Evoral::Beats::to_double)
1525 .deriveClass <Evoral::MIDIEvent<framepos_t>, Evoral::Event<framepos_t> > ("MidiEvent")
1527 .addFunction ("type", &Evoral::MIDIEvent<framepos_t>::type)
1528 .addFunction ("channel", &Evoral::MIDIEvent<framepos_t>::channel)
1529 .addFunction ("set_type", &Evoral::MIDIEvent<framepos_t>::set_type)
1530 .addFunction ("set_channel", &Evoral::MIDIEvent<framepos_t>::set_channel)
1534 // dsp releated session functions
1535 luabridge::getGlobalNamespace (L)
1536 .beginNamespace ("ARDOUR")
1537 .beginClass <Session> ("Session")
1538 .addFunction ("get_scratch_buffers", &Session::get_scratch_buffers)
1539 .addFunction ("get_silent_buffers", &Session::get_silent_buffers)
1543 luabridge::getGlobalNamespace (L)
1544 .beginNamespace ("ARDOUR")
1545 .beginClass <FluidSynth> ("FluidSynth")
1546 .addConstructor <void (*) (float, int)> ()
1547 .addFunction ("load_sf2", &FluidSynth::load_sf2)
1548 .addFunction ("synth", &FluidSynth::synth)
1549 .addFunction ("midi_event", &FluidSynth::midi_event)
1550 .addFunction ("panic", &FluidSynth::panic)
1551 .addFunction ("select_program", &FluidSynth::select_program)
1552 .addFunction ("program_count", &FluidSynth::program_count)
1553 .addFunction ("program_name", &FluidSynth::program_name)
1557 luabridge::getGlobalNamespace (L)
1558 .beginNamespace ("ARDOUR")
1559 .beginNamespace ("DSP")
1560 .addFunction ("compute_peak", ARDOUR::compute_peak)
1561 .addFunction ("find_peaks", ARDOUR::find_peaks)
1562 .addFunction ("apply_gain_to_buffer", ARDOUR::apply_gain_to_buffer)
1563 .addFunction ("mix_buffers_no_gain", ARDOUR::mix_buffers_no_gain)
1564 .addFunction ("mix_buffers_with_gain", ARDOUR::mix_buffers_with_gain)
1565 .addFunction ("copy_vector", ARDOUR::copy_vector)
1566 .addFunction ("dB_to_coefficient", &dB_to_coefficient)
1567 .addFunction ("fast_coefficient_to_dB", &fast_coefficient_to_dB)
1568 .addFunction ("accurate_coefficient_to_dB", &accurate_coefficient_to_dB)
1569 .addFunction ("memset", &DSP::memset)
1570 .addFunction ("mmult", &DSP::mmult)
1571 .addFunction ("log_meter", &DSP::log_meter)
1572 .addFunction ("log_meter_coeff", &DSP::log_meter_coeff)
1573 .addFunction ("process_map", &DSP::process_map)
1574 .addRefFunction ("peaks", &DSP::peaks)
1576 .beginClass <DSP::LowPass> ("LowPass")
1577 .addConstructor <void (*) (double, float)> ()
1578 .addFunction ("proc", &DSP::LowPass::proc)
1579 .addFunction ("ctrl", &DSP::LowPass::ctrl)
1580 .addFunction ("set_cutoff", &DSP::LowPass::set_cutoff)
1581 .addFunction ("reset", &DSP::LowPass::reset)
1583 .beginClass <DSP::Biquad> ("Biquad")
1584 .addConstructor <void (*) (double)> ()
1585 .addFunction ("run", &DSP::Biquad::run)
1586 .addFunction ("compute", &DSP::Biquad::compute)
1587 .addFunction ("configure", &DSP::Biquad::configure)
1588 .addFunction ("reset", &DSP::Biquad::reset)
1589 .addFunction ("dB_at_freq", &DSP::Biquad::dB_at_freq)
1591 .beginClass <DSP::FFTSpectrum> ("FFTSpectrum")
1592 .addConstructor <void (*) (uint32_t, double)> ()
1593 .addFunction ("set_data_hann", &DSP::FFTSpectrum::set_data_hann)
1594 .addFunction ("execute", &DSP::FFTSpectrum::execute)
1595 .addFunction ("power_at_bin", &DSP::FFTSpectrum::power_at_bin)
1596 .addFunction ("freq_at_bin", &DSP::FFTSpectrum::freq_at_bin)
1600 .beginNamespace ("BiquadType")
1601 .addConst ("LowPass", ARDOUR::DSP::Biquad::LowPass)
1602 .addConst ("HighPass", ARDOUR::DSP::Biquad::HighPass)
1603 .addConst ("BandPassSkirt", ARDOUR::DSP::Biquad::BandPassSkirt)
1604 .addConst ("BandPass0dB", ARDOUR::DSP::Biquad::BandPass0dB)
1605 .addConst ("Notch", ARDOUR::DSP::Biquad::Notch)
1606 .addConst ("AllPass", ARDOUR::DSP::Biquad::AllPass)
1607 .addConst ("Peaking", ARDOUR::DSP::Biquad::Peaking)
1608 .addConst ("LowShelf", ARDOUR::DSP::Biquad::LowShelf)
1609 .addConst ("HighShelf", ARDOUR::DSP::Biquad::HighShelf)
1612 .beginClass <DSP::DspShm> ("DspShm")
1613 .addConstructor<void (*) (size_t)> ()
1614 .addFunction ("allocate", &DSP::DspShm::allocate)
1615 .addFunction ("clear", &DSP::DspShm::clear)
1616 .addFunction ("to_float", &DSP::DspShm::to_float)
1617 .addFunction ("to_int", &DSP::DspShm::to_int)
1618 .addFunction ("atomic_set_int", &DSP::DspShm::atomic_set_int)
1619 .addFunction ("atomic_get_int", &DSP::DspShm::atomic_get_int)
1622 .endNamespace () // DSP
1624 .beginClass <LuaTableRef> ("LuaTableRef")
1625 .addCFunction ("get", &LuaTableRef::get)
1626 .addCFunction ("set", &LuaTableRef::set)
1629 .endNamespace (); // ARDOUR
1633 LuaBindings::session (lua_State* L)
1635 // non-realtime session functions
1636 luabridge::getGlobalNamespace (L)
1637 .beginNamespace ("ARDOUR")
1638 .beginClass <Session> ("Session")
1639 .addFunction ("save_state", &Session::save_state)
1640 .addFunction ("set_dirty", &Session::set_dirty)
1641 .addFunction ("unknown_processors", &Session::unknown_processors)
1643 .addFunction<RouteList (Session::*)(uint32_t, PresentationInfo::order_t, const std::string&, const std::string&, PlaylistDisposition)> ("new_route_from_template", &Session::new_route_from_template)
1644 // TODO session_add_audio_track session_add_midi_track session_add_mixed_track
1645 //.addFunction ("new_midi_track", &Session::new_midi_track)
1648 .endNamespace (); // ARDOUR
1652 LuaBindings::osc (lua_State* L)
1654 luabridge::getGlobalNamespace (L)
1655 .beginNamespace ("ARDOUR")
1656 .beginNamespace ("LuaOSC")
1657 .beginClass<LuaOSC::Address> ("Address")
1658 .addConstructor<void (*) (std::string)> ()
1659 .addCFunction ("send", &LuaOSC::Address::send)
1666 LuaBindings::set_session (lua_State* L, Session *s)
1668 /* LuaBridge uses unique keys to identify classes/c-types.
1670 * Those keys are "generated" by using the memory-address of a static
1671 * variable, templated for every Class.
1672 * (see libs/lua/LuaBridge/detail/ClassInfo.h)
1674 * When linking the final executable there must be exactly one static
1675 * function (static variable) for every templated class.
1676 * This works fine on OSX and Linux...
1678 * Windows (mingw and MSVC) however expand the template differently for libardour
1679 * AND gtk2_ardour. We end up with two identical static functions
1680 * at different addresses!!
1682 * The Solution: have gtk2_ardour never include LuaBridge headers directly
1683 * and always go via libardour function calls for classes that are registered
1684 * in libardour. (calling lua itself is fine, calling c-functions in the GUI
1685 * which expand the template is not)
1687 * (the actual cause: even static symbols in a .dll have no fixed address
1688 * and are mapped when loading the dll. static functions in .exe do have a fixed
1692 * 0000000000000000 I __imp__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1693 * 0000000000000000 I __nm__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1694 * 0000000000000000 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
1697 * 000000000104f560 d .data$_ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1698 * 000000000104f560 D _ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1699 * 0000000000e9baf0 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
1703 luabridge::push <Session *> (L, s);
1704 lua_setglobal (L, "Session");
1707 // call lua function.
1708 luabridge::LuaRef cb_ses = luabridge::getGlobal (L, "new_session");
1709 if (cb_ses.type() == LUA_TFUNCTION) { cb_ses(s->name()); } // TODO args