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/interthread_info.h"
40 #include "ardour/lua_api.h"
41 #include "ardour/luabindings.h"
42 #include "ardour/luaproc.h"
43 #include "ardour/meter.h"
44 #include "ardour/midi_track.h"
45 #include "ardour/midi_port.h"
46 #include "ardour/phase_control.h"
47 #include "ardour/playlist.h"
48 #include "ardour/plugin.h"
49 #include "ardour/plugin_insert.h"
50 #include "ardour/port_manager.h"
51 #include "ardour/runtime_functions.h"
52 #include "ardour/region.h"
53 #include "ardour/region_factory.h"
54 #include "ardour/route_group.h"
55 #include "ardour/session.h"
56 #include "ardour/session_object.h"
57 #include "ardour/sidechain.h"
58 #include "ardour/solo_isolate_control.h"
59 #include "ardour/solo_safe_control.h"
60 #include "ardour/stripable.h"
61 #include "ardour/track.h"
62 #include "ardour/tempo.h"
64 #include "LuaBridge/LuaBridge.h"
66 #ifdef PLATFORM_WINDOWS
67 /* luabridge uses addresses of static functions/variables to identify classes.
69 * Static symbols on windows (even identical symbols) are not
70 * mapped to the same address when mixing .dll + .exe.
71 * So we need a single point to define those static functions.
72 * (normally they're header-only in libs/lua/LuaBridge/detail/ClassInfo.h)
74 * Really!! A static function with a static variable in a library header
75 * should never ever be replicated, even if it is a template.
76 * But then again this is windows... what else can go wrong.
81 luabridge::ClassInfo<T>::getStaticKey ()
89 luabridge::ClassInfo<T>::getClassKey ()
97 luabridge::ClassInfo<T>::getConstKey ()
104 luabridge::getIdentityKey ()
110 /* ...and this is the ugly part of it.
112 * We need to foward declare classes from gtk2_ardour
113 * end explicily list classes which are used by gtk2_ardour's bindings.
115 * This is needed because some of the GUI classes use objects from libardour
116 * as function parameters and the .exe would re-create symbols for libardour
119 * Classes which don't use libardour symbols could be moved to
120 * gtk2_ardour/luainstance.cc, but keeping this here reduces code
121 * duplication and does not give the compiler a chance to even think
122 * about replicating the symbols.
125 #define CLASSKEYS(CLS) \
126 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
127 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
128 template void const* luabridge::ClassInfo< CLS >::getConstKey();
130 #define CLASSINFO(CLS) \
132 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
133 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
134 template void const* luabridge::ClassInfo< CLS >::getConstKey();
136 CLASSINFO(MarkerSelection);
137 CLASSINFO(TrackSelection);
138 CLASSINFO(TrackViewList);
139 CLASSINFO(TimeSelection);
140 CLASSINFO(RegionSelection);
141 CLASSINFO(PublicEditor);
142 CLASSINFO(Selection);
143 CLASSINFO(ArdourMarker);
149 CLASSKEYS(LuaCairo::ImageSurface);
150 CLASSKEYS(LuaCairo::PangoLayout);
155 CLASSKEYS(Cairo::Context);
156 CLASSKEYS(std::vector<double>);
157 CLASSKEYS(std::list<ArdourMarker*>);
158 CLASSKEYS(std::bitset<47ul>); // LuaSignal::LAST_SIGNAL
159 CLASSKEYS(ArdourMarker*);
160 CLASSKEYS(ARDOUR::RouteGroup);
161 CLASSKEYS(ARDOUR::LuaProc);
162 CLASSKEYS(ARDOUR::DataType);
163 CLASSKEYS(ARDOUR::ChanCount);
164 CLASSKEYS(boost::shared_ptr<ARDOUR::Processor>);
165 CLASSKEYS(ARDOUR::ParameterDescriptor);
166 CLASSKEYS(boost::shared_ptr<ARDOUR::AutomationList>);
167 CLASSKEYS(boost::shared_ptr<Evoral::ControlList>);
168 CLASSKEYS(ARDOUR::LuaOSC::Address);
169 CLASSKEYS(ARDOUR::Session);
170 CLASSKEYS(ARDOUR::BufferSet);
171 CLASSKEYS(ARDOUR::ChanMapping);
172 CLASSKEYS(ARDOUR::DSP::DspShm);
173 CLASSKEYS(ARDOUR::LuaTableRef);
174 CLASSKEYS(PBD::Configuration);
175 CLASSKEYS(ARDOUR::PresentationInfo);
176 CLASSKEYS(ARDOUR::SessionConfiguration);
178 CLASSKEYS(ARDOUR::Location);
179 CLASSKEYS(ARDOUR::PluginInfo);
180 CLASSKEYS(ARDOUR::MonitorProcessor);
181 CLASSKEYS(PBD::PropertyChange);
182 CLASSKEYS(std::vector<std::string>);
183 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
184 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Port> >);
185 CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
186 CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
187 CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
188 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Region> >);
189 CLASSKEYS(std::list<ARDOUR::AudioRange>);
190 CLASSKEYS(Evoral::Beats);
191 CLASSKEYS(ARDOUR::PortEngine);
192 CLASSKEYS(ARDOUR::PortManager);
193 CLASSKEYS(ARDOUR::AudioEngine);
197 #endif // end windows special case
199 /* Some notes on Lua bindings for libardour and friends
201 * - Prefer factory methods over Contructors whenever possible.
202 * Don't expose the constructor method unless required.
204 * e.g. Don't allow the script to construct a "Track" Object directly
205 * but do allow to create a "BBT_TIME" object.
207 * - Do not dereference Shared or Weak Pointers. Pass the pointer to Lua.
208 * - Define Objects as boost:shared_ptr Object whenever possible.
210 * Storing a boost::shared_ptr in a Lua-variable keeps the reference
211 * until that variable is set to 'nil'.
212 * (if the script were to keep a direct pointer to the object instance, the
213 * behaviour is undefined if the actual object goes away)
215 * Methods of the actual class are indirectly exposed,
216 * boost::*_ptr get() and ::lock() is implicit when the class is exported
217 * as LuaBridge's "WSPtrClass".
220 using namespace ARDOUR;
223 LuaBindings::stddef (lua_State* L)
225 // std::list<std::string>
226 luabridge::getGlobalNamespace (L)
227 .beginNamespace ("C")
228 .beginStdList <std::string> ("StringList")
231 // std::vector<std::string>
232 .beginStdVector <std::string> ("StringVector")
235 // register float array (uint8_t*)
236 .registerArray <uint8_t> ("ByteArray")
238 // register float array (float*)
239 .registerArray <float> ("FloatArray")
241 // register float array (int32_t*)
242 .registerArray <int32_t> ("IntArray")
249 LuaBindings::common (lua_State* L)
251 luabridge::getGlobalNamespace (L)
252 .beginNamespace ("PBD")
254 .addFunction ("open_uri", (bool (*) (const std::string&))&PBD::open_uri)
255 .addFunction ("open_uri", &PBD::open_folder)
257 .beginClass <PBD::ID> ("ID")
258 .addConstructor <void (*) (std::string)> ()
259 .addFunction ("to_s", &PBD::ID::to_s) // TODO special case LUA __tostring ?
262 .beginStdVector <PBD::ID> ("IdVector").endClass ()
264 .beginClass <XMLNode> ("XMLNode")
265 .addFunction ("name", &XMLNode::name)
268 .beginClass <PBD::Stateful> ("Stateful")
269 .addFunction ("id", &PBD::Stateful::id)
270 .addFunction ("properties", &PBD::Stateful::properties)
271 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
274 .beginWSPtrClass <PBD::Stateful> ("StatefulPtr")
275 .addFunction ("id", &PBD::Stateful::id)
276 .addFunction ("properties", &PBD::Stateful::properties)
277 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
280 .deriveClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructible")
283 .deriveClass <PBD::Configuration, PBD::Stateful> ("Configuration")
286 .deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructiblePtr")
289 .deriveClass <Command, PBD::StatefulDestructible> ("Command")
290 .addFunction ("set_name", &Command::set_name)
291 .addFunction ("name", &Command::name)
294 /* UndoTransaction::add_command() subscribes to DropReferences()
295 * and deletes the object.
297 * This object cannot be constructed by lua because lua would manage lifetime
298 * and delete the object leading to a double free.
300 * use Session::add_stateful_diff_command()
301 * and Session::abort_reversible_command()
303 .deriveClass <PBD::StatefulDiffCommand, Command> ("StatefulDiffCommand")
304 .addFunction ("undo", &PBD::StatefulDiffCommand::undo)
305 .addFunction ("empty", &PBD::StatefulDiffCommand::empty)
308 .deriveWSPtrClass <PBD::Controllable, PBD::StatefulDestructible> ("Controllable")
309 .addFunction ("name", &PBD::Controllable::name)
310 .addFunction ("get_value", &PBD::Controllable::get_value)
313 .beginClass <PBD::RingBufferNPT <uint8_t> > ("RingBuffer8")
314 .addConstructor <void (*) (size_t)> ()
315 .addFunction ("reset", &PBD::RingBufferNPT<uint8_t>::reset)
316 .addFunction ("read", &PBD::RingBufferNPT<uint8_t>::read)
317 .addFunction ("write", &PBD::RingBufferNPT<uint8_t>::write)
318 .addFunction ("write_one", &PBD::RingBufferNPT<uint8_t>::write_one)
319 .addFunction ("write_space", &PBD::RingBufferNPT<uint8_t>::write_space)
320 .addFunction ("read_space", &PBD::RingBufferNPT<uint8_t>::read_space)
321 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<uint8_t>::increment_read_ptr)
322 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<uint8_t>::increment_write_ptr)
325 .beginClass <PBD::RingBufferNPT <float> > ("RingBufferF")
326 .addConstructor <void (*) (size_t)> ()
327 .addFunction ("reset", &PBD::RingBufferNPT<float>::reset)
328 .addFunction ("read", &PBD::RingBufferNPT<float>::read)
329 .addFunction ("write", &PBD::RingBufferNPT<float>::write)
330 .addFunction ("write_one", &PBD::RingBufferNPT<float>::write_one)
331 .addFunction ("write_space", &PBD::RingBufferNPT<float>::write_space)
332 .addFunction ("read_space", &PBD::RingBufferNPT<float>::read_space)
333 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<float>::increment_read_ptr)
334 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<float>::increment_write_ptr)
337 .beginClass <PBD::RingBufferNPT <int> > ("RingBufferI")
338 .addConstructor <void (*) (size_t)> ()
339 .addFunction ("reset", &PBD::RingBufferNPT<int>::reset)
340 .addFunction ("read", &PBD::RingBufferNPT<int>::read)
341 .addFunction ("write", &PBD::RingBufferNPT<int>::write)
342 .addFunction ("write_one", &PBD::RingBufferNPT<int>::write_one)
343 .addFunction ("write_space", &PBD::RingBufferNPT<int>::write_space)
344 .addFunction ("read_space", &PBD::RingBufferNPT<int>::read_space)
345 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<int>::increment_read_ptr)
346 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<int>::increment_write_ptr)
350 .beginNamespace ("GroupControlDisposition")
351 .addConst ("InverseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::InverseGroup))
352 .addConst ("NoGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::NoGroup))
353 .addConst ("UseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::UseGroup))
356 .endNamespace (); // PBD
358 luabridge::getGlobalNamespace (L)
359 .beginNamespace ("Timecode")
360 .beginClass <Timecode::BBT_Time> ("BBT_TIME")
361 .addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
364 /* libtimecode enums */
365 .beginNamespace ("TimecodeFormat")
366 .addConst ("TC23976", Timecode::TimecodeFormat(Timecode::timecode_23976))
367 .addConst ("TC24", Timecode::TimecodeFormat(Timecode::timecode_24))
368 .addConst ("TC24976", Timecode::TimecodeFormat(Timecode::timecode_24976))
369 .addConst ("TC25", Timecode::TimecodeFormat(Timecode::timecode_25))
370 .addConst ("TC2997", Timecode::TimecodeFormat(Timecode::timecode_2997))
371 .addConst ("TC2997DF", Timecode::TimecodeFormat(Timecode::timecode_2997drop))
372 .addConst ("TC2997000", Timecode::TimecodeFormat(Timecode::timecode_2997000))
373 .addConst ("TC2997000DF", Timecode::TimecodeFormat(Timecode::timecode_2997000drop))
374 .addConst ("TC30", Timecode::TimecodeFormat(Timecode::timecode_30))
375 .addConst ("TC5994", Timecode::TimecodeFormat(Timecode::timecode_5994))
376 .addConst ("TC60", Timecode::TimecodeFormat(Timecode::timecode_60))
380 luabridge::getGlobalNamespace (L)
382 .beginNamespace ("Evoral")
383 .beginClass <Evoral::Parameter> ("Parameter")
384 .addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
385 .addFunction ("type", &Evoral::Parameter::type)
386 .addFunction ("channel", &Evoral::Parameter::channel)
387 .addFunction ("id", &Evoral::Parameter::id)
390 .beginWSPtrClass <Evoral::ControlList> ("ControlList")
391 .addFunction ("add", &Evoral::ControlList::add)
392 .addFunction ("thin", &Evoral::ControlList::thin)
393 .addFunction ("eval", &Evoral::ControlList::eval)
394 .addRefFunction ("rt_safe_eval", &Evoral::ControlList::rt_safe_eval)
395 .addFunction ("interpolation", &Evoral::ControlList::interpolation)
396 .addFunction ("set_interpolation", &Evoral::ControlList::set_interpolation)
397 .addFunction ("truncate_end", &Evoral::ControlList::truncate_end)
398 .addFunction ("truncate_start", &Evoral::ControlList::truncate_start)
399 .addFunction ("clear", (void (Evoral::ControlList::*)(double, double))&Evoral::ControlList::clear)
400 .addFunction ("in_write_pass", &Evoral::ControlList::in_write_pass)
403 .beginWSPtrClass <Evoral::ControlSet> ("ControlSet")
406 .beginWSPtrClass <Evoral::Control> ("Control")
407 .addFunction ("list", (boost::shared_ptr<Evoral::ControlList>(Evoral::Control::*)())&Evoral::Control::list)
410 .beginClass <Evoral::ParameterDescriptor> ("ParameterDescriptor")
411 .addVoidConstructor ()
412 .addData ("lower", &Evoral::ParameterDescriptor::lower)
413 .addData ("upper", &Evoral::ParameterDescriptor::upper)
414 .addData ("normal", &Evoral::ParameterDescriptor::normal)
415 .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
418 .beginClass <Evoral::Range<framepos_t> > ("Range")
419 .addConstructor <void (*) (framepos_t, framepos_t)> ()
420 .addData ("from", &Evoral::Range<framepos_t>::from)
421 .addData ("to", &Evoral::Range<framepos_t>::to)
424 /* libevoral enums */
425 .beginNamespace ("InterpolationStyle")
426 .addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete))
427 .addConst ("Linear", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Linear))
428 .addConst ("Curved", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Curved))
431 .endNamespace () // Evoral
433 .beginNamespace ("ARDOUR")
435 .beginClass <InterThreadInfo> ("InterThreadInfo")
436 .addVoidConstructor ()
437 .addData ("done", const_cast<bool InterThreadInfo::*>(&InterThreadInfo::done))
438 #if 0 // currently unused, lua is single-threaded, no custom UIs.
439 .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel)
441 .addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress))
444 .beginClass <AudioRange> ("AudioRange")
445 .addConstructor <void (*) (framepos_t, framepos_t, uint32_t)> ()
446 .addFunction ("length", &AudioRange::length)
447 .addFunction ("equal", &AudioRange::equal)
448 .addData ("start", &AudioRange::start)
449 .addData ("_end", &AudioRange::end) // XXX "end" is a lua reserved word
450 .addData ("id", &AudioRange::id)
453 .beginWSPtrClass <PluginInfo> ("PluginInfo")
454 .addVoidConstructor ()
457 .beginNamespace ("Route")
458 .beginClass <Route::ProcessorStreams> ("ProcessorStreams")
459 .addVoidConstructor ()
463 .beginClass <ChanMapping> ("ChanMapping")
464 .addVoidConstructor ()
465 .addFunction ("get", static_cast<uint32_t(ChanMapping::*)(DataType, uint32_t) const>(&ChanMapping::get))
466 .addFunction ("set", &ChanMapping::set)
467 .addFunction ("count", &ChanMapping::count)
468 .addFunction ("n_total", &ChanMapping::n_total)
469 .addFunction ("is_monotonic", &ChanMapping::is_monotonic)
470 .addConst ("Invalid", 4294967295U) // UINT32_MAX
473 .beginNamespace ("Properties")
474 // templated class definitions
475 .beginClass <PBD::PropertyDescriptor<bool> > ("BoolProperty").endClass ()
476 .beginClass <PBD::PropertyDescriptor<float> > ("FloatProperty").endClass ()
477 .beginClass <PBD::PropertyDescriptor<framepos_t> > ("FrameposProperty").endClass ()
478 // actual references (TODO: also expose GQuark for std::set)
480 .addConst ("Start", &ARDOUR::Properties::start)
481 .addConst ("Length", &ARDOUR::Properties::length)
482 .addConst ("Position", &ARDOUR::Properties::position)
485 .beginClass <PBD::PropertyChange> ("PropertyChange")
486 // TODO add special handling (std::set<PropertyID>), PropertyID is a GQuark.
487 // -> direct map to lua table beginStdSet()A
489 // expand templated PropertyDescriptor<T>
490 .addFunction ("containsBool", &PBD::PropertyChange::contains<bool>)
491 .addFunction ("containsFloat", &PBD::PropertyChange::contains<float>)
492 .addFunction ("containsFramePos", &PBD::PropertyChange::contains<framepos_t>)
495 .beginClass <PBD::PropertyList> ("PropertyList")
496 // is-a std::map<PropertyID, PropertyBase*>
499 .deriveClass <PBD::OwnedPropertyList, PBD::PropertyList> ("OwnedPropertyList")
502 .beginWSPtrClass <AutomationList> ("AutomationList")
503 .addCast<PBD::Stateful> ("to_stateful")
504 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
505 .addCast<Evoral::ControlList> ("list")
506 .addFunction ("get_state", &AutomationList::get_state)
507 .addFunction ("memento_command", &AutomationList::memento_command)
508 .addFunction ("touching", &AutomationList::touching)
509 .addFunction ("writing", &AutomationList::writing)
510 .addFunction ("touch_enabled", &AutomationList::touch_enabled)
513 .deriveClass <Location, PBD::StatefulDestructible> ("Location")
514 .addFunction ("locked", &Location::locked)
515 .addFunction ("lock", &Location::lock)
516 .addFunction ("unlock", &Location::unlock)
517 .addFunction ("start", &Location::start)
518 .addFunction ("_end", &Location::end) // XXX "end" is a lua reserved word
519 .addFunction ("length", &Location::length)
520 .addFunction ("set_start", &Location::set_start)
521 .addFunction ("set_end", &Location::set_end)
522 .addFunction ("set_length", &Location::set)
523 .addFunction ("move_to", &Location::move_to)
524 .addFunction ("matches", &Location::matches)
525 .addFunction ("flags", &Location::flags)
526 .addFunction ("is_auto_punch", &Location::is_auto_punch)
527 .addFunction ("is_auto_loop", &Location::is_auto_loop)
528 .addFunction ("is_mark", &Location::is_mark)
529 .addFunction ("is_hidden", &Location::is_hidden)
530 .addFunction ("is_cd_marker", &Location::is_cd_marker)
531 .addFunction ("is_session_range", &Location::is_session_range)
532 .addFunction ("is_range_marker", &Location::is_range_marker)
535 .deriveClass <Locations, PBD::StatefulDestructible> ("Locations")
536 .addFunction ("list", static_cast<Locations::LocationList (Locations::*)()>(&Locations::list))
537 .addFunction ("auto_loop_location", &Locations::auto_loop_location)
538 .addFunction ("auto_punch_location", &Locations::auto_punch_location)
539 .addFunction ("session_range_location", &Locations::session_range_location)
540 .addFunction ("first_mark_after", &Locations::first_mark_after)
541 .addFunction ("first_mark_before", &Locations::first_mark_before)
542 .addFunction ("first_mark_at", &Locations::mark_at)
543 .addRefFunction ("marks_either_side", &Locations::marks_either_side)
544 .addRefFunction ("find_all_between", &Locations::find_all_between)
547 .beginWSPtrClass <SessionObject> ("SessionObject")
548 /* SessionObject is-a PBD::StatefulDestructible,
549 * but multiple inheritance is not covered by luabridge,
550 * we need explicit casts */
551 .addCast<PBD::Stateful> ("to_stateful")
552 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
553 .addFunction ("name", &SessionObject::name)
556 .beginWSPtrClass <Port> ("Port")
557 .addCast<MidiPort> ("to_midiport")
558 .addCast<AudioPort> ("to_audioport")
559 .addFunction ("name", &Port::name)
560 .addFunction ("pretty_name", &Port::pretty_name)
561 .addFunction ("receives_input", &Port::receives_input)
562 .addFunction ("sends_output", &Port::sends_output)
563 .addFunction ("connected", &Port::connected)
564 .addFunction ("disconnect_all", &Port::disconnect_all)
565 .addFunction ("connected_to_name", (bool (Port::*)(std::string const &)const)&Port::connected_to)
566 .addFunction ("connect_by_name", (int (Port::*)(std::string const &))&Port::connect)
567 .addFunction ("disconnect_by_name", (int (Port::*)(std::string const &))&Port::disconnect)
568 .addFunction ("connected_to", (bool (Port::*)(Port*)const)&Port::connected_to)
569 .addFunction ("connect", (int (Port::*)(Port*))&Port::connect)
570 .addFunction ("disconnect", (int (Port::*)(Port*))&Port::disconnect)
571 //.addStaticFunction ("port_offset", &Port::port_offset) // static
574 .deriveWSPtrClass <AudioPort, Port> ("AudioPort")
577 .deriveWSPtrClass <MidiPort, Port> ("MidiPort")
578 .addFunction ("input_active", &MidiPort::input_active)
579 .addFunction ("set_input_active", &MidiPort::set_input_active)
580 .addFunction ("get_midi_buffer", &MidiPort::get_midi_buffer) // DSP only
583 .beginWSPtrClass <PortSet> ("PortSet")
584 .addFunction ("num_ports", (size_t (PortSet::*)(DataType)const)&PortSet::num_ports)
585 .addFunction ("add", &PortSet::add)
586 .addFunction ("remove", &PortSet::remove)
587 .addFunction ("port", (boost::shared_ptr<Port> (PortSet::*)(DataType, size_t)const)&PortSet::port)
588 .addFunction ("contains", &PortSet::contains)
589 .addFunction ("clear", &PortSet::clear)
590 .addFunction ("empty", &PortSet::empty)
593 .deriveWSPtrClass <IO, SessionObject> ("IO")
594 .addFunction ("active", &IO::active)
595 .addFunction ("add_port", &IO::add_port)
596 .addFunction ("remove_port", &IO::remove_port)
597 .addFunction ("connect", &IO::connect)
598 .addFunction ("disconnect", (int (IO::*)(boost::shared_ptr<Port>, std::string, void *))&IO::disconnect)
599 .addFunction ("physically_connected", &IO::physically_connected)
600 .addFunction ("has_port", &IO::has_port)
601 .addFunction ("nth", &IO::nth)
602 .addFunction ("audio", &IO::audio)
603 .addFunction ("midi", &IO::midi)
604 .addFunction ("port_by_name", &IO::nth)
605 .addFunction ("n_ports", &IO::n_ports)
608 .beginClass <RouteGroup> ("RouteGroup")
609 // stub RouteGroup* is needed for new_audio_track()
612 .deriveClass <PresentationInfo, PBD::Stateful> ("PresentationInfo")
613 .addFunction ("color", &PresentationInfo::color)
614 .addFunction ("set_color", &PresentationInfo::set_color)
615 .addFunction ("order", &PresentationInfo::order)
618 .deriveWSPtrClass <Stripable, SessionObject> ("Stripable")
619 .addCast<Route> ("to_route")
620 .addFunction ("is_auditioner", &Stripable::is_auditioner)
621 .addFunction ("is_master", &Stripable::is_master)
622 .addFunction ("is_monitor", &Stripable::is_monitor)
623 .addFunction ("is_hidden", &Stripable::is_hidden)
624 .addFunction ("is_selected", &Stripable::is_selected)
625 .addFunction ("gain_control", &Stripable::gain_control)
626 .addFunction ("solo_control", &Stripable::solo_control)
627 .addFunction ("solo_isolate_control", &Stripable::solo_isolate_control)
628 .addFunction ("solo_safe_control", &Stripable::solo_safe_control)
629 .addFunction ("mute_control", &Stripable::mute_control)
630 .addFunction ("phase_control", &Stripable::phase_control)
631 .addFunction ("trim_control", &Stripable::trim_control)
632 .addFunction ("rec_enable_control", &Stripable::rec_enable_control)
633 .addFunction ("rec_safe_control", &Stripable::rec_safe_control)
634 .addFunction ("pan_azimuth_control", &Stripable::pan_azimuth_control)
635 .addFunction ("pan_elevation_control", &Stripable::pan_elevation_control)
636 .addFunction ("pan_width_control", &Stripable::pan_width_control)
637 .addFunction ("pan_frontback_control", &Stripable::pan_frontback_control)
638 .addFunction ("pan_lfe_control", &Stripable::pan_lfe_control)
639 .addFunction ("send_level_control", &Stripable::send_level_controllable)
640 .addFunction ("send_enable_control", &Stripable::send_level_controllable)
641 .addFunction ("send_name", &Stripable::send_name)
642 .addFunction ("monitor_control", &Stripable::monitor_control)
643 .addFunction ("master_send_enable_control ", &Stripable::master_send_enable_controllable )
644 .addFunction ("comp_enable_control ", &Stripable::comp_enable_controllable )
645 .addFunction ("comp_threshold_control ", &Stripable::comp_threshold_controllable )
646 .addFunction ("comp_speed_control ", &Stripable::comp_speed_controllable )
647 .addFunction ("comp_mode_control ", &Stripable::comp_mode_controllable )
648 .addFunction ("comp_makeup_control ", &Stripable::comp_makeup_controllable )
649 .addFunction ("comp_redux_control ", &Stripable::comp_redux_controllable )
650 .addFunction ("comp_mode_name", &Stripable::comp_mode_name)
651 .addFunction ("comp_speed_name", &Stripable::comp_speed_name)
652 .addFunction ("eq_band_cnt ", &Stripable::eq_band_cnt)
653 .addFunction ("eq_band_name", &Stripable::eq_band_name)
654 .addFunction ("eq_gain_control", &Stripable::eq_gain_controllable)
655 .addFunction ("eq_freq_control ", &Stripable::eq_freq_controllable )
656 .addFunction ("eq_q_control ", &Stripable::eq_q_controllable )
657 .addFunction ("eq_shape_control ", &Stripable::eq_shape_controllable )
658 .addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
659 .addFunction ("eq_hpf_control ", &Stripable::eq_hpf_controllable )
660 .addFunction ("set_presentation_order", &Stripable::set_presentation_order)
661 .addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)
665 .deriveWSPtrClass <Route, Stripable> ("Route")
666 .addCast<Track> ("to_track")
667 .addFunction ("set_name", &Route::set_name)
668 .addFunction ("comment", &Route::comment)
669 .addFunction ("active", &Route::active)
670 .addFunction ("set_active", &Route::set_active)
671 .addFunction ("nth_plugin", &Route::nth_plugin)
672 .addFunction ("nth_processor", &Route::nth_processor)
673 .addFunction ("nth_send", &Route::nth_send)
674 .addFunction ("add_processor_by_index", &Route::add_processor_by_index)
675 .addFunction ("remove_processor", &Route::remove_processor)
676 .addFunction ("replace_processor", &Route::replace_processor)
677 .addFunction ("n_inputs", &Route::n_inputs)
678 .addFunction ("n_outputs", &Route::n_outputs)
679 .addFunction ("set_comment", &Route::set_comment)
680 .addFunction ("strict_io", &Route::strict_io)
681 .addFunction ("set_strict_io", &Route::set_strict_io)
682 .addFunction ("reset_plugin_insert", &Route::reset_plugin_insert)
683 .addFunction ("customize_plugin_insert", &Route::customize_plugin_insert)
684 .addFunction ("add_sidechain", &Route::add_sidechain)
685 .addFunction ("remove_sidechain", &Route::remove_sidechain)
686 .addFunction ("main_outs", &Route::main_outs)
687 .addFunction ("muted", &Route::muted)
688 .addFunction ("soloed", &Route::soloed)
689 .addFunction ("amp", &Route::amp)
690 .addFunction ("trim", &Route::trim)
693 .deriveWSPtrClass <Playlist, SessionObject> ("Playlist")
694 .addFunction ("region_by_id", &Playlist::region_by_id)
695 .addFunction ("data_type", &Playlist::data_type)
696 .addFunction ("n_regions", &Playlist::n_regions)
697 //.addFunction ("get_extent", &Playlist::get_extent) // pair<framepos_t, framepos_t>
698 .addFunction ("region_list", &Playlist::region_list)
699 .addFunction ("add_region", &Playlist::add_region)
700 .addFunction ("remove_region", &Playlist::remove_region)
701 .addFunction ("regions_at", &Playlist::regions_at)
702 .addFunction ("top_region_at", &Playlist::top_region_at)
703 .addFunction ("top_unmuted_region_at", &Playlist::top_unmuted_region_at)
704 .addFunction ("find_next_region", &Playlist::find_next_region)
705 .addFunction ("find_next_region_boundary", &Playlist::find_next_region_boundary)
706 .addFunction ("count_regions_at", &Playlist::count_regions_at)
707 .addFunction ("regions_touched", &Playlist::regions_touched)
708 .addFunction ("regions_with_start_within", &Playlist::regions_with_start_within)
709 .addFunction ("regions_with_end_within", &Playlist::regions_with_end_within)
710 .addFunction ("raise_region", &Playlist::raise_region)
711 .addFunction ("lower_region", &Playlist::lower_region)
712 .addFunction ("raise_region_to_top", &Playlist::raise_region_to_top)
713 .addFunction ("lower_region_to_bottom", &Playlist::lower_region_to_bottom)
714 .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr<Region>, framepos_t, framecnt_t, float))&Playlist::duplicate)
715 .addFunction ("duplicate_until", &Playlist::duplicate_until)
716 .addFunction ("duplicate_range", &Playlist::duplicate_range)
717 .addFunction ("combine", &Playlist::combine)
718 .addFunction ("uncombine", &Playlist::uncombine)
719 .addFunction ("split_region", &Playlist::split_region)
720 .addFunction ("split", (void (Playlist::*)(framepos_t))&Playlist::split)
721 .addFunction ("cut", (boost::shared_ptr<Playlist> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
723 .addFunction ("copy", &Playlist::copy)
724 .addFunction ("paste", &Playlist::paste)
728 .deriveWSPtrClass <Track, Route> ("Track")
729 .addCast<AudioTrack> ("to_audio_track")
730 .addCast<MidiTrack> ("to_midi_track")
731 .addFunction ("set_name", &Track::set_name)
732 .addFunction ("can_record", &Track::can_record)
733 .addFunction ("bounceable", &Track::bounceable)
734 .addFunction ("bounce", &Track::bounce)
735 .addFunction ("bounce_range", &Track::bounce_range)
736 .addFunction ("playlist", &Track::playlist)
739 .deriveWSPtrClass <AudioTrack, Track> ("AudioTrack")
742 .deriveWSPtrClass <MidiTrack, Track> ("MidiTrack")
745 .deriveWSPtrClass <Region, SessionObject> ("Region")
747 .addFunction ("position", &Region::position)
748 .addFunction ("start", &Region::start)
749 .addFunction ("length", &Region::length)
750 .addFunction ("layer", &Region::layer)
751 .addFunction ("data_type", &Region::data_type)
752 .addFunction ("stretch", &Region::stretch)
753 .addFunction ("shift", &Region::shift)
754 .addRefFunction ("sync_offset", &Region::sync_offset)
755 .addFunction ("sync_position", &Region::sync_position)
756 .addFunction ("hidden", &Region::hidden)
757 .addFunction ("muted", &Region::muted)
758 .addFunction ("opaque", &Region::opaque)
759 .addFunction ("locked", &Region::locked)
760 .addFunction ("position_locked", &Region::position_locked)
761 .addFunction ("video_locked", &Region::video_locked)
762 .addFunction ("automatic", &Region::automatic)
763 .addFunction ("whole_file", &Region::whole_file)
764 .addFunction ("captured", &Region::captured)
765 .addFunction ("can_move", &Region::can_move)
766 .addFunction ("sync_marked", &Region::sync_marked)
767 .addFunction ("external", &Region::external)
768 .addFunction ("import", &Region::import)
769 .addFunction ("covers", &Region::covers)
770 .addFunction ("at_natural_position", &Region::at_natural_position)
771 .addFunction ("is_compound", &Region::is_compound)
772 /* editing operations */
773 .addFunction ("set_length", &Region::set_length)
774 .addFunction ("set_start", &Region::set_start)
775 .addFunction ("set_position", &Region::set_position)
776 .addFunction ("set_initial_position", &Region::set_initial_position)
777 .addFunction ("nudge_position", &Region::nudge_position)
778 .addFunction ("move_to_natural_position", &Region::move_to_natural_position)
779 .addFunction ("move_start", &Region::move_start)
780 .addFunction ("trim_front", &Region::trim_front)
781 .addFunction ("trim_end", &Region::trim_end)
782 .addFunction ("trim_to", &Region::trim_to)
783 .addFunction ("cut_front", &Region::cut_front)
784 .addFunction ("cut_end", &Region::cut_end)
785 .addFunction ("raise", &Region::raise)
786 .addFunction ("lower", &Region::lower)
787 .addFunction ("raise_to_top", &Region::raise_to_top)
788 .addFunction ("lower_to_bottom", &Region::lower_to_bottom)
789 .addFunction ("set_sync_position", &Region::set_sync_position)
790 .addFunction ("clear_sync_position", &Region::clear_sync_position)
791 .addFunction ("set_hidden", &Region::set_hidden)
792 .addFunction ("set_muted", &Region::set_muted)
793 .addFunction ("set_opaque", &Region::set_opaque)
794 .addFunction ("set_locked", &Region::set_locked)
795 .addFunction ("set_video_locked", &Region::set_video_locked)
796 .addFunction ("set_position_locked", &Region::set_position_locked)
799 .beginWSPtrClass <Source> ("Source")
802 .beginClass <Plugin::PresetRecord> ("PresetRecord")
803 .addVoidConstructor ()
804 .addData ("uri", &Plugin::PresetRecord::uri, false)
805 .addData ("label", &Plugin::PresetRecord::label, false)
806 .addData ("user", &Plugin::PresetRecord::user, false)
807 .addData ("valid", &Plugin::PresetRecord::valid, false)
810 .deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
811 .addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
814 .deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
815 .addVoidConstructor ()
816 .addData ("label", &ParameterDescriptor::label)
817 .addData ("logarithmic", &ParameterDescriptor::logarithmic)
818 .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name)
821 .deriveWSPtrClass <Processor, SessionObject> ("Processor")
822 .addCast<Automatable> ("to_automatable")
823 .addCast<PluginInsert> ("to_insert")
824 .addCast<SideChain> ("to_sidechain")
825 .addCast<IOProcessor> ("to_ioprocessor")
826 .addCast<UnknownProcessor> ("to_unknownprocessor")
827 .addCast<Amp> ("to_amp")
828 .addCast<MonitorProcessor> ("to_monitorprocessor")
829 #if 0 // those objects are not yet bound
830 .addCast<CapturingProcessor> ("to_capturingprocessor")
831 .addCast<DelayLine> ("to_delayline")
832 .addCast<PeakMeter> ("to_meter")
834 .addFunction ("display_name", &Processor::display_name)
835 .addFunction ("active", &Processor::active)
836 .addFunction ("activate", &Processor::activate)
837 .addFunction ("deactivate", &Processor::deactivate)
840 .deriveWSPtrClass <IOProcessor, Processor> ("IOProcessor")
841 .addFunction ("natural_input_streams", &IOProcessor::natural_input_streams)
842 .addFunction ("natural_output_streams", &IOProcessor::natural_output_streams)
843 .addFunction ("input", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::input)
844 .addFunction ("output", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::output)
847 .deriveWSPtrClass <SideChain, IOProcessor> ("SideChain")
850 .deriveWSPtrClass <Delivery, IOProcessor> ("Delivery")
853 .deriveWSPtrClass <Plugin, PBD::StatefulDestructible> ("Plugin")
854 .addFunction ("label", &Plugin::label)
855 .addFunction ("name", &Plugin::name)
856 .addFunction ("maker", &Plugin::maker)
857 .addFunction ("parameter_count", &Plugin::parameter_count)
858 .addRefFunction ("nth_parameter", &Plugin::nth_parameter)
859 .addFunction ("preset_by_label", &Plugin::preset_by_label)
860 .addFunction ("preset_by_uri", &Plugin::preset_by_uri)
861 .addFunction ("load_preset", &Plugin::load_preset)
862 .addFunction ("parameter_is_input", &Plugin::parameter_is_input)
863 .addFunction ("get_docs", &Plugin::get_docs)
864 .addFunction ("get_parameter_docs", &Plugin::get_parameter_docs)
865 .addRefFunction ("get_parameter_descriptor", &Plugin::get_parameter_descriptor)
868 .deriveWSPtrClass <PluginInsert, Processor> ("PluginInsert")
869 .addFunction ("plugin", &PluginInsert::plugin)
870 .addFunction ("activate", &PluginInsert::activate)
871 .addFunction ("deactivate", &PluginInsert::deactivate)
872 .addFunction ("strict_io_configured", &PluginInsert::strict_io_configured)
873 .addFunction ("input_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::input_map)
874 .addFunction ("output_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::output_map)
875 .addFunction ("set_input_map", &PluginInsert::set_input_map)
876 .addFunction ("set_output_map", &PluginInsert::set_output_map)
877 .addFunction ("sidechain_input", &PluginInsert::sidechain_input)
880 .deriveWSPtrClass <AutomationControl, PBD::Controllable> ("AutomationControl")
881 .addCast<Evoral::Control> ("to_ctrl")
882 .addFunction ("automation_state", &AutomationControl::automation_state)
883 .addFunction ("automation_style", &AutomationControl::automation_style)
884 .addFunction ("set_automation_state", &AutomationControl::set_automation_state)
885 .addFunction ("set_automation_style", &AutomationControl::set_automation_style)
886 .addFunction ("start_touch", &AutomationControl::start_touch)
887 .addFunction ("stop_touch", &AutomationControl::stop_touch)
888 .addFunction ("get_value", &AutomationControl::get_value)
889 .addFunction ("set_value", &AutomationControl::set_value)
890 .addFunction ("writable", &AutomationControl::writable)
891 .addFunction ("alist", &AutomationControl::alist)
894 .deriveWSPtrClass <SlavableAutomationControl, AutomationControl> ("SlavableAutomationControl,")
895 .addFunction ("add_master", &SlavableAutomationControl::add_master)
896 .addFunction ("remove_master", &SlavableAutomationControl::remove_master)
897 .addFunction ("clear_masters", &SlavableAutomationControl::clear_masters)
898 .addFunction ("slaved_to", &SlavableAutomationControl::slaved_to)
899 .addFunction ("slaved", &SlavableAutomationControl::slaved)
900 .addFunction ("get_masters_value", &SlavableAutomationControl::get_masters_value)
901 .addFunction ("get_boolean_masters", &SlavableAutomationControl::get_boolean_masters)
902 //.addFunction ("masters", &SlavableAutomationControl::masters) // not implemented
905 .deriveWSPtrClass <PhaseControl, AutomationControl> ("PhaseControl")
906 .addFunction ("set_phase_invert", (void(PhaseControl::*)(uint32_t, bool))&PhaseControl::set_phase_invert)
907 .addFunction ("inverted", &PhaseControl::inverted)
910 .deriveWSPtrClass <GainControl, SlavableAutomationControl> ("GainControl")
913 .deriveWSPtrClass <SoloControl, SlavableAutomationControl> ("SoloControl")
914 .addFunction ("can_solo", &SoloControl::can_solo)
915 .addFunction ("soloed", &SoloControl::soloed)
916 .addFunction ("self_soloed", &SoloControl::self_soloed)
919 .deriveWSPtrClass <MuteControl, SlavableAutomationControl> ("MuteControl")
920 .addFunction ("muted", &MuteControl::muted)
921 .addFunction ("muted_by_self", &MuteControl::muted_by_self)
924 .deriveWSPtrClass <SoloIsolateControl, SlavableAutomationControl> ("SoloIsolateControl")
925 .addFunction ("solo_isolated", &SoloIsolateControl::solo_isolated)
926 .addFunction ("self_solo_isolated", &SoloIsolateControl::self_solo_isolated)
929 .deriveWSPtrClass <SoloSafeControl, SlavableAutomationControl> ("SoloSafeControl")
930 .addFunction ("solo_safe", &SoloSafeControl::solo_safe)
933 .deriveWSPtrClass <Amp, Processor> ("Amp")
934 .addFunction ("gain_control", (boost::shared_ptr<GainControl>(Amp::*)())&Amp::gain_control)
937 .deriveWSPtrClass <MonitorProcessor, Processor> ("MonitorProcessor")
938 .addFunction ("set_cut_all", &MonitorProcessor::set_cut_all)
939 .addFunction ("set_dim_all", &MonitorProcessor::set_dim_all)
940 .addFunction ("set_polarity", &MonitorProcessor::set_polarity)
941 .addFunction ("set_cut", &MonitorProcessor::set_cut)
942 .addFunction ("set_dim", &MonitorProcessor::set_dim)
943 .addFunction ("set_solo", &MonitorProcessor::set_solo)
944 .addFunction ("set_mono", &MonitorProcessor::set_mono)
945 .addFunction ("dim_level", &MonitorProcessor::dim_level)
946 .addFunction ("solo_boost_level", &MonitorProcessor::solo_boost_level)
947 .addFunction ("dimmed", &MonitorProcessor::dimmed)
948 .addFunction ("soloed", &MonitorProcessor::soloed)
949 .addFunction ("inverted", &MonitorProcessor::inverted)
950 .addFunction ("cut", &MonitorProcessor::cut)
951 .addFunction ("cut_all", &MonitorProcessor::cut_all)
952 .addFunction ("dim_all", &MonitorProcessor::dim_all)
953 .addFunction ("mono", &MonitorProcessor::mono)
954 .addFunction ("monitor_active", &MonitorProcessor::monitor_active)
955 .addFunction ("channel_cut_control", &MonitorProcessor::channel_cut_control)
956 .addFunction ("channel_dim_control", &MonitorProcessor::channel_dim_control)
957 .addFunction ("channel_polarity_control", &MonitorProcessor::channel_polarity_control)
958 .addFunction ("channel_solo_control", &MonitorProcessor::channel_solo_control)
959 .addFunction ("dim_control", &MonitorProcessor::dim_control)
960 .addFunction ("cut_control", &MonitorProcessor::cut_control)
961 .addFunction ("mono_control", &MonitorProcessor::mono_control)
962 .addFunction ("dim_level_control", &MonitorProcessor::dim_level_control)
963 .addFunction ("solo_boost_control", &MonitorProcessor::solo_boost_control)
966 .deriveWSPtrClass <UnknownProcessor, Processor> ("UnknownProcessor")
969 .deriveWSPtrClass <PluginInsert::PluginControl, AutomationControl> ("PluginControl")
972 .deriveWSPtrClass <AudioSource, Source> ("AudioSource")
973 .addFunction ("readable_length", &AudioSource::readable_length)
974 .addFunction ("n_channels", &AudioSource::n_channels)
977 // <std::list<boost::shared_ptr <AudioTrack> >
978 .beginStdList <boost::shared_ptr<AudioTrack> > ("AudioTrackList")
981 // std::list<boost::shared_ptr <MidiTrack> >
982 .beginStdList <boost::shared_ptr<MidiTrack> > ("MidiTrackList")
985 // RouteList == std::list<boost::shared_ptr<Route> >
986 .beginConstStdList <boost::shared_ptr<Route> > ("RouteList")
989 // boost::shared_ptr<RouteList>
990 .beginPtrStdList <boost::shared_ptr<Route> > ("RouteListPtr")
993 // typedef std::list<boost::weak_ptr <Route> > WeakRouteList
994 .beginConstStdList <boost::weak_ptr<Route> > ("WeakRouteList")
997 // std::list< boost::weak_ptr <AudioSource> >
998 .beginConstStdList <boost::weak_ptr<AudioSource> > ("WeakAudioSourceList")
1001 // typedef std::list<boost::shared_ptr<Region> > RegionList
1002 .beginConstStdList <boost::shared_ptr<Region> > ("RegionList")
1005 // boost::shared_ptr <std::list<boost::shared_ptr<Region> > >
1006 .beginPtrStdList <boost::shared_ptr<Region> > ("RegionListPtr")
1009 //std::list<boost::shared_ptr<Port> > PortList;
1010 .beginConstStdList <boost::shared_ptr<Port> > ("PortList")
1013 // used by Playlist::cut/copy
1014 .beginConstStdList <AudioRange> ("AudioRangeList")
1017 .beginConstStdList <Location*> ("LocationList")
1020 #if 0 // depends on Evoal:: Note, Beats see note_fixer.h
1021 // typedef Evoral::Note<Evoral::Beats> Note;
1022 // std::set< boost::weak_ptr<Note> >
1023 .beginStdSet <boost::weak_ptr<Note> > ("WeakNoteSet")
1027 // std::list<boost::weak_ptr<Source> >
1028 .beginConstStdList <boost::weak_ptr<Source> > ("WeakSourceList")
1031 .beginClass <Tempo> ("Tempo")
1032 .addConstructor <void (*) (double, double)> ()
1033 .addFunction ("note_type", &Tempo::note_type)
1034 .addFunction ("beats_per_minute", &Tempo::beats_per_minute)
1035 .addFunction ("frames_per_beat", &Tempo::frames_per_beat)
1038 .beginClass <Meter> ("Meter")
1039 .addConstructor <void (*) (double, double)> ()
1040 .addFunction ("divisions_per_bar", &Meter::divisions_per_bar)
1041 .addFunction ("note_divisor", &Meter::note_divisor)
1042 .addFunction ("frames_per_bar", &Meter::frames_per_bar)
1043 .addFunction ("frames_per_grid", &Meter::frames_per_grid)
1046 .beginClass <TempoMap> ("TempoMap")
1047 .addFunction ("add_tempo", &TempoMap::add_tempo)
1048 .addFunction ("add_meter", &TempoMap::add_meter)
1049 .addFunction ("tempo_section_at_frame", &TempoMap::tempo_section_at_frame)
1050 .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_frame)
1051 .addFunction ("meter_section_at_beat", &TempoMap::meter_section_at_beat)
1054 .beginClass <MetricSection> ("MetricSection")
1055 .addFunction ("pulse", &MetricSection::pulse)
1056 .addFunction ("set_pulse", &MetricSection::set_pulse)
1059 .deriveClass <TempoSection, MetricSection> ("TempoSection")
1060 .addFunction ("c_func", (double(TempoSection::*)()const)&TempoSection::c_func)
1063 .deriveClass <MeterSection, MetricSection> ("MeterSection")
1064 .addCast<Meter> ("to_meter")
1065 .addFunction ("set_pulse", &MeterSection::set_pulse)
1066 .addFunction ("set_beat", (void(MeterSection::*)(double))&MeterSection::set_beat)
1069 .beginClass <ChanCount> ("ChanCount")
1070 .addConstructor <void (*) (DataType, uint32_t)> ()
1071 .addFunction ("get", &ChanCount::get)
1072 .addFunction ("set", &ChanCount::set)
1073 .addFunction ("n_audio", &ChanCount::n_audio)
1074 .addFunction ("n_midi", &ChanCount::n_midi)
1075 .addFunction ("n_total", &ChanCount::n_total)
1076 .addFunction ("reset", &ChanCount::reset)
1079 .beginClass <DataType> ("DataType")
1080 .addConstructor <void (*) (std::string)> ()
1081 .addStaticCFunction ("null", &LuaAPI::datatype_ctor_null) // "nil" is a lua reseved word
1082 .addStaticCFunction ("audio", &LuaAPI::datatype_ctor_audio)
1083 .addStaticCFunction ("midi", &LuaAPI::datatype_ctor_midi)
1084 .addFunction ("to_string", &DataType::to_string) // TODO Lua __tostring
1085 // TODO add uint32_t cast, add operator== !=
1088 /* libardour enums */
1089 .beginNamespace ("PluginType")
1090 .addConst ("AudioUnit", ARDOUR::PluginType(AudioUnit))
1091 .addConst ("LADSPA", ARDOUR::PluginType(LADSPA))
1092 .addConst ("LV2", ARDOUR::PluginType(LV2))
1093 .addConst ("Windows_VST", ARDOUR::PluginType(Windows_VST))
1094 .addConst ("LXVST", ARDOUR::PluginType(LXVST))
1095 .addConst ("Lua", ARDOUR::PluginType(Lua))
1098 .beginNamespace ("PresentationInfo")
1099 .beginNamespace ("Flag")
1100 .addConst ("AudioTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioTrack))
1101 .addConst ("MidiTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiTrack))
1102 .addConst ("AudioBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioBus))
1103 .addConst ("MidiBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiBus))
1104 .addConst ("VCA", ARDOUR::PresentationInfo::Flag(PresentationInfo::VCA))
1105 .addConst ("MasterOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MasterOut))
1106 .addConst ("MonitorOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MonitorOut))
1107 .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner))
1108 .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected))
1109 .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden))
1110 .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet))
1111 .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask))
1115 .beginNamespace ("AutoStyle")
1116 .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
1117 .addConst ("Trim", ARDOUR::AutoStyle(Trim))
1120 .beginNamespace ("AutoState")
1121 .addConst ("Off", ARDOUR::AutoState(Off))
1122 .addConst ("Write", ARDOUR::AutoState(Write))
1123 .addConst ("Touch", ARDOUR::AutoState(Touch))
1124 .addConst ("Play", ARDOUR::AutoState(Play))
1127 .beginNamespace ("AutomationType")
1128 .addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation))
1129 .addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation))
1130 .addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation))
1131 .addConst ("SoloIsolateAutomation", ARDOUR::AutomationType(SoloIsolateAutomation))
1132 .addConst ("SoloSafeAutomation", ARDOUR::AutomationType(SoloSafeAutomation))
1133 .addConst ("MuteAutomation", ARDOUR::AutomationType(MuteAutomation))
1134 .addConst ("RecEnableAutomation", ARDOUR::AutomationType(RecEnableAutomation))
1135 .addConst ("RecSafeAutomation", ARDOUR::AutomationType(RecSafeAutomation))
1136 .addConst ("TrimAutomation", ARDOUR::AutomationType(TrimAutomation))
1137 .addConst ("PhaseAutomation", ARDOUR::AutomationType(PhaseAutomation))
1140 .beginNamespace ("SrcQuality")
1141 .addConst ("SrcBest", ARDOUR::SrcQuality(SrcBest))
1144 .beginNamespace ("PortFlags")
1145 .addConst ("IsInput", ARDOUR::PortFlags(IsInput))
1146 .addConst ("IsOutput", ARDOUR::PortFlags(IsOutput))
1147 .addConst ("IsPhysical", ARDOUR::PortFlags(IsPhysical))
1148 .addConst ("CanMonitor", ARDOUR::PortFlags(CanMonitor))
1149 .addConst ("IsTerminal", ARDOUR::PortFlags(IsTerminal))
1152 .beginNamespace ("PlaylistDisposition")
1153 .addConst ("CopyPlaylist", ARDOUR::PlaylistDisposition(CopyPlaylist))
1154 .addConst ("NewPlaylist", ARDOUR::PlaylistDisposition(NewPlaylist))
1155 .addConst ("SharePlaylist", ARDOUR::PlaylistDisposition(SharePlaylist))
1158 .beginNamespace ("RegionPoint")
1159 .addConst ("Start", ARDOUR::RegionPoint(Start))
1160 .addConst ("End", ARDOUR::RegionPoint(End))
1161 .addConst ("SyncPoint", ARDOUR::RegionPoint(SyncPoint))
1164 .beginNamespace ("TempoSection")
1165 .beginNamespace ("PositionLockStyle")
1166 .addConst ("AudioTime", ARDOUR::PositionLockStyle(AudioTime))
1167 .addConst ("MusicTime", ARDOUR::PositionLockStyle(MusicTime))
1171 .beginNamespace ("TempoSection")
1172 .beginNamespace ("Type")
1173 .addConst ("Ramp", ARDOUR::TempoSection::Type(TempoSection::Ramp))
1174 .addConst ("Constant", ARDOUR::TempoSection::Type(TempoSection::Constant))
1178 .beginNamespace ("TrackMode")
1179 .addConst ("Normal", ARDOUR::TrackMode(Start))
1180 .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered))
1181 .addConst ("Destructive", ARDOUR::TrackMode(Destructive))
1184 .beginNamespace ("SampleFormat")
1185 .addConst ("Float", ARDOUR::SampleFormat(FormatFloat))
1186 .addConst ("Int24", ARDOUR::SampleFormat(FormatInt24))
1187 .addConst ("Int16", ARDOUR::SampleFormat(FormatInt16))
1190 .beginNamespace ("HeaderFormat")
1191 .addConst ("BWF", ARDOUR::HeaderFormat(BWF))
1192 .addConst ("WAVE", ARDOUR::HeaderFormat(WAVE))
1193 .addConst ("WAVE64", ARDOUR::HeaderFormat(WAVE64))
1194 .addConst ("CAF", ARDOUR::HeaderFormat(CAF))
1195 .addConst ("AIFF", ARDOUR::HeaderFormat(AIFF))
1196 .addConst ("iXML", ARDOUR::HeaderFormat(iXML))
1197 .addConst ("RF64", ARDOUR::HeaderFormat(RF64))
1198 .addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
1199 .addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
1202 .beginNamespace ("InsertMergePolicy")
1203 .addConst ("Reject", ARDOUR::InsertMergePolicy(InsertMergeReject))
1204 .addConst ("Relax", ARDOUR::InsertMergePolicy(InsertMergeRelax))
1205 .addConst ("Replace", ARDOUR::InsertMergePolicy(InsertMergeReplace))
1206 .addConst ("TruncateExisting", ARDOUR::InsertMergePolicy(InsertMergeTruncateExisting))
1207 .addConst ("TruncateAddition", ARDOUR::InsertMergePolicy(InsertMergeTruncateAddition))
1208 .addConst ("Extend", ARDOUR::InsertMergePolicy(InsertMergeExtend))
1211 .endNamespace (); // end ARDOUR
1213 luabridge::getGlobalNamespace (L)
1214 .beginNamespace ("ARDOUR")
1215 .beginClass <AudioBackendInfo> ("AudioBackendInfo")
1216 .addData ("name", &AudioBackendInfo::name)
1218 .beginStdVector <const AudioBackendInfo*> ("BackendVector").endClass ()
1220 .beginClass <AudioBackend::DeviceStatus> ("DeviceStatus")
1221 .addData ("name", &AudioBackend::DeviceStatus::name)
1222 .addData ("available", &AudioBackend::DeviceStatus::available)
1224 .beginStdVector <AudioBackend::DeviceStatus> ("DeviceStatusVector").endClass ()
1226 .beginWSPtrClass <AudioBackend> ("AudioBackend")
1227 .addFunction ("info", &AudioBackend::info)
1228 .addFunction ("sample_rate", &AudioBackend::sample_rate)
1229 .addFunction ("buffer_size", &AudioBackend::buffer_size)
1230 .addFunction ("period_size", &AudioBackend::period_size)
1231 .addFunction ("input_channels", &AudioBackend::input_channels)
1232 .addFunction ("output_channels", &AudioBackend::output_channels)
1233 .addFunction ("dsp_load", &AudioBackend::dsp_load)
1235 .addFunction ("set_sample_rate", &AudioBackend::set_sample_rate)
1236 .addFunction ("set_buffer_size", &AudioBackend::set_buffer_size)
1237 .addFunction ("set_peridod_size", &AudioBackend::set_peridod_size)
1239 .addFunction ("enumerate_drivers", &AudioBackend::enumerate_drivers)
1240 .addFunction ("driver_name", &AudioBackend::driver_name)
1241 .addFunction ("set_driver", &AudioBackend::set_driver)
1243 .addFunction ("use_separate_input_and_output_devices", &AudioBackend::use_separate_input_and_output_devices)
1244 .addFunction ("enumerate_devices", &AudioBackend::enumerate_devices)
1245 .addFunction ("enumerate_input_devices", &AudioBackend::enumerate_input_devices)
1246 .addFunction ("enumerate_output_devices", &AudioBackend::enumerate_output_devices)
1247 .addFunction ("device_name", &AudioBackend::device_name)
1248 .addFunction ("input_device_name", &AudioBackend::input_device_name)
1249 .addFunction ("output_device_name", &AudioBackend::output_device_name)
1250 .addFunction ("set_device_name", &AudioBackend::set_device_name)
1251 .addFunction ("set_input_device_name", &AudioBackend::set_input_device_name)
1252 .addFunction ("set_output_device_name", &AudioBackend::set_output_device_name)
1255 .beginClass <PortEngine> ("PortEngine")
1258 .beginClass <PortManager> ("PortManager")
1259 .addFunction ("port_engine", &PortManager::port_engine)
1260 .addFunction ("connected", &PortManager::connected)
1261 .addFunction ("connect", &PortManager::connect)
1262 .addFunction ("physically_connected", &PortManager::physically_connected)
1263 .addFunction ("disconnect", (int (PortManager::*)(const std::string&, const std::string&))&PortManager::disconnect)
1264 .addFunction ("disconnect_port", (int (PortManager::*)(boost::shared_ptr<Port>))&PortManager::disconnect)
1265 .addFunction ("get_port_by_name", &PortManager::get_port_by_name)
1266 .addFunction ("get_pretty_name_by_name", &PortManager::get_pretty_name_by_name)
1267 .addFunction ("port_is_physical", &PortManager::port_is_physical)
1268 .addFunction ("get_physical_outputs", &PortManager::get_physical_outputs)
1269 .addFunction ("get_physical_inputs", &PortManager::get_physical_inputs)
1270 .addFunction ("n_physical_outputs", &PortManager::n_physical_outputs)
1271 .addFunction ("n_physical_inputs", &PortManager::n_physical_inputs)
1272 .addRefFunction ("get_connections", &PortManager::get_connections)
1273 .addRefFunction ("get_ports", (int (PortManager::*)(DataType, PortManager::PortList&))&PortManager::get_ports)
1274 .addRefFunction ("get_backend_ports", (int (PortManager::*)(const std::string&, DataType, PortFlags, std::vector<std::string>&))&PortManager::get_ports)
1277 .deriveClass <AudioEngine, PortManager> ("AudioEngine")
1278 .addFunction ("available_backends", &AudioEngine::available_backends)
1279 .addFunction ("current_backend_name", &AudioEngine::current_backend_name)
1280 .addFunction ("set_backend", &AudioEngine::set_backend)
1281 .addFunction ("setup_required", &AudioEngine::setup_required)
1282 .addFunction ("start", &AudioEngine::start)
1283 .addFunction ("stop", &AudioEngine::stop)
1284 .addFunction ("get_dsp_load", &AudioEngine::get_dsp_load)
1285 .addFunction ("set_device_name", &AudioEngine::set_device_name)
1286 .addFunction ("set_sample_rate", &AudioEngine::set_sample_rate)
1287 .addFunction ("set_buffer_size", &AudioEngine::set_buffer_size)
1288 .addFunction ("get_last_backend_error", &AudioEngine::get_last_backend_error)
1291 .deriveClass <SessionConfiguration, PBD::Configuration> ("SessionConfiguration")
1292 #undef CONFIG_VARIABLE
1293 #undef CONFIG_VARIABLE_SPECIAL
1294 #define CONFIG_VARIABLE(Type,var,name,value) \
1295 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1296 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1297 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1299 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
1300 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1301 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1302 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1304 #include "ardour/session_configuration_vars.h"
1306 #undef CONFIG_VARIABLE
1307 #undef CONFIG_VARIABLE_SPECIAL
1311 // basic representation of Session
1312 // functions which can be used from realtime and non-realtime contexts
1313 luabridge::getGlobalNamespace (L)
1314 .beginNamespace ("ARDOUR")
1315 .beginClass <Session> ("Session")
1316 .addFunction ("scripts_changed", &Session::scripts_changed) // used internally
1317 .addFunction ("transport_rolling", &Session::transport_rolling)
1318 .addFunction ("request_transport_speed", &Session::request_transport_speed)
1319 .addFunction ("transport_frame", &Session::transport_frame)
1320 .addFunction ("transport_speed", &Session::transport_speed)
1321 .addFunction ("frame_rate", &Session::frame_rate)
1322 .addFunction ("nominal_frame_rate", &Session::nominal_frame_rate)
1323 .addFunction ("frames_per_timecode_frame", &Session::frames_per_timecode_frame)
1324 .addFunction ("timecode_frames_per_hour", &Session::timecode_frames_per_hour)
1325 .addFunction ("timecode_frames_per_second", &Session::timecode_frames_per_second)
1326 .addFunction ("timecode_drop_frames", &Session::timecode_drop_frames)
1327 .addFunction ("request_locate", &Session::request_locate)
1328 .addFunction ("request_stop", &Session::request_stop)
1329 .addFunction ("last_transport_start", &Session::last_transport_start)
1330 .addFunction ("goto_start", &Session::goto_start)
1331 .addFunction ("goto_end", &Session::goto_end)
1332 .addFunction ("current_start_frame", &Session::current_start_frame)
1333 .addFunction ("current_end_frame", &Session::current_end_frame)
1334 .addFunction ("actively_recording", &Session::actively_recording)
1335 .addFunction ("new_audio_track", &Session::new_audio_track)
1336 .addFunction ("new_audio_route", &Session::new_audio_route)
1337 .addFunction ("new_midi_track", &Session::new_midi_track)
1338 .addFunction ("new_midi_route", &Session::new_midi_route)
1339 .addFunction ("get_routes", &Session::get_routes)
1340 .addFunction ("get_tracks", &Session::get_tracks)
1341 .addFunction ("name", &Session::name)
1342 .addFunction ("path", &Session::path)
1343 .addFunction ("record_status", &Session::record_status)
1344 .addFunction ("route_by_id", &Session::route_by_id)
1345 .addFunction ("route_by_name", &Session::route_by_name)
1346 .addFunction ("get_remote_nth_stripable", &Session::get_remote_nth_stripable)
1347 .addFunction ("get_remote_nth_route", &Session::get_remote_nth_route)
1348 .addFunction ("route_by_selected_count", &Session::route_by_selected_count)
1349 .addFunction ("track_by_diskstream_id", &Session::track_by_diskstream_id)
1350 .addFunction ("source_by_id", &Session::source_by_id)
1351 .addFunction ("controllable_by_id", &Session::controllable_by_id)
1352 .addFunction ("processor_by_id", &Session::processor_by_id)
1353 .addFunction ("snap_name", &Session::snap_name)
1354 .addFunction ("monitor_out", &Session::monitor_out)
1355 .addFunction ("master_out", &Session::master_out)
1356 .addFunction ("tempo_map", (TempoMap& (Session::*)())&Session::tempo_map)
1357 .addFunction ("locations", &Session::locations)
1358 .addFunction ("begin_reversible_command", (void (Session::*)(const std::string&))&Session::begin_reversible_command)
1359 .addFunction ("commit_reversible_command", &Session::commit_reversible_command)
1360 .addFunction ("abort_reversible_command", &Session::abort_reversible_command)
1361 .addFunction ("add_command", &Session::add_command)
1362 .addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command)
1363 .addFunction ("engine", (AudioEngine& (Session::*)())&Session::engine)
1364 .addFunction ("get_block_size", &Session::get_block_size)
1365 .addFunction ("worst_output_latency", &Session::worst_output_latency)
1366 .addFunction ("worst_input_latency", &Session::worst_input_latency)
1367 .addFunction ("worst_track_latency", &Session::worst_track_latency)
1368 .addFunction ("worst_playback_latency", &Session::worst_playback_latency)
1369 .addFunction ("cfg", &Session::cfg)
1372 .beginClass <RegionFactory> ("RegionFactory")
1373 .addStaticFunction ("region_by_id", &RegionFactory::region_by_id)
1376 /* session enums (rt-safe, common) */
1377 .beginNamespace ("Session")
1379 .beginNamespace ("RecordState")
1380 .addConst ("Disabled", ARDOUR::Session::RecordState(Session::Disabled))
1381 .addConst ("Enabled", ARDOUR::Session::RecordState(Session::Enabled))
1382 .addConst ("Recording", ARDOUR::Session::RecordState(Session::Recording))
1385 .endNamespace () // end Session enums
1387 /* ardour enums (rt-safe, common) */
1388 .beginNamespace ("LocationFlags")
1389 .addConst ("IsMark", ARDOUR::Location::Flags(Location::IsMark))
1390 .addConst ("IsAutoPunch", ARDOUR::Location::Flags(Location::IsAutoPunch))
1391 .addConst ("IsAutoLoop", ARDOUR::Location::Flags(Location::IsAutoLoop))
1392 .addConst ("IsHidden", ARDOUR::Location::Flags(Location::IsHidden))
1393 .addConst ("IsCDMarker", ARDOUR::Location::Flags(Location::IsCDMarker))
1394 .addConst ("IsRangeMarker", ARDOUR::Location::Flags(Location::IsRangeMarker))
1395 .addConst ("IsSessionRange", ARDOUR::Location::Flags(Location::IsSessionRange))
1396 .addConst ("IsSkip", ARDOUR::Location::Flags(Location::IsSkip))
1397 .addConst ("IsSkipping", ARDOUR::Location::Flags(Location::IsSkipping))
1400 .beginNamespace ("LuaAPI")
1401 .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor)
1402 .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc)
1403 .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info)
1404 .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
1405 .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
1406 .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param)
1407 .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
1408 .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
1409 .addFunction ("usleep", Glib::usleep)
1410 .endNamespace () // end LuaAPI
1411 .endNamespace ();// end ARDOUR
1415 LuaBindings::dsp (lua_State* L)
1417 luabridge::getGlobalNamespace (L)
1418 .beginNamespace ("ARDOUR")
1420 .beginClass <AudioBuffer> ("AudioBuffer")
1422 .addFunction ("data", (Sample*(AudioBuffer::*)(framecnt_t))&AudioBuffer::data)
1423 .addFunction ("silence", &AudioBuffer::silence)
1424 .addFunction ("apply_gain", &AudioBuffer::apply_gain)
1425 .addFunction ("check_silence", &AudioBuffer::check_silence)
1426 .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, framecnt_t, framecnt_t, framecnt_t))&AudioBuffer::check_silence)
1429 .beginClass <MidiBuffer> ("MidiBuffer")
1431 .addFunction ("silence", &MidiBuffer::silence)
1432 .addFunction ("size", &MidiBuffer::size)
1433 .addFunction ("empty", &MidiBuffer::empty)
1434 .addFunction ("resize", &MidiBuffer::resize)
1435 .addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy)
1436 .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::MIDIEvent<framepos_t>&))&MidiBuffer::push_back)
1437 .addFunction ("push_back", (bool (MidiBuffer::*)(framepos_t, size_t, const uint8_t*))&MidiBuffer::push_back)
1439 .addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::MIDIEvent<framepos_t>, MidiBuffer>)
1442 .beginClass <BufferSet> ("BufferSet")
1444 .addFunction ("get_audio", static_cast<AudioBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_audio))
1445 .addFunction ("get_midi", static_cast<MidiBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_midi))
1446 .addFunction ("count", static_cast<const ChanCount&(BufferSet::*)()const>(&BufferSet::count))
1450 luabridge::getGlobalNamespace (L)
1451 .beginNamespace ("Evoral")
1452 .beginClass <Evoral::Event<framepos_t> > ("Event")
1453 .addFunction ("clear", &Evoral::Event<framepos_t>::clear)
1454 .addFunction ("size", &Evoral::Event<framepos_t>::size)
1455 .addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
1456 .addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
1457 .addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
1460 .beginClass <Evoral::Beats> ("Beats")
1461 .addFunction ("to_double", &Evoral::Beats::to_double)
1464 .deriveClass <Evoral::MIDIEvent<framepos_t>, Evoral::Event<framepos_t> > ("MidiEvent")
1466 .addFunction ("type", &Evoral::MIDIEvent<framepos_t>::type)
1467 .addFunction ("channel", &Evoral::MIDIEvent<framepos_t>::channel)
1468 .addFunction ("set_type", &Evoral::MIDIEvent<framepos_t>::set_type)
1469 .addFunction ("set_channel", &Evoral::MIDIEvent<framepos_t>::set_channel)
1473 // dsp releated session functions
1474 luabridge::getGlobalNamespace (L)
1475 .beginNamespace ("ARDOUR")
1476 .beginClass <Session> ("Session")
1477 .addFunction ("get_scratch_buffers", &Session::get_scratch_buffers)
1478 .addFunction ("get_silent_buffers", &Session::get_silent_buffers)
1482 luabridge::getGlobalNamespace (L)
1483 .beginNamespace ("ARDOUR")
1484 .beginNamespace ("DSP")
1485 .addFunction ("compute_peak", ARDOUR::compute_peak)
1486 .addFunction ("find_peaks", ARDOUR::find_peaks)
1487 .addFunction ("apply_gain_to_buffer", ARDOUR::apply_gain_to_buffer)
1488 .addFunction ("mix_buffers_no_gain", ARDOUR::mix_buffers_no_gain)
1489 .addFunction ("mix_buffers_with_gain", ARDOUR::mix_buffers_with_gain)
1490 .addFunction ("copy_vector", ARDOUR::copy_vector)
1491 .addFunction ("dB_to_coefficient", &dB_to_coefficient)
1492 .addFunction ("fast_coefficient_to_dB", &fast_coefficient_to_dB)
1493 .addFunction ("accurate_coefficient_to_dB", &accurate_coefficient_to_dB)
1494 .addFunction ("memset", &DSP::memset)
1495 .addFunction ("mmult", &DSP::mmult)
1496 .addFunction ("log_meter", &DSP::log_meter)
1497 .addFunction ("log_meter_coeff", &DSP::log_meter_coeff)
1498 .addFunction ("process_map", &DSP::process_map)
1499 .addRefFunction ("peaks", &DSP::peaks)
1501 .beginClass <DSP::LowPass> ("LowPass")
1502 .addConstructor <void (*) (double, float)> ()
1503 .addFunction ("proc", &DSP::LowPass::proc)
1504 .addFunction ("ctrl", &DSP::LowPass::ctrl)
1505 .addFunction ("set_cutoff", &DSP::LowPass::set_cutoff)
1506 .addFunction ("reset", &DSP::LowPass::reset)
1508 .beginClass <DSP::Biquad> ("Biquad")
1509 .addConstructor <void (*) (double)> ()
1510 .addFunction ("run", &DSP::Biquad::run)
1511 .addFunction ("compute", &DSP::Biquad::compute)
1512 .addFunction ("configure", &DSP::Biquad::configure)
1513 .addFunction ("reset", &DSP::Biquad::reset)
1514 .addFunction ("dB_at_freq", &DSP::Biquad::dB_at_freq)
1516 .beginClass <DSP::FFTSpectrum> ("FFTSpectrum")
1517 .addConstructor <void (*) (uint32_t, double)> ()
1518 .addFunction ("set_data_hann", &DSP::FFTSpectrum::set_data_hann)
1519 .addFunction ("execute", &DSP::FFTSpectrum::execute)
1520 .addFunction ("power_at_bin", &DSP::FFTSpectrum::power_at_bin)
1521 .addFunction ("freq_at_bin", &DSP::FFTSpectrum::freq_at_bin)
1525 .beginNamespace ("BiquadType")
1526 .addConst ("LowPass", ARDOUR::DSP::Biquad::LowPass)
1527 .addConst ("HighPass", ARDOUR::DSP::Biquad::HighPass)
1528 .addConst ("BandPassSkirt", ARDOUR::DSP::Biquad::BandPassSkirt)
1529 .addConst ("BandPass0dB", ARDOUR::DSP::Biquad::BandPass0dB)
1530 .addConst ("Notch", ARDOUR::DSP::Biquad::Notch)
1531 .addConst ("AllPass", ARDOUR::DSP::Biquad::AllPass)
1532 .addConst ("Peaking", ARDOUR::DSP::Biquad::Peaking)
1533 .addConst ("LowShelf", ARDOUR::DSP::Biquad::LowShelf)
1534 .addConst ("HighShelf", ARDOUR::DSP::Biquad::HighShelf)
1537 .beginClass <DSP::DspShm> ("DspShm")
1538 .addConstructor<void (*) (size_t)> ()
1539 .addFunction ("allocate", &DSP::DspShm::allocate)
1540 .addFunction ("clear", &DSP::DspShm::clear)
1541 .addFunction ("to_float", &DSP::DspShm::to_float)
1542 .addFunction ("to_int", &DSP::DspShm::to_int)
1543 .addFunction ("atomic_set_int", &DSP::DspShm::atomic_set_int)
1544 .addFunction ("atomic_get_int", &DSP::DspShm::atomic_get_int)
1547 .endNamespace () // DSP
1549 .beginClass <LuaTableRef> ("LuaTableRef")
1550 .addCFunction ("get", &LuaTableRef::get)
1551 .addCFunction ("set", &LuaTableRef::set)
1554 .endNamespace (); // ARDOUR
1558 LuaBindings::session (lua_State* L)
1560 // non-realtime session functions
1561 luabridge::getGlobalNamespace (L)
1562 .beginNamespace ("ARDOUR")
1563 .beginClass <Session> ("Session")
1564 .addFunction ("save_state", &Session::save_state)
1565 .addFunction ("set_dirty", &Session::set_dirty)
1566 .addFunction ("unknown_processors", &Session::unknown_processors)
1568 .addFunction<RouteList (Session::*)(uint32_t, const std::string&, const std::string&, PlaylistDisposition)> ("new_route_from_template", &Session::new_route_from_template)
1569 // TODO session_add_audio_track session_add_midi_track session_add_mixed_track
1570 //.addFunction ("new_midi_track", &Session::new_midi_track)
1573 .endNamespace (); // ARDOUR
1577 LuaBindings::osc (lua_State* L)
1579 luabridge::getGlobalNamespace (L)
1580 .beginNamespace ("ARDOUR")
1581 .beginNamespace ("LuaOSC")
1582 .beginClass<LuaOSC::Address> ("Address")
1583 .addConstructor<void (*) (std::string)> ()
1584 .addCFunction ("send", &LuaOSC::Address::send)
1591 LuaBindings::set_session (lua_State* L, Session *s)
1593 /* LuaBridge uses unique keys to identify classes/c-types.
1595 * Those keys are "generated" by using the memory-address of a static
1596 * variable, templated for every Class.
1597 * (see libs/lua/LuaBridge/detail/ClassInfo.h)
1599 * When linking the final executable there must be exactly one static
1600 * function (static variable) for every templated class.
1601 * This works fine on OSX and Linux...
1603 * Windows (mingw and MSVC) however expand the template differently for libardour
1604 * AND gtk2_ardour. We end up with two identical static functions
1605 * at different addresses!!
1607 * The Solution: have gtk2_ardour never include LuaBridge headers directly
1608 * and always go via libardour function calls for classes that are registered
1609 * in libardour. (calling lua itself is fine, calling c-functions in the GUI
1610 * which expand the template is not)
1612 * (the actual cause: even static symbols in a .dll have no fixed address
1613 * and are mapped when loading the dll. static functions in .exe do have a fixed
1617 * 0000000000000000 I __imp__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1618 * 0000000000000000 I __nm__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1619 * 0000000000000000 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
1622 * 000000000104f560 d .data$_ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1623 * 000000000104f560 D _ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
1624 * 0000000000e9baf0 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
1628 luabridge::push <Session *> (L, s);
1629 lua_setglobal (L, "Session");
1632 // call lua function.
1633 luabridge::LuaRef cb_ses = luabridge::getGlobal (L, "new_session");
1634 if (cb_ses.type() == LUA_TFUNCTION) { cb_ses(s->name()); } // TODO args