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/audioplaylist.h"
36 #include "ardour/buffer_set.h"
37 #include "ardour/chan_mapping.h"
38 #include "ardour/dB.h"
39 #include "ardour/dsp_filter.h"
40 #include "ardour/fluid_synth.h"
41 #include "ardour/interthread_info.h"
42 #include "ardour/lua_api.h"
43 #include "ardour/luabindings.h"
44 #include "ardour/luaproc.h"
45 #include "ardour/meter.h"
46 #include "ardour/midi_model.h"
47 #include "ardour/midi_track.h"
48 #include "ardour/midi_playlist.h"
49 #include "ardour/midi_port.h"
50 #include "ardour/midi_region.h"
51 #include "ardour/midi_source.h"
52 #include "ardour/panner_shell.h"
53 #include "ardour/phase_control.h"
54 #include "ardour/playlist.h"
55 #include "ardour/plugin.h"
56 #include "ardour/plugin_insert.h"
57 #include "ardour/port_manager.h"
58 #include "ardour/runtime_functions.h"
59 #include "ardour/region.h"
60 #include "ardour/region_factory.h"
61 #include "ardour/route_group.h"
62 #include "ardour/session.h"
63 #include "ardour/session_object.h"
64 #include "ardour/sidechain.h"
65 #include "ardour/solo_isolate_control.h"
66 #include "ardour/solo_safe_control.h"
67 #include "ardour/stripable.h"
68 #include "ardour/track.h"
69 #include "ardour/tempo.h"
71 #include "LuaBridge/LuaBridge.h"
73 #ifdef PLATFORM_WINDOWS
74 /* luabridge uses addresses of static functions/variables to identify classes.
76 * Static symbols on windows (even identical symbols) are not
77 * mapped to the same address when mixing .dll + .exe.
78 * So we need a single point to define those static functions.
79 * (normally they're header-only in libs/lua/LuaBridge/detail/ClassInfo.h)
81 * Really!! A static function with a static variable in a library header
82 * should never ever be replicated, even if it is a template.
83 * But then again this is windows... what else can go wrong ?!
88 luabridge::ClassInfo<T>::getStaticKey ()
96 luabridge::ClassInfo<T>::getClassKey ()
104 luabridge::ClassInfo<T>::getConstKey ()
111 luabridge::getIdentityKey ()
117 /* ...and this is the ugly part of it.
119 * We need to foward declare classes from gtk2_ardour
120 * AND explicily list classes which are used by gtk2_ardour's bindings.
122 * This is required because some of the GUI classes use objects from libardour
123 * as function parameters or return values and the .exe would re-create
124 * symbols for libardour objects.
127 #define CLASSKEYS(CLS) \
128 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
129 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
130 template void const* luabridge::ClassInfo< CLS >::getConstKey();
132 #define CLASSINFO(CLS) \
134 template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
135 template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
136 template void const* luabridge::ClassInfo< CLS >::getConstKey();
138 CLASSINFO(ArdourMarker);
139 CLASSINFO(MarkerSelection);
140 CLASSINFO(PublicEditor);
141 CLASSINFO(RegionSelection);
142 CLASSINFO(Selection);
143 CLASSINFO(TimeSelection);
144 CLASSINFO(TrackSelection);
145 CLASSINFO(TrackViewList);
147 CLASSKEYS(std::bitset<47ul>); // LuaSignal::LAST_SIGNAL
151 CLASSKEYS(unsigned char);
153 CLASSKEYS(ArdourMarker*);
155 CLASSKEYS(ARDOUR::AudioEngine);
156 CLASSKEYS(ARDOUR::BufferSet);
157 CLASSKEYS(ARDOUR::ChanCount);
158 CLASSKEYS(ARDOUR::ChanMapping);
159 CLASSKEYS(ARDOUR::DSP::DspShm);
160 CLASSKEYS(ARDOUR::DataType);
161 CLASSKEYS(ARDOUR::FluidSynth);
162 CLASSKEYS(ARDOUR::Location);
163 CLASSKEYS(ARDOUR::LuaAPI::Vamp);
164 CLASSKEYS(ARDOUR::LuaOSC::Address);
165 CLASSKEYS(ARDOUR::LuaProc);
166 CLASSKEYS(ARDOUR::LuaTableRef);
167 CLASSKEYS(ARDOUR::MidiModel::NoteDiffCommand);
168 CLASSKEYS(ARDOUR::MonitorProcessor);
169 CLASSKEYS(ARDOUR::RouteGroup);
170 CLASSKEYS(ARDOUR::ParameterDescriptor);
171 CLASSKEYS(ARDOUR::PeakMeter);
172 CLASSKEYS(ARDOUR::PluginInfo);
173 CLASSKEYS(ARDOUR::Plugin::PresetRecord);
174 CLASSKEYS(ARDOUR::PortEngine);
175 CLASSKEYS(ARDOUR::PortManager);
176 CLASSKEYS(ARDOUR::PresentationInfo);
177 CLASSKEYS(ARDOUR::Session);
178 CLASSKEYS(ARDOUR::SessionConfiguration);
179 CLASSKEYS(ARDOUR::Source);
182 CLASSKEYS(PBD::Configuration);
183 CLASSKEYS(PBD::PropertyChange);
184 CLASSKEYS(PBD::StatefulDestructible);
186 CLASSKEYS(Evoral::Beats);
187 CLASSKEYS(Evoral::Event<framepos_t>);
190 CLASSKEYS(std::vector<std::string>);
191 CLASSKEYS(std::vector<float>);
192 CLASSKEYS(std::vector<float*>);
193 CLASSKEYS(std::vector<double>);
195 CLASSKEYS(std::vector<ARDOUR::Plugin::PresetRecord>);
196 CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Processor> >);
197 CLASSKEYS(std::vector<boost::shared_ptr<ARDOUR::Source> >);
199 CLASSKEYS(std::list<ArdourMarker*>);
200 CLASSKEYS(std::list<ARDOUR::AudioRange>);
201 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Port> >);
202 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Region> >);
203 CLASSKEYS(std::list<boost::shared_ptr<ARDOUR::Route> >);
205 CLASSKEYS(boost::shared_ptr<ARDOUR::Automatable>);
206 CLASSKEYS(boost::shared_ptr<ARDOUR::AutomatableSequence<Evoral::Beats> >);
207 CLASSKEYS(boost::shared_ptr<ARDOUR::AutomationList>);
208 CLASSKEYS(boost::shared_ptr<ARDOUR::MidiModel>);
209 CLASSKEYS(boost::shared_ptr<ARDOUR::MidiPlaylist>);
210 CLASSKEYS(boost::shared_ptr<ARDOUR::MidiRegion>);
211 CLASSKEYS(boost::shared_ptr<ARDOUR::MidiSource>);
212 CLASSKEYS(boost::shared_ptr<ARDOUR::PluginInfo>);
213 CLASSKEYS(boost::shared_ptr<ARDOUR::Processor>);
214 CLASSKEYS(boost::shared_ptr<ARDOUR::Region>);
215 CLASSKEYS(boost::shared_ptr<Evoral::ControlList>);
216 CLASSKEYS(boost::shared_ptr<Evoral::Note<Evoral::Beats> >);
217 CLASSKEYS(boost::shared_ptr<Evoral::Sequence<Evoral::Beats> >);
219 CLASSKEYS(boost::weak_ptr<ARDOUR::Route>);
221 CLASSKEYS(Vamp::RealTime);
222 CLASSKEYS(Vamp::PluginBase);
223 CLASSKEYS(Vamp::PluginBase::ParameterDescriptor);
224 CLASSKEYS(Vamp::Plugin);
225 CLASSKEYS(Vamp::Plugin::OutputDescriptor);
226 CLASSKEYS(Vamp::Plugin::Feature);
227 CLASSKEYS(Vamp::Plugin::OutputList);
228 CLASSKEYS(Vamp::Plugin::FeatureList);
229 CLASSKEYS(Vamp::Plugin::FeatureSet);
239 CLASSKEYS(Cairo::Context);
240 CLASSKEYS(LuaCairo::ImageSurface);
241 CLASSKEYS(LuaCairo::PangoLayout);
243 #endif // end windows special case
245 /* Some notes on Lua bindings for libardour and friends
247 * - Prefer factory methods over Contructors whenever possible.
248 * Don't expose the constructor method unless required.
250 * e.g. Don't allow the script to construct a "Track" Object directly
251 * but do allow to create a "BBT_TIME" object.
253 * - Do not dereference Shared or Weak Pointers. Pass the pointer to Lua.
254 * - Define Objects as boost:shared_ptr Object whenever possible.
256 * Storing a boost::shared_ptr in a Lua-variable keeps the reference
257 * until that variable is set to 'nil'.
258 * (if the script were to keep a direct pointer to the object instance, the
259 * behaviour is undefined if the actual object goes away)
261 * Methods of the actual class are indirectly exposed,
262 * boost::*_ptr get() and ::lock() is implicit when the class is exported
263 * as LuaBridge's "WSPtrClass".
266 using namespace ARDOUR;
269 LuaBindings::stddef (lua_State* L)
271 // std::list<std::string>
272 luabridge::getGlobalNamespace (L)
273 .beginNamespace ("C")
274 .beginStdList <std::string> ("StringList")
277 // std::vector<std::string>
278 .beginStdVector <std::string> ("StringVector")
281 // std::vector<float>
282 .beginStdVector <float> ("FloatVector")
285 // register float array (uint8_t*)
286 .registerArray <uint8_t> ("ByteArray")
288 // register float array (float*)
289 .registerArray <float> ("FloatArray")
291 // register float array (int32_t*)
292 .registerArray <int32_t> ("IntArray")
294 // std::vector<float*>
295 .beginStdVector <float*> ("FloatArrayVector")
303 LuaBindings::common (lua_State* L)
305 luabridge::getGlobalNamespace (L)
306 .beginNamespace ("PBD")
308 .addFunction ("open_uri", (bool (*) (const std::string&))&PBD::open_uri)
309 .addFunction ("open_uri", &PBD::open_folder)
311 .beginClass <PBD::ID> ("ID")
312 .addConstructor <void (*) (std::string)> ()
313 .addFunction ("to_s", &PBD::ID::to_s) // TODO special case LUA __tostring ?
316 .beginStdVector <PBD::ID> ("IdVector").endClass ()
318 .beginClass <XMLNode> ("XMLNode")
319 .addFunction ("name", &XMLNode::name)
322 .beginClass <PBD::Stateful> ("Stateful")
323 .addFunction ("id", &PBD::Stateful::id)
324 .addFunction ("properties", &PBD::Stateful::properties)
325 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
328 .beginWSPtrClass <PBD::Stateful> ("StatefulPtr")
329 .addFunction ("id", &PBD::Stateful::id)
330 .addFunction ("properties", &PBD::Stateful::properties)
331 .addFunction ("clear_changes", &PBD::Stateful::clear_changes)
334 .deriveClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructible")
337 .deriveClass <PBD::Configuration, PBD::Stateful> ("Configuration")
340 .deriveWSPtrClass <PBD::StatefulDestructible, PBD::Stateful> ("StatefulDestructiblePtr")
343 .deriveClass <Command, PBD::StatefulDestructible> ("Command")
344 .addFunction ("set_name", &Command::set_name)
345 .addFunction ("name", &Command::name)
348 /* UndoTransaction::add_command() subscribes to DropReferences()
349 * and deletes the object.
351 * This object cannot be constructed by lua because lua would manage lifetime
352 * and delete the object leading to a double free.
354 * use Session::add_stateful_diff_command()
355 * and Session::abort_reversible_command()
357 .deriveClass <PBD::StatefulDiffCommand, Command> ("StatefulDiffCommand")
358 .addFunction ("undo", &PBD::StatefulDiffCommand::undo)
359 .addFunction ("empty", &PBD::StatefulDiffCommand::empty)
362 .deriveWSPtrClass <PBD::Controllable, PBD::StatefulDestructible> ("Controllable")
363 .addFunction ("name", &PBD::Controllable::name)
364 .addFunction ("get_value", &PBD::Controllable::get_value)
367 .beginClass <PBD::RingBufferNPT <uint8_t> > ("RingBuffer8")
368 .addConstructor <void (*) (size_t)> ()
369 .addFunction ("reset", &PBD::RingBufferNPT<uint8_t>::reset)
370 .addFunction ("read", &PBD::RingBufferNPT<uint8_t>::read)
371 .addFunction ("write", &PBD::RingBufferNPT<uint8_t>::write)
372 .addFunction ("write_one", &PBD::RingBufferNPT<uint8_t>::write_one)
373 .addFunction ("write_space", &PBD::RingBufferNPT<uint8_t>::write_space)
374 .addFunction ("read_space", &PBD::RingBufferNPT<uint8_t>::read_space)
375 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<uint8_t>::increment_read_ptr)
376 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<uint8_t>::increment_write_ptr)
379 .beginClass <PBD::RingBufferNPT <float> > ("RingBufferF")
380 .addConstructor <void (*) (size_t)> ()
381 .addFunction ("reset", &PBD::RingBufferNPT<float>::reset)
382 .addFunction ("read", &PBD::RingBufferNPT<float>::read)
383 .addFunction ("write", &PBD::RingBufferNPT<float>::write)
384 .addFunction ("write_one", &PBD::RingBufferNPT<float>::write_one)
385 .addFunction ("write_space", &PBD::RingBufferNPT<float>::write_space)
386 .addFunction ("read_space", &PBD::RingBufferNPT<float>::read_space)
387 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<float>::increment_read_ptr)
388 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<float>::increment_write_ptr)
391 .beginClass <PBD::RingBufferNPT <int> > ("RingBufferI")
392 .addConstructor <void (*) (size_t)> ()
393 .addFunction ("reset", &PBD::RingBufferNPT<int>::reset)
394 .addFunction ("read", &PBD::RingBufferNPT<int>::read)
395 .addFunction ("write", &PBD::RingBufferNPT<int>::write)
396 .addFunction ("write_one", &PBD::RingBufferNPT<int>::write_one)
397 .addFunction ("write_space", &PBD::RingBufferNPT<int>::write_space)
398 .addFunction ("read_space", &PBD::RingBufferNPT<int>::read_space)
399 .addFunction ("increment_read_ptr", &PBD::RingBufferNPT<int>::increment_read_ptr)
400 .addFunction ("increment_write_ptr", &PBD::RingBufferNPT<int>::increment_write_ptr)
404 .beginNamespace ("GroupControlDisposition")
405 .addConst ("InverseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::InverseGroup))
406 .addConst ("NoGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::NoGroup))
407 .addConst ("UseGroup", PBD::Controllable::GroupControlDisposition(PBD::Controllable::UseGroup))
410 .endNamespace (); // PBD
412 luabridge::getGlobalNamespace (L)
413 .beginNamespace ("Timecode")
414 .beginClass <Timecode::BBT_Time> ("BBT_TIME")
415 .addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
416 .addData ("bars", &Timecode::BBT_Time::bars)
417 .addData ("beats", &Timecode::BBT_Time::beats)
418 .addData ("ticks", &Timecode::BBT_Time::ticks)
419 //.addStaticData ("ticks_per_beat", &Timecode::BBT_Time::ticks_per_beat, false)
422 /* libtimecode enums */
423 .beginNamespace ("TimecodeFormat")
424 .addConst ("TC23976", Timecode::TimecodeFormat(Timecode::timecode_23976))
425 .addConst ("TC24", Timecode::TimecodeFormat(Timecode::timecode_24))
426 .addConst ("TC24976", Timecode::TimecodeFormat(Timecode::timecode_24976))
427 .addConst ("TC25", Timecode::TimecodeFormat(Timecode::timecode_25))
428 .addConst ("TC2997", Timecode::TimecodeFormat(Timecode::timecode_2997))
429 .addConst ("TC2997DF", Timecode::TimecodeFormat(Timecode::timecode_2997drop))
430 .addConst ("TC2997000", Timecode::TimecodeFormat(Timecode::timecode_2997000))
431 .addConst ("TC2997000DF", Timecode::TimecodeFormat(Timecode::timecode_2997000drop))
432 .addConst ("TC30", Timecode::TimecodeFormat(Timecode::timecode_30))
433 .addConst ("TC5994", Timecode::TimecodeFormat(Timecode::timecode_5994))
434 .addConst ("TC60", Timecode::TimecodeFormat(Timecode::timecode_60))
438 luabridge::getGlobalNamespace (L)
440 .beginNamespace ("Evoral")
441 .beginClass <Evoral::Event<framepos_t> > ("Event")
442 .addFunction ("clear", &Evoral::Event<framepos_t>::clear)
443 .addFunction ("size", &Evoral::Event<framepos_t>::size)
444 .addFunction ("set_buffer", &Evoral::Event<framepos_t>::set_buffer)
445 .addFunction ("buffer", (uint8_t*(Evoral::Event<framepos_t>::*)())&Evoral::Event<framepos_t>::buffer)
446 .addFunction ("time", (framepos_t (Evoral::Event<framepos_t>::*)())&Evoral::MIDIEvent<framepos_t>::time)
449 .beginClass <Evoral::Beats> ("Beats")
450 .addConstructor <void (*) (double)> ()
451 .addFunction ("to_double", &Evoral::Beats::to_double)
454 .beginClass <Evoral::Parameter> ("Parameter")
455 .addConstructor <void (*) (uint32_t, uint8_t, uint32_t)> ()
456 .addFunction ("type", &Evoral::Parameter::type)
457 .addFunction ("channel", &Evoral::Parameter::channel)
458 .addFunction ("id", &Evoral::Parameter::id)
461 .beginWSPtrClass <Evoral::ControlList> ("ControlList")
462 .addFunction ("add", &Evoral::ControlList::add)
463 .addFunction ("thin", &Evoral::ControlList::thin)
464 .addFunction ("eval", &Evoral::ControlList::eval)
465 .addRefFunction ("rt_safe_eval", &Evoral::ControlList::rt_safe_eval)
466 .addFunction ("interpolation", &Evoral::ControlList::interpolation)
467 .addFunction ("set_interpolation", &Evoral::ControlList::set_interpolation)
468 .addFunction ("truncate_end", &Evoral::ControlList::truncate_end)
469 .addFunction ("truncate_start", &Evoral::ControlList::truncate_start)
470 .addFunction ("clear", (void (Evoral::ControlList::*)(double, double))&Evoral::ControlList::clear)
471 .addFunction ("in_write_pass", &Evoral::ControlList::in_write_pass)
474 .beginWSPtrClass <Evoral::ControlSet> ("ControlSet")
477 .beginWSPtrClass <Evoral::Control> ("Control")
478 .addFunction ("list", (boost::shared_ptr<Evoral::ControlList>(Evoral::Control::*)())&Evoral::Control::list)
481 .beginClass <Evoral::ParameterDescriptor> ("ParameterDescriptor")
482 .addVoidConstructor ()
483 .addData ("lower", &Evoral::ParameterDescriptor::lower)
484 .addData ("upper", &Evoral::ParameterDescriptor::upper)
485 .addData ("normal", &Evoral::ParameterDescriptor::normal)
486 .addData ("toggled", &Evoral::ParameterDescriptor::toggled)
489 .beginClass <Evoral::Range<framepos_t> > ("Range")
490 .addConstructor <void (*) (framepos_t, framepos_t)> ()
491 .addData ("from", &Evoral::Range<framepos_t>::from)
492 .addData ("to", &Evoral::Range<framepos_t>::to)
495 .deriveWSPtrClass <Evoral::Sequence<Evoral::Beats>, Evoral::ControlSet> ("Sequence")
498 .beginWSPtrClass <Evoral::Note<Evoral::Beats> > ("NotePtr")
499 .addFunction ("time", &Evoral::Note<Evoral::Beats>::time)
500 .addFunction ("note", &Evoral::Note<Evoral::Beats>::note)
501 .addFunction ("velocity", &Evoral::Note<Evoral::Beats>::velocity)
502 .addFunction ("off_velocity", &Evoral::Note<Evoral::Beats>::off_velocity)
503 .addFunction ("length", &Evoral::Note<Evoral::Beats>::length)
504 .addFunction ("channel", &Evoral::Note<Evoral::Beats>::channel)
507 /* libevoral enums */
508 .beginNamespace ("InterpolationStyle")
509 .addConst ("Discrete", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Discrete))
510 .addConst ("Linear", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Linear))
511 .addConst ("Curved", Evoral::ControlList::InterpolationStyle(Evoral::ControlList::Curved))
514 .endNamespace () // Evoral
516 .beginNamespace ("Vamp")
518 .beginClass<Vamp::RealTime> ("RealTime")
519 .addConstructor <void (*) (int, int)> ()
520 .addData ("sec", &Vamp::RealTime::sec, false)
521 .addData ("nsec", &Vamp::RealTime::nsec, false)
522 .addFunction ("usec", &Vamp::RealTime::usec)
523 .addFunction ("msec", &Vamp::RealTime::msec)
524 .addFunction ("toString", &Vamp::RealTime::toString)
525 .addStaticFunction ("realTime2Frame", &Vamp::RealTime::realTime2Frame)
526 .addStaticFunction ("frame2RealTime", &Vamp::RealTime::frame2RealTime)
529 .beginClass<Vamp::PluginBase> ("PluginBase")
530 .addFunction ("getIdentifier", &Vamp::PluginBase::getIdentifier)
531 .addFunction ("getName", &Vamp::PluginBase::getName)
532 .addFunction ("getDescription", &Vamp::PluginBase::getDescription)
533 .addFunction ("getMaker", &Vamp::PluginBase::getMaker)
534 .addFunction ("getCopyright", &Vamp::PluginBase::getCopyright)
535 .addFunction ("getPluginVersion", &Vamp::PluginBase::getPluginVersion)
536 .addFunction ("getParameterDescriptors", &Vamp::PluginBase::getParameterDescriptors)
537 .addFunction ("getParameter", &Vamp::PluginBase::getParameter)
538 .addFunction ("setParameter", &Vamp::PluginBase::setParameter)
539 .addFunction ("getPrograms", &Vamp::PluginBase::getPrograms)
540 .addFunction ("getCurrentProgram", &Vamp::PluginBase::getCurrentProgram)
541 .addFunction ("selectProgram", &Vamp::PluginBase::selectProgram)
542 .addFunction ("getType", &Vamp::PluginBase::getType)
545 .beginNamespace ("PluginBase")
546 .beginClass<Vamp::PluginBase::ParameterDescriptor> ("ParameterDescriptor")
547 .addData ("identifier", &Vamp::PluginBase::ParameterDescriptor::identifier)
548 .addData ("name", &Vamp::PluginBase::ParameterDescriptor::name)
549 .addData ("description", &Vamp::PluginBase::ParameterDescriptor::description)
550 .addData ("unit", &Vamp::PluginBase::ParameterDescriptor::unit)
551 .addData ("minValue", &Vamp::PluginBase::ParameterDescriptor::minValue)
552 .addData ("maxValue", &Vamp::PluginBase::ParameterDescriptor::maxValue)
553 .addData ("defaultValue", &Vamp::PluginBase::ParameterDescriptor::defaultValue)
554 .addData ("isQuantized", &Vamp::PluginBase::ParameterDescriptor::isQuantized)
555 .addData ("quantizeStep", &Vamp::PluginBase::ParameterDescriptor::quantizeStep)
556 .addData ("valueNames", &Vamp::PluginBase::ParameterDescriptor::valueNames)
559 .beginStdVector <Vamp::PluginBase::ParameterDescriptor> ("ParameterList")
561 .endNamespace () // Vamp::PluginBase
563 .deriveClass<Vamp::Plugin, Vamp::PluginBase> ("Plugin")
564 //.addFunction ("process", &Vamp::Plugin::process) // unusable due to float*const* -> LuaAPI::Vamp::process
565 .addFunction ("initialise", &Vamp::Plugin::initialise)
566 .addFunction ("reset", &Vamp::Plugin::reset)
567 .addFunction ("getInputDomain", &Vamp::Plugin::getInputDomain)
568 .addFunction ("getPreferredBlockSize", &Vamp::Plugin::getPreferredBlockSize)
569 .addFunction ("getPreferredStepSize", &Vamp::Plugin::getPreferredStepSize)
570 .addFunction ("getMinChannelCount", &Vamp::Plugin::getMinChannelCount)
571 .addFunction ("getMaxChannelCount", &Vamp::Plugin::getMaxChannelCount)
572 .addFunction ("getOutputDescriptors", &Vamp::Plugin::getOutputDescriptors)
573 .addFunction ("getRemainingFeatures", &Vamp::Plugin::getRemainingFeatures)
574 .addFunction ("getType", &Vamp::Plugin::getType)
577 .beginNamespace ("Plugin")
578 .beginClass<Vamp::Plugin::OutputDescriptor> ("OutputDescriptor")
579 .addData ("identifier", &Vamp::Plugin::OutputDescriptor::identifier)
580 .addData ("description", &Vamp::Plugin::OutputDescriptor::description)
581 .addData ("unit", &Vamp::Plugin::OutputDescriptor::unit)
582 .addData ("hasFixedBinCount", &Vamp::Plugin::OutputDescriptor::hasFixedBinCount)
583 .addData ("binCount", &Vamp::Plugin::OutputDescriptor::binCount)
584 .addData ("binNames", &Vamp::Plugin::OutputDescriptor::binNames)
585 .addData ("hasKnownExtents", &Vamp::Plugin::OutputDescriptor::hasKnownExtents)
586 .addData ("minValue", &Vamp::Plugin::OutputDescriptor::minValue)
587 .addData ("maxValue", &Vamp::Plugin::OutputDescriptor::maxValue)
588 .addData ("isQuantized", &Vamp::Plugin::OutputDescriptor::isQuantized)
589 .addData ("quantizeStep", &Vamp::Plugin::OutputDescriptor::quantizeStep)
590 .addData ("sampleType", &Vamp::Plugin::OutputDescriptor::sampleType)
591 .addData ("sampleRate", &Vamp::Plugin::OutputDescriptor::sampleRate)
592 .addData ("hasDuration", &Vamp::Plugin::OutputDescriptor::hasDuration)
595 /* Vamp::Plugin enums */
596 .beginNamespace ("InputDomain")
597 .addConst ("TimeDomain", Vamp::Plugin::InputDomain(Vamp::Plugin::TimeDomain))
598 .addConst ("FrequencyDomain", Vamp::Plugin::InputDomain(Vamp::Plugin::FrequencyDomain))
601 /* Vamp::Plugin::OutputDescriptor enum */
602 .beginNamespace ("OutputDescriptor")
603 .beginNamespace ("SampleType")
604 .addConst ("OneSamplePerStep", Vamp::Plugin::OutputDescriptor::SampleType(Vamp::Plugin::OutputDescriptor::OneSamplePerStep))
605 .addConst ("FixedSampleRate", Vamp::Plugin::OutputDescriptor::SampleType(Vamp::Plugin::OutputDescriptor::FixedSampleRate))
606 .addConst ("VariableSampleRate", Vamp::Plugin::OutputDescriptor::SampleType(Vamp::Plugin::OutputDescriptor::VariableSampleRate))
608 .endNamespace () /* Vamp::Plugin::OutputDescriptor */
610 .beginClass<Vamp::Plugin::Feature> ("Feature")
611 .addData ("hasTimestamp", &Vamp::Plugin::Feature::hasTimestamp, false)
612 .addData ("timestamp", &Vamp::Plugin::Feature::timestamp, false)
613 .addData ("hasDuration", &Vamp::Plugin::Feature::hasDuration, false)
614 .addData ("duration", &Vamp::Plugin::Feature::duration, false)
615 .addData ("values", &Vamp::Plugin::Feature::values, false)
616 .addData ("label", &Vamp::Plugin::Feature::label, false)
619 .beginStdVector <Vamp::Plugin::OutputDescriptor> ("OutputList")
622 .beginStdVector <Vamp::Plugin::Feature> ("FeatureList")
625 .beginStdMap <int, Vamp::Plugin::FeatureList> ("FeatureSet")
628 .endNamespace () // Vamp::Plugin
629 .endNamespace () // Vamp
631 .beginNamespace ("ARDOUR")
633 .beginClass <InterThreadInfo> ("InterThreadInfo")
634 .addVoidConstructor ()
635 .addData ("done", const_cast<bool InterThreadInfo::*>(&InterThreadInfo::done))
636 #if 0 // currently unused, lua is single-threaded, no custom UIs.
637 .addData ("cancel", (bool InterThreadInfo::*)&InterThreadInfo::cancel)
639 .addData ("progress", const_cast<float InterThreadInfo::*>(&InterThreadInfo::progress))
642 .beginClass <AudioRange> ("AudioRange")
643 .addConstructor <void (*) (framepos_t, framepos_t, uint32_t)> ()
644 .addFunction ("length", &AudioRange::length)
645 .addFunction ("equal", &AudioRange::equal)
646 .addData ("start", &AudioRange::start)
647 .addData ("_end", &AudioRange::end) // XXX "end" is a lua reserved word
648 .addData ("id", &AudioRange::id)
651 .beginWSPtrClass <PluginInfo> ("PluginInfo")
652 .addVoidConstructor ()
653 .addData ("name", &PluginInfo::name, false)
654 .addData ("category", &PluginInfo::category, false)
655 .addData ("creator", &PluginInfo::creator, false)
656 .addData ("path", &PluginInfo::path, false)
657 .addData ("n_inputs", &PluginInfo::n_inputs, false)
658 .addData ("n_outputs", &PluginInfo::n_outputs, false)
659 .addData ("type", &PluginInfo::type, false)
660 .addData ("unique_id", &PluginInfo::unique_id, false)
661 .addFunction ("is_instrument", &PluginInfo::is_instrument)
662 .addFunction ("get_presets", &PluginInfo::get_presets)
665 .beginNamespace ("Route")
666 .beginClass <Route::ProcessorStreams> ("ProcessorStreams")
667 .addVoidConstructor ()
671 .beginClass <ChanMapping> ("ChanMapping")
672 .addVoidConstructor ()
673 .addFunction ("get", static_cast<uint32_t(ChanMapping::*)(DataType, uint32_t) const>(&ChanMapping::get))
674 .addFunction ("set", &ChanMapping::set)
675 .addFunction ("count", &ChanMapping::count)
676 .addFunction ("n_total", &ChanMapping::n_total)
677 .addFunction ("is_monotonic", &ChanMapping::is_monotonic)
678 .addConst ("Invalid", 4294967295U) // UINT32_MAX
681 .beginNamespace ("Properties")
682 // templated class definitions
683 .beginClass <PBD::PropertyDescriptor<bool> > ("BoolProperty").endClass ()
684 .beginClass <PBD::PropertyDescriptor<float> > ("FloatProperty").endClass ()
685 .beginClass <PBD::PropertyDescriptor<framepos_t> > ("FrameposProperty").endClass ()
686 // actual references (TODO: also expose GQuark for std::set)
688 .addConst ("Start", &ARDOUR::Properties::start)
689 .addConst ("Length", &ARDOUR::Properties::length)
690 .addConst ("Position", &ARDOUR::Properties::position)
693 .beginClass <PBD::PropertyChange> ("PropertyChange")
694 // TODO add special handling (std::set<PropertyID>), PropertyID is a GQuark.
695 // -> direct map to lua table beginStdSet()A
697 // expand templated PropertyDescriptor<T>
698 .addFunction ("containsBool", &PBD::PropertyChange::contains<bool>)
699 .addFunction ("containsFloat", &PBD::PropertyChange::contains<float>)
700 .addFunction ("containsFramePos", &PBD::PropertyChange::contains<framepos_t>)
703 .beginClass <PBD::PropertyList> ("PropertyList")
704 // is-a std::map<PropertyID, PropertyBase*>
707 .deriveClass <PBD::OwnedPropertyList, PBD::PropertyList> ("OwnedPropertyList")
710 .beginWSPtrClass <AutomationList> ("AutomationList")
711 .addCast<PBD::Stateful> ("to_stateful")
712 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
713 .addCast<Evoral::ControlList> ("list")
714 .addFunction ("get_state", &AutomationList::get_state)
715 .addFunction ("memento_command", &AutomationList::memento_command)
716 .addFunction ("touching", &AutomationList::touching)
717 .addFunction ("writing", &AutomationList::writing)
718 .addFunction ("touch_enabled", &AutomationList::touch_enabled)
721 .deriveClass <Location, PBD::StatefulDestructible> ("Location")
722 .addFunction ("name", &Location::name)
723 .addFunction ("locked", &Location::locked)
724 .addFunction ("lock", &Location::lock)
725 .addFunction ("unlock", &Location::unlock)
726 .addFunction ("start", &Location::start)
727 .addFunction ("_end", &Location::end) // XXX "end" is a lua reserved word
728 .addFunction ("length", &Location::length)
729 .addFunction ("set_start", &Location::set_start)
730 .addFunction ("set_end", &Location::set_end)
731 .addFunction ("set_length", &Location::set)
732 .addFunction ("move_to", &Location::move_to)
733 .addFunction ("matches", &Location::matches)
734 .addFunction ("flags", &Location::flags)
735 .addFunction ("is_auto_punch", &Location::is_auto_punch)
736 .addFunction ("is_auto_loop", &Location::is_auto_loop)
737 .addFunction ("is_mark", &Location::is_mark)
738 .addFunction ("is_hidden", &Location::is_hidden)
739 .addFunction ("is_cd_marker", &Location::is_cd_marker)
740 .addFunction ("is_session_range", &Location::is_session_range)
741 .addFunction ("is_range_marker", &Location::is_range_marker)
744 .deriveClass <Locations, PBD::StatefulDestructible> ("Locations")
745 .addFunction ("list", static_cast<Locations::LocationList (Locations::*)()>(&Locations::list))
746 .addFunction ("auto_loop_location", &Locations::auto_loop_location)
747 .addFunction ("auto_punch_location", &Locations::auto_punch_location)
748 .addFunction ("session_range_location", &Locations::session_range_location)
749 .addFunction ("first_mark_after", &Locations::first_mark_after)
750 .addFunction ("first_mark_before", &Locations::first_mark_before)
751 .addFunction ("first_mark_at", &Locations::mark_at)
752 .addFunction ("remove", &Locations::remove)
753 .addRefFunction ("marks_either_side", &Locations::marks_either_side)
754 .addRefFunction ("find_all_between", &Locations::find_all_between)
757 .beginWSPtrClass <SessionObject> ("SessionObject")
758 /* SessionObject is-a PBD::StatefulDestructible,
759 * but multiple inheritance is not covered by luabridge,
760 * we need explicit casts */
761 .addCast<PBD::Stateful> ("to_stateful")
762 .addCast<PBD::StatefulDestructible> ("to_statefuldestructible")
763 .addFunction ("name", &SessionObject::name)
766 .beginWSPtrClass <Port> ("Port")
767 .addCast<MidiPort> ("to_midiport")
768 .addCast<AudioPort> ("to_audioport")
769 .addFunction ("name", &Port::name)
770 .addFunction ("pretty_name", &Port::pretty_name)
771 .addFunction ("receives_input", &Port::receives_input)
772 .addFunction ("sends_output", &Port::sends_output)
773 .addFunction ("connected", &Port::connected)
774 .addFunction ("disconnect_all", &Port::disconnect_all)
775 .addFunction ("connected_to", (bool (Port::*)(std::string const &)const)&Port::connected_to)
776 .addFunction ("connect", (int (Port::*)(std::string const &))&Port::connect)
777 .addFunction ("disconnect", (int (Port::*)(std::string const &))&Port::disconnect)
778 //.addStaticFunction ("port_offset", &Port::port_offset) // static
781 .deriveWSPtrClass <AudioPort, Port> ("AudioPort")
784 .deriveWSPtrClass <MidiPort, Port> ("MidiPort")
785 .addFunction ("input_active", &MidiPort::input_active)
786 .addFunction ("set_input_active", &MidiPort::set_input_active)
787 .addFunction ("get_midi_buffer", &MidiPort::get_midi_buffer) // DSP only
790 .beginWSPtrClass <PortSet> ("PortSet")
791 .addFunction ("num_ports", (size_t (PortSet::*)(DataType)const)&PortSet::num_ports)
792 .addFunction ("add", &PortSet::add)
793 .addFunction ("remove", &PortSet::remove)
794 .addFunction ("port", (boost::shared_ptr<Port> (PortSet::*)(DataType, size_t)const)&PortSet::port)
795 .addFunction ("contains", &PortSet::contains)
796 .addFunction ("clear", &PortSet::clear)
797 .addFunction ("empty", &PortSet::empty)
800 .deriveWSPtrClass <IO, SessionObject> ("IO")
801 .addFunction ("active", &IO::active)
802 .addFunction ("add_port", &IO::add_port)
803 .addFunction ("remove_port", &IO::remove_port)
804 .addFunction ("connect", &IO::connect)
805 .addFunction ("disconnect", (int (IO::*)(boost::shared_ptr<Port>, std::string, void *))&IO::disconnect)
806 .addFunction ("disconnect_all", (int (IO::*)(void *))&IO::disconnect)
807 .addFunction ("physically_connected", &IO::physically_connected)
808 .addFunction ("has_port", &IO::has_port)
809 .addFunction ("nth", &IO::nth)
810 .addFunction ("audio", &IO::audio)
811 .addFunction ("midi", &IO::midi)
812 .addFunction ("port_by_name", &IO::nth)
813 .addFunction ("n_ports", &IO::n_ports)
816 .deriveWSPtrClass <PannerShell, SessionObject> ("PannerShell")
817 .addFunction ("bypassed", &PannerShell::bypassed)
818 .addFunction ("set_bypassed", &PannerShell::set_bypassed)
821 .beginClass <RouteGroup> ("RouteGroup")
822 // stub RouteGroup* is needed for new_audio_track()
825 .deriveClass <PresentationInfo, PBD::Stateful> ("PresentationInfo")
826 .addFunction ("color", &PresentationInfo::color)
827 .addFunction ("set_color", &PresentationInfo::set_color)
828 .addFunction ("order", &PresentationInfo::order)
829 .addConst ("max_order", ARDOUR::PresentationInfo::max_order)
832 .deriveWSPtrClass <Stripable, SessionObject> ("Stripable")
833 .addCast<Route> ("to_route")
834 .addFunction ("is_auditioner", &Stripable::is_auditioner)
835 .addFunction ("is_master", &Stripable::is_master)
836 .addFunction ("is_monitor", &Stripable::is_monitor)
837 .addFunction ("is_hidden", &Stripable::is_hidden)
838 .addFunction ("is_selected", &Stripable::is_selected)
839 .addFunction ("gain_control", &Stripable::gain_control)
840 .addFunction ("solo_control", &Stripable::solo_control)
841 .addFunction ("solo_isolate_control", &Stripable::solo_isolate_control)
842 .addFunction ("solo_safe_control", &Stripable::solo_safe_control)
843 .addFunction ("mute_control", &Stripable::mute_control)
844 .addFunction ("phase_control", &Stripable::phase_control)
845 .addFunction ("trim_control", &Stripable::trim_control)
846 .addFunction ("rec_enable_control", &Stripable::rec_enable_control)
847 .addFunction ("rec_safe_control", &Stripable::rec_safe_control)
848 .addFunction ("pan_azimuth_control", &Stripable::pan_azimuth_control)
849 .addFunction ("pan_elevation_control", &Stripable::pan_elevation_control)
850 .addFunction ("pan_width_control", &Stripable::pan_width_control)
851 .addFunction ("pan_frontback_control", &Stripable::pan_frontback_control)
852 .addFunction ("pan_lfe_control", &Stripable::pan_lfe_control)
853 .addFunction ("send_level_control", &Stripable::send_level_controllable)
854 .addFunction ("send_enable_control", &Stripable::send_level_controllable)
855 .addFunction ("send_name", &Stripable::send_name)
856 .addFunction ("monitor_control", &Stripable::monitor_control)
857 .addFunction ("master_send_enable_control ", &Stripable::master_send_enable_controllable )
858 .addFunction ("comp_enable_control ", &Stripable::comp_enable_controllable )
859 .addFunction ("comp_threshold_control ", &Stripable::comp_threshold_controllable )
860 .addFunction ("comp_speed_control ", &Stripable::comp_speed_controllable )
861 .addFunction ("comp_mode_control ", &Stripable::comp_mode_controllable )
862 .addFunction ("comp_makeup_control ", &Stripable::comp_makeup_controllable )
863 .addFunction ("comp_redux_control ", &Stripable::comp_redux_controllable )
864 .addFunction ("comp_mode_name", &Stripable::comp_mode_name)
865 .addFunction ("comp_speed_name", &Stripable::comp_speed_name)
866 .addFunction ("eq_band_cnt ", &Stripable::eq_band_cnt)
867 .addFunction ("eq_band_name", &Stripable::eq_band_name)
868 .addFunction ("eq_gain_control", &Stripable::eq_gain_controllable)
869 .addFunction ("eq_freq_control ", &Stripable::eq_freq_controllable )
870 .addFunction ("eq_q_control ", &Stripable::eq_q_controllable )
871 .addFunction ("eq_shape_control ", &Stripable::eq_shape_controllable )
872 .addFunction ("eq_enable_control ", &Stripable::eq_enable_controllable )
873 .addFunction ("eq_hpf_control ", &Stripable::eq_hpf_controllable )
874 .addFunction ("set_presentation_order", &Stripable::set_presentation_order)
875 .addFunction ("presentation_info_ptr", &Stripable::presentation_info_ptr)
879 .deriveWSPtrClass <Route, Stripable> ("Route")
880 .addCast<Track> ("to_track")
881 .addFunction ("set_name", &Route::set_name)
882 .addFunction ("comment", &Route::comment)
883 .addFunction ("active", &Route::active)
884 .addFunction ("set_active", &Route::set_active)
885 .addFunction ("nth_plugin", &Route::nth_plugin)
886 .addFunction ("nth_processor", &Route::nth_processor)
887 .addFunction ("nth_send", &Route::nth_send)
888 .addFunction ("add_processor_by_index", &Route::add_processor_by_index)
889 .addFunction ("remove_processor", &Route::remove_processor)
890 .addFunction ("replace_processor", &Route::replace_processor)
891 .addFunction ("the_instrument", &Route::the_instrument)
892 .addFunction ("n_inputs", &Route::n_inputs)
893 .addFunction ("n_outputs", &Route::n_outputs)
894 .addFunction ("input", &Route::input)
895 .addFunction ("output", &Route::output)
896 .addFunction ("panner_shell", &Route::panner_shell)
897 .addFunction ("set_comment", &Route::set_comment)
898 .addFunction ("strict_io", &Route::strict_io)
899 .addFunction ("set_strict_io", &Route::set_strict_io)
900 .addFunction ("reset_plugin_insert", &Route::reset_plugin_insert)
901 .addFunction ("customize_plugin_insert", &Route::customize_plugin_insert)
902 .addFunction ("add_sidechain", &Route::add_sidechain)
903 .addFunction ("remove_sidechain", &Route::remove_sidechain)
904 .addFunction ("main_outs", &Route::main_outs)
905 .addFunction ("muted", &Route::muted)
906 .addFunction ("soloed", &Route::soloed)
907 .addFunction ("amp", &Route::amp)
908 .addFunction ("trim", &Route::trim)
909 .addFunction ("peak_meter", (boost::shared_ptr<PeakMeter> (Route::*)())&Route::peak_meter)
910 .addFunction ("set_meter_point", &Route::set_meter_point)
913 .deriveWSPtrClass <Playlist, SessionObject> ("Playlist")
914 .addCast<AudioPlaylist> ("to_audioplaylist")
915 .addCast<MidiPlaylist> ("to_midiplaylist")
916 .addFunction ("region_by_id", &Playlist::region_by_id)
917 .addFunction ("data_type", &Playlist::data_type)
918 .addFunction ("n_regions", &Playlist::n_regions)
919 //.addFunction ("get_extent", &Playlist::get_extent) // pair<framepos_t, framepos_t>
920 .addFunction ("region_list", &Playlist::region_list)
921 .addFunction ("add_region", &Playlist::add_region)
922 .addFunction ("remove_region", &Playlist::remove_region)
923 .addFunction ("regions_at", &Playlist::regions_at)
924 .addFunction ("top_region_at", &Playlist::top_region_at)
925 .addFunction ("top_unmuted_region_at", &Playlist::top_unmuted_region_at)
926 .addFunction ("find_next_region", &Playlist::find_next_region)
927 .addFunction ("find_next_region_boundary", &Playlist::find_next_region_boundary)
928 .addFunction ("count_regions_at", &Playlist::count_regions_at)
929 .addFunction ("regions_touched", &Playlist::regions_touched)
930 .addFunction ("regions_with_start_within", &Playlist::regions_with_start_within)
931 .addFunction ("regions_with_end_within", &Playlist::regions_with_end_within)
932 .addFunction ("raise_region", &Playlist::raise_region)
933 .addFunction ("lower_region", &Playlist::lower_region)
934 .addFunction ("raise_region_to_top", &Playlist::raise_region_to_top)
935 .addFunction ("lower_region_to_bottom", &Playlist::lower_region_to_bottom)
936 .addFunction ("duplicate", (void (Playlist::*)(boost::shared_ptr<Region>, framepos_t, framecnt_t, float))&Playlist::duplicate)
937 .addFunction ("duplicate_until", &Playlist::duplicate_until)
938 .addFunction ("duplicate_range", &Playlist::duplicate_range)
939 .addFunction ("combine", &Playlist::combine)
940 .addFunction ("uncombine", &Playlist::uncombine)
941 .addFunction ("split_region", &Playlist::split_region)
942 .addFunction ("split", (void (Playlist::*)(framepos_t))&Playlist::split)
943 .addFunction ("cut", (boost::shared_ptr<Playlist> (Playlist::*)(std::list<AudioRange>&, bool))&Playlist::cut)
945 .addFunction ("copy", &Playlist::copy)
946 .addFunction ("paste", &Playlist::paste)
950 .deriveWSPtrClass <AudioPlaylist, Playlist> ("AudioPlaylist")
951 .addFunction ("read", &AudioPlaylist::read)
954 .deriveWSPtrClass <MidiPlaylist, Playlist> ("MidiPlaylist")
955 .addFunction ("set_note_mode", &MidiPlaylist::set_note_mode)
958 .deriveWSPtrClass <Track, Route> ("Track")
959 .addCast<AudioTrack> ("to_audio_track")
960 .addCast<MidiTrack> ("to_midi_track")
961 .addFunction ("set_name", &Track::set_name)
962 .addFunction ("can_record", &Track::can_record)
963 .addFunction ("bounceable", &Track::bounceable)
964 .addFunction ("bounce", &Track::bounce)
965 .addFunction ("bounce_range", &Track::bounce_range)
966 .addFunction ("playlist", &Track::playlist)
969 .deriveWSPtrClass <AudioTrack, Track> ("AudioTrack")
972 .deriveWSPtrClass <MidiTrack, Track> ("MidiTrack")
975 .beginWSPtrClass <Readable> ("Readable")
976 .addFunction ("read", &Readable::read)
977 .addFunction ("readable_length", &Readable::readable_length)
978 .addFunction ("n_channels", &Readable::n_channels)
981 .deriveWSPtrClass <Region, SessionObject> ("Region")
982 .addCast<Readable> ("to_readable")
983 .addCast<MidiRegion> ("to_midiregion")
985 .addFunction ("position", &Region::position)
986 .addFunction ("start", &Region::start)
987 .addFunction ("length", &Region::length)
988 .addFunction ("layer", &Region::layer)
989 .addFunction ("data_type", &Region::data_type)
990 .addFunction ("stretch", &Region::stretch)
991 .addFunction ("shift", &Region::shift)
992 .addRefFunction ("sync_offset", &Region::sync_offset)
993 .addFunction ("sync_position", &Region::sync_position)
994 .addFunction ("hidden", &Region::hidden)
995 .addFunction ("muted", &Region::muted)
996 .addFunction ("opaque", &Region::opaque)
997 .addFunction ("locked", &Region::locked)
998 .addFunction ("position_locked", &Region::position_locked)
999 .addFunction ("video_locked", &Region::video_locked)
1000 .addFunction ("automatic", &Region::automatic)
1001 .addFunction ("whole_file", &Region::whole_file)
1002 .addFunction ("captured", &Region::captured)
1003 .addFunction ("can_move", &Region::can_move)
1004 .addFunction ("sync_marked", &Region::sync_marked)
1005 .addFunction ("external", &Region::external)
1006 .addFunction ("import", &Region::import)
1007 .addFunction ("covers", &Region::covers)
1008 .addFunction ("at_natural_position", &Region::at_natural_position)
1009 .addFunction ("is_compound", &Region::is_compound)
1010 /* editing operations */
1011 .addFunction ("set_length", &Region::set_length)
1012 .addFunction ("set_start", &Region::set_start)
1013 .addFunction ("set_position", &Region::set_position)
1014 .addFunction ("set_initial_position", &Region::set_initial_position)
1015 .addFunction ("nudge_position", &Region::nudge_position)
1016 .addFunction ("move_to_natural_position", &Region::move_to_natural_position)
1017 .addFunction ("move_start", &Region::move_start)
1018 .addFunction ("master_sources", &Region::master_sources)
1019 .addFunction ("master_source_names", &Region::master_source_names)
1020 .addFunction ("n_channels", &Region::n_channels)
1021 .addFunction ("trim_front", &Region::trim_front)
1022 .addFunction ("trim_end", &Region::trim_end)
1023 .addFunction ("trim_to", &Region::trim_to)
1024 .addFunction ("cut_front", &Region::cut_front)
1025 .addFunction ("cut_end", &Region::cut_end)
1026 .addFunction ("raise", &Region::raise)
1027 .addFunction ("lower", &Region::lower)
1028 .addFunction ("raise_to_top", &Region::raise_to_top)
1029 .addFunction ("lower_to_bottom", &Region::lower_to_bottom)
1030 .addFunction ("set_sync_position", &Region::set_sync_position)
1031 .addFunction ("clear_sync_position", &Region::clear_sync_position)
1032 .addFunction ("pos_beats", &Region::pos_beats)
1033 .addFunction ("set_hidden", &Region::set_hidden)
1034 .addFunction ("set_muted", &Region::set_muted)
1035 .addFunction ("set_opaque", &Region::set_opaque)
1036 .addFunction ("set_locked", &Region::set_locked)
1037 .addFunction ("set_video_locked", &Region::set_video_locked)
1038 .addFunction ("set_position_locked", &Region::set_position_locked)
1039 .addFunction ("source", &Region::source)
1042 .deriveWSPtrClass <MidiRegion, Region> ("MidiRegion")
1043 .addFunction ("do_export", &MidiRegion::do_export)
1044 .addFunction ("midi_source", &MidiRegion::midi_source)
1045 .addFunction ("model", (boost::shared_ptr<MidiModel> (MidiRegion::*)())&MidiRegion::midi_source)
1046 .addFunction ("start_beats", &MidiRegion::start_beats)
1047 .addFunction ("length_beats", &MidiRegion::length_beats)
1050 .deriveWSPtrClass <Source, SessionObject> ("Source")
1051 .addCast<AudioSource> ("to_audiosource")
1052 .addCast<MidiSource> ("to_midisource")
1053 .addFunction ("timestamp", &Source::timestamp)
1054 .addFunction ("empty", &Source::empty)
1055 .addFunction ("length", &Source::length)
1056 .addFunction ("natural_position", &Source::natural_position)
1057 .addFunction ("destructive", &Source::destructive)
1058 .addFunction ("writable", &Source::writable)
1059 .addFunction ("has_been_analysed", &Source::has_been_analysed)
1060 .addFunction ("can_be_analysed", &Source::can_be_analysed)
1061 .addFunction ("timeline_position", &Source::timeline_position)
1062 .addFunction ("use_count", &Source::use_count)
1063 .addFunction ("used", &Source::used)
1064 .addFunction ("ancestor_name", &Source::ancestor_name)
1067 .deriveWSPtrClass <MidiSource, Source> ("MidiSource")
1068 .addFunction ("empty", &MidiSource::empty)
1069 .addFunction ("length", &MidiSource::length)
1070 .addFunction ("model", &MidiSource::model)
1073 .deriveWSPtrClass <AudioSource, Source> ("AudioSource")
1074 .addCast<Readable> ("to_readable")
1075 .addFunction ("readable_length", &AudioSource::readable_length)
1076 .addFunction ("n_channels", &AudioSource::n_channels)
1077 .addFunction ("empty", &Source::empty)
1078 .addFunction ("length", &Source::length)
1079 .addFunction ("read", &AudioSource::read)
1080 .addFunction ("sample_rate", &AudioSource::sample_rate)
1081 .addFunction ("captured_for", &AudioSource::captured_for)
1084 .deriveWSPtrClass <Automatable, Evoral::ControlSet> ("Automatable")
1085 .addFunction ("automation_control", (boost::shared_ptr<AutomationControl>(Automatable::*)(const Evoral::Parameter&, bool))&Automatable::automation_control)
1088 .deriveWSPtrClass <AutomatableSequence<Evoral::Beats>, Automatable> ("AutomatableSequence")
1089 .addCast<Evoral::Sequence<Evoral::Beats> > ("to_sequence")
1092 .deriveWSPtrClass <MidiModel, AutomatableSequence<Evoral::Beats> > ("MidiModel")
1093 .addFunction ("apply_command", (void (MidiModel::*)(Session*, Command*))&MidiModel::apply_command)
1094 .addFunction ("new_note_diff_command", &MidiModel::new_note_diff_command)
1097 .beginNamespace ("MidiModel")
1098 .deriveClass<ARDOUR::MidiModel::DiffCommand, Command> ("DiffCommand")
1101 .deriveClass<ARDOUR::MidiModel::NoteDiffCommand, ARDOUR::MidiModel::DiffCommand> ("NoteDiffCommand")
1102 .addFunction ("add", &ARDOUR::MidiModel::NoteDiffCommand::add)
1103 .addFunction ("remove", &ARDOUR::MidiModel::NoteDiffCommand::remove)
1106 .endNamespace () /* ARDOUR::MidiModel */
1108 .beginClass <Plugin::PresetRecord> ("PresetRecord")
1109 .addVoidConstructor ()
1110 .addData ("uri", &Plugin::PresetRecord::uri, false)
1111 .addData ("label", &Plugin::PresetRecord::label, false)
1112 .addData ("user", &Plugin::PresetRecord::user, false)
1113 .addData ("valid", &Plugin::PresetRecord::valid, false)
1116 .beginStdVector <Plugin::PresetRecord> ("PresetVector").endClass ()
1118 .deriveClass <ParameterDescriptor, Evoral::ParameterDescriptor> ("ParameterDescriptor")
1119 .addVoidConstructor ()
1120 .addData ("label", &ParameterDescriptor::label)
1121 .addData ("logarithmic", &ParameterDescriptor::logarithmic)
1122 .addStaticFunction ("midi_note_name", &ParameterDescriptor::midi_note_name)
1125 .beginStdVector <boost::shared_ptr<ARDOUR::Processor> > ("ProcessorVector").endClass ()
1127 .deriveWSPtrClass <Processor, SessionObject> ("Processor")
1128 .addCast<Automatable> ("to_automatable")
1129 .addCast<PluginInsert> ("to_insert")
1130 .addCast<SideChain> ("to_sidechain")
1131 .addCast<IOProcessor> ("to_ioprocessor")
1132 .addCast<UnknownProcessor> ("to_unknownprocessor")
1133 .addCast<Amp> ("to_amp")
1134 .addCast<PeakMeter> ("to_peakmeter")
1135 .addCast<MonitorProcessor> ("to_monitorprocessor")
1136 #if 0 // those objects are not yet bound
1137 .addCast<CapturingProcessor> ("to_capturingprocessor")
1138 .addCast<DelayLine> ("to_delayline")
1140 .addCast<PeakMeter> ("to_meter")
1141 .addFunction ("display_name", &Processor::display_name)
1142 .addFunction ("active", &Processor::active)
1143 .addFunction ("activate", &Processor::activate)
1144 .addFunction ("deactivate", &Processor::deactivate)
1145 .addFunction ("output_streams", &PluginInsert::output_streams)
1146 .addFunction ("input_streams", &PluginInsert::input_streams)
1149 .deriveWSPtrClass <IOProcessor, Processor> ("IOProcessor")
1150 .addFunction ("natural_input_streams", &IOProcessor::natural_input_streams)
1151 .addFunction ("natural_output_streams", &IOProcessor::natural_output_streams)
1152 .addFunction ("input", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::input)
1153 .addFunction ("output", (boost::shared_ptr<IO>(IOProcessor::*)())&IOProcessor::output)
1156 .deriveWSPtrClass <SideChain, IOProcessor> ("SideChain")
1159 .deriveWSPtrClass <Delivery, IOProcessor> ("Delivery")
1160 .addFunction ("panner_shell", &Route::panner_shell)
1163 .beginNamespace ("Plugin")
1164 .beginClass <Plugin::IOPortDescription> ("IOPortDescription")
1165 .addData ("name", &Plugin::IOPortDescription::name)
1166 .addData ("is_sidechain", &Plugin::IOPortDescription::is_sidechain)
1167 .addData ("group_name", &Plugin::IOPortDescription::group_name)
1168 .addData ("group_channel", &Plugin::IOPortDescription::group_channel)
1172 .deriveWSPtrClass <Plugin, PBD::StatefulDestructible> ("Plugin")
1173 .addCast<LuaProc> ("to_luaproc")
1174 .addFunction ("unique_id", &Plugin::unique_id)
1175 .addFunction ("label", &Plugin::label)
1176 .addFunction ("name", &Plugin::name)
1177 .addFunction ("maker", &Plugin::maker)
1178 .addFunction ("parameter_count", &Plugin::parameter_count)
1179 .addRefFunction ("nth_parameter", &Plugin::nth_parameter)
1180 .addFunction ("preset_by_label", &Plugin::preset_by_label)
1181 .addFunction ("preset_by_uri", &Plugin::preset_by_uri)
1182 .addFunction ("load_preset", &Plugin::load_preset)
1183 .addFunction ("parameter_is_input", &Plugin::parameter_is_input)
1184 .addFunction ("get_docs", &Plugin::get_docs)
1185 .addFunction ("get_info", &Plugin::get_info)
1186 .addFunction ("get_parameter_docs", &Plugin::get_parameter_docs)
1187 .addFunction ("describe_io_port", &Plugin::describe_io_port)
1188 .addRefFunction ("get_parameter_descriptor", &Plugin::get_parameter_descriptor)
1191 .deriveWSPtrClass <LuaProc, Plugin> ("LuaProc")
1192 .addFunction ("shmem", &LuaProc::instance_shm)
1193 .addFunction ("table", &LuaProc::instance_ref)
1196 .deriveWSPtrClass <PluginInsert, Processor> ("PluginInsert")
1197 .addFunction ("plugin", &PluginInsert::plugin)
1198 .addFunction ("activate", &PluginInsert::activate)
1199 .addFunction ("deactivate", &PluginInsert::deactivate)
1200 .addFunction ("strict_io_configured", &PluginInsert::strict_io_configured)
1201 .addFunction ("input_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::input_map)
1202 .addFunction ("output_map", (ARDOUR::ChanMapping (PluginInsert::*)(uint32_t) const)&PluginInsert::output_map)
1203 .addFunction ("set_input_map", &PluginInsert::set_input_map)
1204 .addFunction ("set_output_map", &PluginInsert::set_output_map)
1205 .addFunction ("natural_output_streams", &PluginInsert::natural_output_streams)
1206 .addFunction ("natural_input_streams", &PluginInsert::natural_input_streams)
1209 .deriveWSPtrClass <AutomationControl, PBD::Controllable> ("AutomationControl")
1210 .addCast<Evoral::Control> ("to_ctrl")
1211 .addFunction ("automation_state", &AutomationControl::automation_state)
1212 .addFunction ("automation_style", &AutomationControl::automation_style)
1213 .addFunction ("set_automation_state", &AutomationControl::set_automation_state)
1214 .addFunction ("set_automation_style", &AutomationControl::set_automation_style)
1215 .addFunction ("start_touch", &AutomationControl::start_touch)
1216 .addFunction ("stop_touch", &AutomationControl::stop_touch)
1217 .addFunction ("get_value", &AutomationControl::get_value)
1218 .addFunction ("set_value", &AutomationControl::set_value)
1219 .addFunction ("writable", &AutomationControl::writable)
1220 .addFunction ("alist", &AutomationControl::alist)
1223 .deriveWSPtrClass <SlavableAutomationControl, AutomationControl> ("SlavableAutomationControl,")
1224 .addFunction ("add_master", &SlavableAutomationControl::add_master)
1225 .addFunction ("remove_master", &SlavableAutomationControl::remove_master)
1226 .addFunction ("clear_masters", &SlavableAutomationControl::clear_masters)
1227 .addFunction ("slaved_to", &SlavableAutomationControl::slaved_to)
1228 .addFunction ("slaved", &SlavableAutomationControl::slaved)
1229 .addFunction ("get_masters_value", &SlavableAutomationControl::get_masters_value)
1230 .addFunction ("get_boolean_masters", &SlavableAutomationControl::get_boolean_masters)
1231 //.addFunction ("masters", &SlavableAutomationControl::masters) // not implemented
1234 .deriveWSPtrClass <PhaseControl, AutomationControl> ("PhaseControl")
1235 .addFunction ("set_phase_invert", (void(PhaseControl::*)(uint32_t, bool))&PhaseControl::set_phase_invert)
1236 .addFunction ("inverted", &PhaseControl::inverted)
1239 .deriveWSPtrClass <GainControl, SlavableAutomationControl> ("GainControl")
1242 .deriveWSPtrClass <SoloControl, SlavableAutomationControl> ("SoloControl")
1243 .addFunction ("can_solo", &SoloControl::can_solo)
1244 .addFunction ("soloed", &SoloControl::soloed)
1245 .addFunction ("self_soloed", &SoloControl::self_soloed)
1248 .deriveWSPtrClass <MuteControl, SlavableAutomationControl> ("MuteControl")
1249 .addFunction ("muted", &MuteControl::muted)
1250 .addFunction ("muted_by_self", &MuteControl::muted_by_self)
1253 .deriveWSPtrClass <SoloIsolateControl, SlavableAutomationControl> ("SoloIsolateControl")
1254 .addFunction ("solo_isolated", &SoloIsolateControl::solo_isolated)
1255 .addFunction ("self_solo_isolated", &SoloIsolateControl::self_solo_isolated)
1258 .deriveWSPtrClass <SoloSafeControl, SlavableAutomationControl> ("SoloSafeControl")
1259 .addFunction ("solo_safe", &SoloSafeControl::solo_safe)
1262 .deriveWSPtrClass <Amp, Processor> ("Amp")
1263 .addFunction ("gain_control", (boost::shared_ptr<GainControl>(Amp::*)())&Amp::gain_control)
1266 .deriveWSPtrClass <PeakMeter, Processor> ("PeakMeter")
1267 .addFunction ("meter_level", &PeakMeter::meter_level)
1268 .addFunction ("set_type", &PeakMeter::set_type)
1269 .addFunction ("reset_max", &PeakMeter::reset_max)
1272 .deriveWSPtrClass <MonitorProcessor, Processor> ("MonitorProcessor")
1273 .addFunction ("set_cut_all", &MonitorProcessor::set_cut_all)
1274 .addFunction ("set_dim_all", &MonitorProcessor::set_dim_all)
1275 .addFunction ("set_polarity", &MonitorProcessor::set_polarity)
1276 .addFunction ("set_cut", &MonitorProcessor::set_cut)
1277 .addFunction ("set_dim", &MonitorProcessor::set_dim)
1278 .addFunction ("set_solo", &MonitorProcessor::set_solo)
1279 .addFunction ("set_mono", &MonitorProcessor::set_mono)
1280 .addFunction ("dim_level", &MonitorProcessor::dim_level)
1281 .addFunction ("solo_boost_level", &MonitorProcessor::solo_boost_level)
1282 .addFunction ("dimmed", &MonitorProcessor::dimmed)
1283 .addFunction ("soloed", &MonitorProcessor::soloed)
1284 .addFunction ("inverted", &MonitorProcessor::inverted)
1285 .addFunction ("cut", &MonitorProcessor::cut)
1286 .addFunction ("cut_all", &MonitorProcessor::cut_all)
1287 .addFunction ("dim_all", &MonitorProcessor::dim_all)
1288 .addFunction ("mono", &MonitorProcessor::mono)
1289 .addFunction ("monitor_active", &MonitorProcessor::monitor_active)
1290 .addFunction ("channel_cut_control", &MonitorProcessor::channel_cut_control)
1291 .addFunction ("channel_dim_control", &MonitorProcessor::channel_dim_control)
1292 .addFunction ("channel_polarity_control", &MonitorProcessor::channel_polarity_control)
1293 .addFunction ("channel_solo_control", &MonitorProcessor::channel_solo_control)
1294 .addFunction ("dim_control", &MonitorProcessor::dim_control)
1295 .addFunction ("cut_control", &MonitorProcessor::cut_control)
1296 .addFunction ("mono_control", &MonitorProcessor::mono_control)
1297 .addFunction ("dim_level_control", &MonitorProcessor::dim_level_control)
1298 .addFunction ("solo_boost_control", &MonitorProcessor::solo_boost_control)
1301 .deriveWSPtrClass <UnknownProcessor, Processor> ("UnknownProcessor")
1304 .deriveWSPtrClass <PluginInsert::PluginControl, AutomationControl> ("PluginControl")
1307 .deriveWSPtrClass <AudioSource, Source> ("AudioSource")
1308 .addFunction ("readable_length", &AudioSource::readable_length)
1309 .addFunction ("n_channels", &AudioSource::n_channels)
1312 // <std::list<boost::shared_ptr <AudioTrack> >
1313 .beginStdList <boost::shared_ptr<AudioTrack> > ("AudioTrackList")
1316 // std::list<boost::shared_ptr <MidiTrack> >
1317 .beginStdList <boost::shared_ptr<MidiTrack> > ("MidiTrackList")
1320 // RouteList == std::list<boost::shared_ptr<Route> >
1321 .beginConstStdList <boost::shared_ptr<Route> > ("RouteList")
1324 // boost::shared_ptr<RouteList>
1325 .beginPtrStdList <boost::shared_ptr<Route> > ("RouteListPtr")
1328 // typedef std::list<boost::weak_ptr <Route> > WeakRouteList
1329 .beginConstStdList <boost::weak_ptr<Route> > ("WeakRouteList")
1332 // typedef std::vector<boost::shared_ptr<Source> > Region::SourceList
1333 .beginStdVector <boost::shared_ptr<Source> > ("SourceList")
1336 // std::list< boost::weak_ptr <AudioSource> >
1337 .beginConstStdList <boost::weak_ptr<AudioSource> > ("WeakAudioSourceList")
1340 // typedef std::list<boost::shared_ptr<Region> > RegionList
1341 .beginConstStdList <boost::shared_ptr<Region> > ("RegionList")
1344 // boost::shared_ptr <std::list<boost::shared_ptr<Region> > >
1345 .beginPtrStdList <boost::shared_ptr<Region> > ("RegionListPtr")
1348 //std::list<boost::shared_ptr<Port> > PortList;
1349 .beginConstStdList <boost::shared_ptr<Port> > ("PortList")
1352 // used by Playlist::cut/copy
1353 .beginConstStdList <AudioRange> ("AudioRangeList")
1356 .beginConstStdList <Location*> ("LocationList")
1359 #if 0 // depends on Evoal:: Note, Beats see note_fixer.h
1360 // typedef Evoral::Note<Evoral::Beats> Note;
1361 // std::set< boost::weak_ptr<Note> >
1362 .beginStdSet <boost::weak_ptr<Note> > ("WeakNoteSet")
1366 // std::list<boost::weak_ptr<Source> >
1367 .beginConstStdList <boost::weak_ptr<Source> > ("WeakSourceList")
1370 .beginClass <Tempo> ("Tempo")
1371 .addConstructor <void (*) (double, double)> ()
1372 .addFunction ("note_type", &Tempo::note_type)
1373 .addFunction ("note_types_per_minute", (double (Tempo::*)() const)&Tempo::note_types_per_minute)
1374 .addFunction ("quarter_notes_per_minute", &Tempo::quarter_notes_per_minute)
1375 .addFunction ("frames_per_quarter_note", &Tempo::frames_per_quarter_note)
1376 .addFunction ("frames_per_note_type", &Tempo::frames_per_note_type)
1379 .beginClass <Meter> ("Meter")
1380 .addConstructor <void (*) (double, double)> ()
1381 .addFunction ("divisions_per_bar", &Meter::divisions_per_bar)
1382 .addFunction ("note_divisor", &Meter::note_divisor)
1383 .addFunction ("frames_per_bar", &Meter::frames_per_bar)
1384 .addFunction ("frames_per_grid", &Meter::frames_per_grid)
1387 .beginClass <TempoMap> ("TempoMap")
1388 .addFunction ("add_tempo", &TempoMap::add_tempo)
1389 .addFunction ("add_meter", &TempoMap::add_meter)
1390 .addFunction ("tempo_section_at_frame", &TempoMap::tempo_section_at_frame)
1391 .addFunction ("meter_section_at_frame", &TempoMap::meter_section_at_frame)
1392 .addFunction ("meter_section_at_beat", &TempoMap::meter_section_at_beat)
1393 .addFunction ("bbt_at_frame", &TempoMap::bbt_at_frame)
1394 .addFunction ("exact_beat_at_frame", &TempoMap::exact_beat_at_frame)
1395 .addFunction ("exact_qn_at_frame", &TempoMap::exact_qn_at_frame)
1398 .beginClass <MetricSection> ("MetricSection")
1399 .addFunction ("pulse", &MetricSection::pulse)
1400 .addFunction ("set_pulse", &MetricSection::set_pulse)
1403 .deriveClass <TempoSection, MetricSection> ("TempoSection")
1404 .addFunction ("c_func", (double(TempoSection::*)()const)&TempoSection::c_func)
1407 .deriveClass <MeterSection, MetricSection> ("MeterSection")
1408 .addCast<Meter> ("to_meter")
1409 .addFunction ("set_pulse", &MeterSection::set_pulse)
1410 .addFunction ("set_beat", (void(MeterSection::*)(double))&MeterSection::set_beat)
1413 .beginClass <ChanCount> ("ChanCount")
1414 .addConstructor <void (*) (DataType, uint32_t)> ()
1415 .addFunction ("get", &ChanCount::get)
1416 .addFunction ("set", &ChanCount::set)
1417 .addFunction ("n_audio", &ChanCount::n_audio)
1418 .addFunction ("n_midi", &ChanCount::n_midi)
1419 .addFunction ("n_total", &ChanCount::n_total)
1420 .addFunction ("reset", &ChanCount::reset)
1423 .beginClass <DataType> ("DataType")
1424 .addConstructor <void (*) (std::string)> ()
1425 .addStaticCFunction ("null", &LuaAPI::datatype_ctor_null) // "nil" is a lua reseved word
1426 .addStaticCFunction ("audio", &LuaAPI::datatype_ctor_audio)
1427 .addStaticCFunction ("midi", &LuaAPI::datatype_ctor_midi)
1428 .addFunction ("to_string", &DataType::to_string) // TODO Lua __tostring
1429 // TODO add uint32_t cast, add operator== !=
1432 /* libardour enums */
1433 .beginNamespace ("PluginType")
1434 .addConst ("AudioUnit", ARDOUR::PluginType(AudioUnit))
1435 .addConst ("LADSPA", ARDOUR::PluginType(LADSPA))
1436 .addConst ("LV2", ARDOUR::PluginType(LV2))
1437 .addConst ("Windows_VST", ARDOUR::PluginType(Windows_VST))
1438 .addConst ("LXVST", ARDOUR::PluginType(LXVST))
1439 .addConst ("Lua", ARDOUR::PluginType(Lua))
1442 .beginNamespace ("PresentationInfo")
1443 .beginNamespace ("Flag")
1444 .addConst ("AudioTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioTrack))
1445 .addConst ("MidiTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiTrack))
1446 .addConst ("AudioBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::AudioBus))
1447 .addConst ("MidiBus", ARDOUR::PresentationInfo::Flag(PresentationInfo::MidiBus))
1448 .addConst ("VCA", ARDOUR::PresentationInfo::Flag(PresentationInfo::VCA))
1449 .addConst ("MasterOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MasterOut))
1450 .addConst ("MonitorOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MonitorOut))
1451 .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner))
1452 .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected))
1453 .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden))
1454 .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet))
1455 .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask))
1459 .beginNamespace ("AutoStyle")
1460 .addConst ("Absolute", ARDOUR::AutoStyle(Absolute))
1461 .addConst ("Trim", ARDOUR::AutoStyle(Trim))
1464 .beginNamespace ("AutoState")
1465 .addConst ("Off", ARDOUR::AutoState(Off))
1466 .addConst ("Write", ARDOUR::AutoState(Write))
1467 .addConst ("Touch", ARDOUR::AutoState(Touch))
1468 .addConst ("Play", ARDOUR::AutoState(Play))
1471 .beginNamespace ("AutomationType")
1472 .addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation))
1473 .addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation))
1474 .addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation))
1475 .addConst ("SoloIsolateAutomation", ARDOUR::AutomationType(SoloIsolateAutomation))
1476 .addConst ("SoloSafeAutomation", ARDOUR::AutomationType(SoloSafeAutomation))
1477 .addConst ("MuteAutomation", ARDOUR::AutomationType(MuteAutomation))
1478 .addConst ("RecEnableAutomation", ARDOUR::AutomationType(RecEnableAutomation))
1479 .addConst ("RecSafeAutomation", ARDOUR::AutomationType(RecSafeAutomation))
1480 .addConst ("TrimAutomation", ARDOUR::AutomationType(TrimAutomation))
1481 .addConst ("PhaseAutomation", ARDOUR::AutomationType(PhaseAutomation))
1484 .beginNamespace ("SrcQuality")
1485 .addConst ("SrcBest", ARDOUR::SrcQuality(SrcBest))
1488 .beginNamespace ("MeterType")
1489 .addConst ("MeterMaxSignal", ARDOUR::MeterType(MeterMaxSignal))
1490 .addConst ("MeterMaxPeak", ARDOUR::MeterType(MeterMaxPeak))
1491 .addConst ("MeterPeak", ARDOUR::MeterType(MeterPeak))
1492 .addConst ("MeterKrms", ARDOUR::MeterType(MeterKrms))
1493 .addConst ("MeterK20", ARDOUR::MeterType(MeterK20))
1494 .addConst ("MeterK14", ARDOUR::MeterType(MeterK14))
1495 .addConst ("MeterIEC1DIN", ARDOUR::MeterType(MeterIEC1DIN))
1496 .addConst ("MeterIEC1NOR", ARDOUR::MeterType(MeterIEC1NOR))
1497 .addConst ("MeterIEC2BBC", ARDOUR::MeterType(MeterIEC2BBC))
1498 .addConst ("MeterIEC2EBU", ARDOUR::MeterType(MeterIEC2EBU))
1499 .addConst ("MeterVU", ARDOUR::MeterType(MeterVU))
1500 .addConst ("MeterK12", ARDOUR::MeterType(MeterK12))
1501 .addConst ("MeterPeak0dB", ARDOUR::MeterType(MeterPeak0dB))
1502 .addConst ("MeterMCP", ARDOUR::MeterType(MeterMCP))
1505 .beginNamespace ("MeterPoint")
1506 .addConst ("MeterInput", ARDOUR::MeterPoint(MeterInput))
1507 .addConst ("MeterPreFader", ARDOUR::MeterPoint(MeterPreFader))
1508 .addConst ("MeterPostFader", ARDOUR::MeterPoint(MeterPostFader))
1509 .addConst ("MeterOutput", ARDOUR::MeterPoint(MeterOutput))
1510 .addConst ("MeterCustom", ARDOUR::MeterPoint(MeterCustom))
1513 .beginNamespace ("NoteMode")
1514 .addConst ("Sustained", ARDOUR::NoteMode(Sustained))
1515 .addConst ("Percussive", ARDOUR::NoteMode(Percussive))
1518 .beginNamespace ("PortFlags")
1519 .addConst ("IsInput", ARDOUR::PortFlags(IsInput))
1520 .addConst ("IsOutput", ARDOUR::PortFlags(IsOutput))
1521 .addConst ("IsPhysical", ARDOUR::PortFlags(IsPhysical))
1522 .addConst ("CanMonitor", ARDOUR::PortFlags(CanMonitor))
1523 .addConst ("IsTerminal", ARDOUR::PortFlags(IsTerminal))
1526 .beginNamespace ("PlaylistDisposition")
1527 .addConst ("CopyPlaylist", ARDOUR::PlaylistDisposition(CopyPlaylist))
1528 .addConst ("NewPlaylist", ARDOUR::PlaylistDisposition(NewPlaylist))
1529 .addConst ("SharePlaylist", ARDOUR::PlaylistDisposition(SharePlaylist))
1532 .beginNamespace ("RegionPoint")
1533 .addConst ("Start", ARDOUR::RegionPoint(Start))
1534 .addConst ("End", ARDOUR::RegionPoint(End))
1535 .addConst ("SyncPoint", ARDOUR::RegionPoint(SyncPoint))
1538 .beginNamespace ("TempoSection")
1539 .beginNamespace ("PositionLockStyle")
1540 .addConst ("AudioTime", ARDOUR::PositionLockStyle(AudioTime))
1541 .addConst ("MusicTime", ARDOUR::PositionLockStyle(MusicTime))
1545 .beginNamespace ("TempoSection")
1546 .beginNamespace ("Type")
1547 .addConst ("Ramp", ARDOUR::TempoSection::Type(TempoSection::Ramp))
1548 .addConst ("Constant", ARDOUR::TempoSection::Type(TempoSection::Constant))
1552 .beginNamespace ("TrackMode")
1553 .addConst ("Normal", ARDOUR::TrackMode(Start))
1554 .addConst ("NonLayered", ARDOUR::TrackMode(NonLayered))
1555 .addConst ("Destructive", ARDOUR::TrackMode(Destructive))
1558 .beginNamespace ("SampleFormat")
1559 .addConst ("Float", ARDOUR::SampleFormat(FormatFloat))
1560 .addConst ("Int24", ARDOUR::SampleFormat(FormatInt24))
1561 .addConst ("Int16", ARDOUR::SampleFormat(FormatInt16))
1564 .beginNamespace ("HeaderFormat")
1565 .addConst ("BWF", ARDOUR::HeaderFormat(BWF))
1566 .addConst ("WAVE", ARDOUR::HeaderFormat(WAVE))
1567 .addConst ("WAVE64", ARDOUR::HeaderFormat(WAVE64))
1568 .addConst ("CAF", ARDOUR::HeaderFormat(CAF))
1569 .addConst ("AIFF", ARDOUR::HeaderFormat(AIFF))
1570 .addConst ("iXML", ARDOUR::HeaderFormat(iXML))
1571 .addConst ("RF64", ARDOUR::HeaderFormat(RF64))
1572 .addConst ("RF64_WAV", ARDOUR::HeaderFormat(RF64_WAV))
1573 .addConst ("MBWF", ARDOUR::HeaderFormat(MBWF))
1576 .beginNamespace ("InsertMergePolicy")
1577 .addConst ("Reject", ARDOUR::InsertMergePolicy(InsertMergeReject))
1578 .addConst ("Relax", ARDOUR::InsertMergePolicy(InsertMergeRelax))
1579 .addConst ("Replace", ARDOUR::InsertMergePolicy(InsertMergeReplace))
1580 .addConst ("TruncateExisting", ARDOUR::InsertMergePolicy(InsertMergeTruncateExisting))
1581 .addConst ("TruncateAddition", ARDOUR::InsertMergePolicy(InsertMergeTruncateAddition))
1582 .addConst ("Extend", ARDOUR::InsertMergePolicy(InsertMergeExtend))
1585 .endNamespace (); // end ARDOUR
1587 luabridge::getGlobalNamespace (L)
1588 .beginNamespace ("ARDOUR")
1589 .beginClass <AudioBackendInfo> ("AudioBackendInfo")
1590 .addData ("name", &AudioBackendInfo::name)
1592 .beginStdVector <const AudioBackendInfo*> ("BackendVector").endClass ()
1594 .beginClass <AudioBackend::DeviceStatus> ("DeviceStatus")
1595 .addData ("name", &AudioBackend::DeviceStatus::name)
1596 .addData ("available", &AudioBackend::DeviceStatus::available)
1598 .beginStdVector <AudioBackend::DeviceStatus> ("DeviceStatusVector").endClass ()
1600 .beginWSPtrClass <AudioBackend> ("AudioBackend")
1601 .addFunction ("info", &AudioBackend::info)
1602 .addFunction ("sample_rate", &AudioBackend::sample_rate)
1603 .addFunction ("buffer_size", &AudioBackend::buffer_size)
1604 .addFunction ("period_size", &AudioBackend::period_size)
1605 .addFunction ("input_channels", &AudioBackend::input_channels)
1606 .addFunction ("output_channels", &AudioBackend::output_channels)
1607 .addFunction ("dsp_load", &AudioBackend::dsp_load)
1609 .addFunction ("set_sample_rate", &AudioBackend::set_sample_rate)
1610 .addFunction ("set_buffer_size", &AudioBackend::set_buffer_size)
1611 .addFunction ("set_peridod_size", &AudioBackend::set_peridod_size)
1613 .addFunction ("enumerate_drivers", &AudioBackend::enumerate_drivers)
1614 .addFunction ("driver_name", &AudioBackend::driver_name)
1615 .addFunction ("set_driver", &AudioBackend::set_driver)
1617 .addFunction ("use_separate_input_and_output_devices", &AudioBackend::use_separate_input_and_output_devices)
1618 .addFunction ("enumerate_devices", &AudioBackend::enumerate_devices)
1619 .addFunction ("enumerate_input_devices", &AudioBackend::enumerate_input_devices)
1620 .addFunction ("enumerate_output_devices", &AudioBackend::enumerate_output_devices)
1621 .addFunction ("device_name", &AudioBackend::device_name)
1622 .addFunction ("input_device_name", &AudioBackend::input_device_name)
1623 .addFunction ("output_device_name", &AudioBackend::output_device_name)
1624 .addFunction ("set_device_name", &AudioBackend::set_device_name)
1625 .addFunction ("set_input_device_name", &AudioBackend::set_input_device_name)
1626 .addFunction ("set_output_device_name", &AudioBackend::set_output_device_name)
1629 .beginClass <PortEngine> ("PortEngine")
1632 .beginClass <PortManager> ("PortManager")
1633 .addFunction ("port_engine", &PortManager::port_engine)
1634 .addFunction ("connected", &PortManager::connected)
1635 .addFunction ("connect", &PortManager::connect)
1636 .addFunction ("physically_connected", &PortManager::physically_connected)
1637 .addFunction ("disconnect", (int (PortManager::*)(const std::string&, const std::string&))&PortManager::disconnect)
1638 .addFunction ("disconnect_port", (int (PortManager::*)(boost::shared_ptr<Port>))&PortManager::disconnect)
1639 .addFunction ("get_port_by_name", &PortManager::get_port_by_name)
1640 .addFunction ("get_pretty_name_by_name", &PortManager::get_pretty_name_by_name)
1641 .addFunction ("port_is_physical", &PortManager::port_is_physical)
1642 .addFunction ("get_physical_outputs", &PortManager::get_physical_outputs)
1643 .addFunction ("get_physical_inputs", &PortManager::get_physical_inputs)
1644 .addFunction ("n_physical_outputs", &PortManager::n_physical_outputs)
1645 .addFunction ("n_physical_inputs", &PortManager::n_physical_inputs)
1646 .addRefFunction ("get_connections", &PortManager::get_connections)
1647 .addRefFunction ("get_ports", (int (PortManager::*)(DataType, PortManager::PortList&))&PortManager::get_ports)
1648 .addRefFunction ("get_backend_ports", (int (PortManager::*)(const std::string&, DataType, PortFlags, std::vector<std::string>&))&PortManager::get_ports)
1651 .deriveClass <AudioEngine, PortManager> ("AudioEngine")
1652 .addFunction ("available_backends", &AudioEngine::available_backends)
1653 .addFunction ("current_backend_name", &AudioEngine::current_backend_name)
1654 .addFunction ("set_backend", &AudioEngine::set_backend)
1655 .addFunction ("setup_required", &AudioEngine::setup_required)
1656 .addFunction ("start", &AudioEngine::start)
1657 .addFunction ("stop", &AudioEngine::stop)
1658 .addFunction ("get_dsp_load", &AudioEngine::get_dsp_load)
1659 .addFunction ("set_device_name", &AudioEngine::set_device_name)
1660 .addFunction ("set_sample_rate", &AudioEngine::set_sample_rate)
1661 .addFunction ("set_buffer_size", &AudioEngine::set_buffer_size)
1662 .addFunction ("get_last_backend_error", &AudioEngine::get_last_backend_error)
1665 .deriveClass <SessionConfiguration, PBD::Configuration> ("SessionConfiguration")
1666 #undef CONFIG_VARIABLE
1667 #undef CONFIG_VARIABLE_SPECIAL
1668 #define CONFIG_VARIABLE(Type,var,name,value) \
1669 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1670 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1671 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1673 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
1674 .addFunction ("get_" # var, &SessionConfiguration::get_##var) \
1675 .addFunction ("set_" # var, &SessionConfiguration::set_##var) \
1676 .addProperty (#var, &SessionConfiguration::get_##var, &SessionConfiguration::set_##var)
1678 #include "ardour/session_configuration_vars.h"
1680 #undef CONFIG_VARIABLE
1681 #undef CONFIG_VARIABLE_SPECIAL
1685 // basic representation of Session
1686 // functions which can be used from realtime and non-realtime contexts
1687 luabridge::getGlobalNamespace (L)
1688 .beginNamespace ("ARDOUR")
1689 .beginClass <Session> ("Session")
1690 .addFunction ("scripts_changed", &Session::scripts_changed) // used internally
1691 .addFunction ("transport_rolling", &Session::transport_rolling)
1692 .addFunction ("request_transport_speed", &Session::request_transport_speed)
1693 .addFunction ("transport_frame", &Session::transport_frame)
1694 .addFunction ("transport_speed", &Session::transport_speed)
1695 .addFunction ("frame_rate", &Session::frame_rate)
1696 .addFunction ("nominal_frame_rate", &Session::nominal_frame_rate)
1697 .addFunction ("frames_per_timecode_frame", &Session::frames_per_timecode_frame)
1698 .addFunction ("timecode_frames_per_hour", &Session::timecode_frames_per_hour)
1699 .addFunction ("timecode_frames_per_second", &Session::timecode_frames_per_second)
1700 .addFunction ("timecode_drop_frames", &Session::timecode_drop_frames)
1701 .addFunction ("request_locate", &Session::request_locate)
1702 .addFunction ("request_stop", &Session::request_stop)
1703 .addFunction ("request_play_loop", &Session::request_play_loop)
1704 .addFunction ("get_play_loop", &Session::get_play_loop)
1705 .addFunction ("last_transport_start", &Session::last_transport_start)
1706 .addFunction ("goto_start", &Session::goto_start)
1707 .addFunction ("goto_end", &Session::goto_end)
1708 .addFunction ("current_start_frame", &Session::current_start_frame)
1709 .addFunction ("current_end_frame", &Session::current_end_frame)
1710 .addFunction ("actively_recording", &Session::actively_recording)
1711 .addFunction ("new_audio_track", &Session::new_audio_track)
1712 .addFunction ("new_audio_route", &Session::new_audio_route)
1713 .addFunction ("new_midi_track", &Session::new_midi_track)
1714 .addFunction ("new_midi_route", &Session::new_midi_route)
1715 .addFunction ("get_routes", &Session::get_routes)
1716 .addFunction ("get_tracks", &Session::get_tracks)
1717 .addFunction ("name", &Session::name)
1718 .addFunction ("path", &Session::path)
1719 .addFunction ("record_status", &Session::record_status)
1720 .addFunction ("maybe_enable_record", &Session::maybe_enable_record)
1721 .addFunction ("disable_record", &Session::disable_record)
1722 .addFunction ("route_by_id", &Session::route_by_id)
1723 .addFunction ("route_by_name", &Session::route_by_name)
1724 .addFunction ("get_remote_nth_stripable", &Session::get_remote_nth_stripable)
1725 .addFunction ("get_remote_nth_route", &Session::get_remote_nth_route)
1726 .addFunction ("route_by_selected_count", &Session::route_by_selected_count)
1727 .addFunction ("track_by_diskstream_id", &Session::track_by_diskstream_id)
1728 .addFunction ("source_by_id", &Session::source_by_id)
1729 .addFunction ("controllable_by_id", &Session::controllable_by_id)
1730 .addFunction ("processor_by_id", &Session::processor_by_id)
1731 .addFunction ("snap_name", &Session::snap_name)
1732 .addFunction ("monitor_out", &Session::monitor_out)
1733 .addFunction ("master_out", &Session::master_out)
1734 .addFunction ("tempo_map", (TempoMap& (Session::*)())&Session::tempo_map)
1735 .addFunction ("locations", &Session::locations)
1736 .addFunction ("begin_reversible_command", (void (Session::*)(const std::string&))&Session::begin_reversible_command)
1737 .addFunction ("commit_reversible_command", &Session::commit_reversible_command)
1738 .addFunction ("abort_reversible_command", &Session::abort_reversible_command)
1739 .addFunction ("add_command", &Session::add_command)
1740 .addFunction ("add_stateful_diff_command", &Session::add_stateful_diff_command)
1741 .addFunction ("engine", (AudioEngine& (Session::*)())&Session::engine)
1742 .addFunction ("get_block_size", &Session::get_block_size)
1743 .addFunction ("worst_output_latency", &Session::worst_output_latency)
1744 .addFunction ("worst_input_latency", &Session::worst_input_latency)
1745 .addFunction ("worst_track_latency", &Session::worst_track_latency)
1746 .addFunction ("worst_playback_latency", &Session::worst_playback_latency)
1747 .addFunction ("cfg", &Session::cfg)
1750 .beginClass <RegionFactory> ("RegionFactory")
1751 .addStaticFunction ("region_by_id", &RegionFactory::region_by_id)
1754 /* session enums (rt-safe, common) */
1755 .beginNamespace ("Session")
1757 .beginNamespace ("RecordState")
1758 .addConst ("Disabled", ARDOUR::Session::RecordState(Session::Disabled))
1759 .addConst ("Enabled", ARDOUR::Session::RecordState(Session::Enabled))
1760 .addConst ("Recording", ARDOUR::Session::RecordState(Session::Recording))
1763 .endNamespace () // end Session enums
1765 /* ardour enums (rt-safe, common) */
1766 .beginNamespace ("LocationFlags")
1767 .addConst ("IsMark", ARDOUR::Location::Flags(Location::IsMark))
1768 .addConst ("IsAutoPunch", ARDOUR::Location::Flags(Location::IsAutoPunch))
1769 .addConst ("IsAutoLoop", ARDOUR::Location::Flags(Location::IsAutoLoop))
1770 .addConst ("IsHidden", ARDOUR::Location::Flags(Location::IsHidden))
1771 .addConst ("IsCDMarker", ARDOUR::Location::Flags(Location::IsCDMarker))
1772 .addConst ("IsRangeMarker", ARDOUR::Location::Flags(Location::IsRangeMarker))
1773 .addConst ("IsSessionRange", ARDOUR::Location::Flags(Location::IsSessionRange))
1774 .addConst ("IsSkip", ARDOUR::Location::Flags(Location::IsSkip))
1775 .addConst ("IsSkipping", ARDOUR::Location::Flags(Location::IsSkipping))
1778 .beginNamespace ("LuaAPI")
1779 .addFunction ("nil_proc", ARDOUR::LuaAPI::nil_processor)
1780 .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc)
1781 .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info)
1782 .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
1783 .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
1784 .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param)
1785 .addRefFunction ("get_processor_param", ARDOUR::LuaAPI::get_processor_param)
1786 .addRefFunction ("get_plugin_insert_param", ARDOUR::LuaAPI::get_plugin_insert_param)
1787 .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
1788 .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
1789 .addFunction ("usleep", Glib::usleep)
1790 .addCFunction ("build_filename", ARDOUR::LuaAPI::build_filename)
1791 .addFunction ("new_noteptr", ARDOUR::LuaAPI::new_noteptr)
1793 .beginClass <ARDOUR::LuaAPI::Vamp> ("Vamp")
1794 .addConstructor <void (*) (const std::string&, float)> ()
1795 .addStaticFunction ("list_plugins", &ARDOUR::LuaAPI::Vamp::list_plugins)
1796 .addFunction ("plugin", &ARDOUR::LuaAPI::Vamp::plugin)
1797 .addFunction ("analyze", &ARDOUR::LuaAPI::Vamp::analyze)
1798 .addFunction ("reset", &ARDOUR::LuaAPI::Vamp::reset)
1799 .addFunction ("initialize", &ARDOUR::LuaAPI::Vamp::initialize)
1800 .addFunction ("process", &ARDOUR::LuaAPI::Vamp::process)
1803 .endNamespace () // end LuaAPI
1804 .endNamespace ();// end ARDOUR
1808 LuaBindings::dsp (lua_State* L)
1810 luabridge::getGlobalNamespace (L)
1811 .beginNamespace ("ARDOUR")
1813 .beginClass <AudioBuffer> ("AudioBuffer")
1815 .addFunction ("data", (Sample*(AudioBuffer::*)(framecnt_t))&AudioBuffer::data)
1816 .addFunction ("silence", &AudioBuffer::silence)
1817 .addFunction ("apply_gain", &AudioBuffer::apply_gain)
1818 .addFunction ("check_silence", &AudioBuffer::check_silence)
1819 .addFunction ("read_from", (void (AudioBuffer::*)(const Sample*, framecnt_t, framecnt_t, framecnt_t))&AudioBuffer::check_silence)
1822 .beginClass <MidiBuffer> ("MidiBuffer")
1824 .addFunction ("silence", &MidiBuffer::silence)
1825 .addFunction ("size", &MidiBuffer::size)
1826 .addFunction ("empty", &MidiBuffer::empty)
1827 .addFunction ("resize", &MidiBuffer::resize)
1828 .addFunction ("copy", (void (MidiBuffer::*)(MidiBuffer const * const))&MidiBuffer::copy)
1829 .addFunction ("push_event", (bool (MidiBuffer::*)(const Evoral::MIDIEvent<framepos_t>&))&MidiBuffer::push_back)
1830 .addFunction ("push_back", (bool (MidiBuffer::*)(framepos_t, size_t, const uint8_t*))&MidiBuffer::push_back)
1832 .addExtCFunction ("table", &luabridge::CFunc::listToTable<const Evoral::MIDIEvent<framepos_t>, MidiBuffer>)
1835 .beginClass <BufferSet> ("BufferSet")
1837 .addFunction ("get_audio", static_cast<AudioBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_audio))
1838 .addFunction ("get_midi", static_cast<MidiBuffer&(BufferSet::*)(size_t)>(&BufferSet::get_midi))
1839 .addFunction ("count", static_cast<const ChanCount&(BufferSet::*)()const>(&BufferSet::count))
1843 luabridge::getGlobalNamespace (L)
1844 .beginNamespace ("Evoral")
1845 .deriveClass <Evoral::MIDIEvent<framepos_t>, Evoral::Event<framepos_t> > ("MidiEvent")
1847 .addFunction ("type", &Evoral::MIDIEvent<framepos_t>::type)
1848 .addFunction ("channel", &Evoral::MIDIEvent<framepos_t>::channel)
1849 .addFunction ("set_type", &Evoral::MIDIEvent<framepos_t>::set_type)
1850 .addFunction ("set_channel", &Evoral::MIDIEvent<framepos_t>::set_channel)
1854 // dsp releated session functions
1855 luabridge::getGlobalNamespace (L)
1856 .beginNamespace ("ARDOUR")
1857 .beginClass <Session> ("Session")
1858 .addFunction ("get_scratch_buffers", &Session::get_scratch_buffers)
1859 .addFunction ("get_silent_buffers", &Session::get_silent_buffers)
1863 luabridge::getGlobalNamespace (L)
1864 .beginNamespace ("ARDOUR")
1865 .beginClass <FluidSynth> ("FluidSynth")
1866 .addConstructor <void (*) (float, int)> ()
1867 .addFunction ("load_sf2", &FluidSynth::load_sf2)
1868 .addFunction ("synth", &FluidSynth::synth)
1869 .addFunction ("midi_event", &FluidSynth::midi_event)
1870 .addFunction ("panic", &FluidSynth::panic)
1871 .addFunction ("select_program", &FluidSynth::select_program)
1872 .addFunction ("program_count", &FluidSynth::program_count)
1873 .addFunction ("program_name", &FluidSynth::program_name)
1877 luabridge::getGlobalNamespace (L)
1878 .beginNamespace ("ARDOUR")
1879 .beginNamespace ("DSP")
1880 .addFunction ("compute_peak", ARDOUR::compute_peak)
1881 .addFunction ("find_peaks", ARDOUR::find_peaks)
1882 .addFunction ("apply_gain_to_buffer", ARDOUR::apply_gain_to_buffer)
1883 .addFunction ("mix_buffers_no_gain", ARDOUR::mix_buffers_no_gain)
1884 .addFunction ("mix_buffers_with_gain", ARDOUR::mix_buffers_with_gain)
1885 .addFunction ("copy_vector", ARDOUR::copy_vector)
1886 .addFunction ("dB_to_coefficient", &dB_to_coefficient)
1887 .addFunction ("fast_coefficient_to_dB", &fast_coefficient_to_dB)
1888 .addFunction ("accurate_coefficient_to_dB", &accurate_coefficient_to_dB)
1889 .addFunction ("memset", &DSP::memset)
1890 .addFunction ("mmult", &DSP::mmult)
1891 .addFunction ("log_meter", &DSP::log_meter)
1892 .addFunction ("log_meter_coeff", &DSP::log_meter_coeff)
1893 .addFunction ("process_map", &DSP::process_map)
1894 .addRefFunction ("peaks", &DSP::peaks)
1896 .beginClass <DSP::LowPass> ("LowPass")
1897 .addConstructor <void (*) (double, float)> ()
1898 .addFunction ("proc", &DSP::LowPass::proc)
1899 .addFunction ("ctrl", &DSP::LowPass::ctrl)
1900 .addFunction ("set_cutoff", &DSP::LowPass::set_cutoff)
1901 .addFunction ("reset", &DSP::LowPass::reset)
1903 .beginClass <DSP::Biquad> ("Biquad")
1904 .addConstructor <void (*) (double)> ()
1905 .addFunction ("run", &DSP::Biquad::run)
1906 .addFunction ("compute", &DSP::Biquad::compute)
1907 .addFunction ("configure", &DSP::Biquad::configure)
1908 .addFunction ("reset", &DSP::Biquad::reset)
1909 .addFunction ("dB_at_freq", &DSP::Biquad::dB_at_freq)
1911 .beginClass <DSP::FFTSpectrum> ("FFTSpectrum")
1912 .addConstructor <void (*) (uint32_t, double)> ()
1913 .addFunction ("set_data_hann", &DSP::FFTSpectrum::set_data_hann)
1914 .addFunction ("execute", &DSP::FFTSpectrum::execute)
1915 .addFunction ("power_at_bin", &DSP::FFTSpectrum::power_at_bin)
1916 .addFunction ("freq_at_bin", &DSP::FFTSpectrum::freq_at_bin)
1920 .beginNamespace ("BiquadType")
1921 .addConst ("LowPass", ARDOUR::DSP::Biquad::LowPass)
1922 .addConst ("HighPass", ARDOUR::DSP::Biquad::HighPass)
1923 .addConst ("BandPassSkirt", ARDOUR::DSP::Biquad::BandPassSkirt)
1924 .addConst ("BandPass0dB", ARDOUR::DSP::Biquad::BandPass0dB)
1925 .addConst ("Notch", ARDOUR::DSP::Biquad::Notch)
1926 .addConst ("AllPass", ARDOUR::DSP::Biquad::AllPass)
1927 .addConst ("Peaking", ARDOUR::DSP::Biquad::Peaking)
1928 .addConst ("LowShelf", ARDOUR::DSP::Biquad::LowShelf)
1929 .addConst ("HighShelf", ARDOUR::DSP::Biquad::HighShelf)
1932 .beginClass <DSP::DspShm> ("DspShm")
1933 .addConstructor<void (*) (size_t)> ()
1934 .addFunction ("allocate", &DSP::DspShm::allocate)
1935 .addFunction ("clear", &DSP::DspShm::clear)
1936 .addFunction ("to_float", &DSP::DspShm::to_float)
1937 .addFunction ("to_int", &DSP::DspShm::to_int)
1938 .addFunction ("atomic_set_int", &DSP::DspShm::atomic_set_int)
1939 .addFunction ("atomic_get_int", &DSP::DspShm::atomic_get_int)
1942 .endNamespace () // DSP
1944 .beginClass <LuaTableRef> ("LuaTableRef")
1945 .addCFunction ("get", &LuaTableRef::get)
1946 .addCFunction ("set", &LuaTableRef::set)
1949 .endNamespace (); // ARDOUR
1953 LuaBindings::session (lua_State* L)
1955 // non-realtime session functions
1956 luabridge::getGlobalNamespace (L)
1957 .beginNamespace ("ARDOUR")
1958 .beginClass <Session> ("Session")
1959 .addFunction ("save_state", &Session::save_state)
1960 .addFunction ("set_dirty", &Session::set_dirty)
1961 .addFunction ("unknown_processors", &Session::unknown_processors)
1963 .addFunction<RouteList (Session::*)(uint32_t, PresentationInfo::order_t, const std::string&, const std::string&, PlaylistDisposition)> ("new_route_from_template", &Session::new_route_from_template)
1964 // TODO session_add_audio_track session_add_midi_track session_add_mixed_track
1965 //.addFunction ("new_midi_track", &Session::new_midi_track)
1968 .endNamespace (); // ARDOUR
1972 LuaBindings::osc (lua_State* L)
1974 luabridge::getGlobalNamespace (L)
1975 .beginNamespace ("ARDOUR")
1976 .beginNamespace ("LuaOSC")
1977 .beginClass<LuaOSC::Address> ("Address")
1978 .addConstructor<void (*) (std::string)> ()
1979 .addCFunction ("send", &LuaOSC::Address::send)
1986 LuaBindings::set_session (lua_State* L, Session *s)
1988 /* LuaBridge uses unique keys to identify classes/c-types.
1990 * Those keys are "generated" by using the memory-address of a static
1991 * variable, templated for every Class.
1992 * (see libs/lua/LuaBridge/detail/ClassInfo.h)
1994 * When linking the final executable there must be exactly one static
1995 * function (static variable) for every templated class.
1996 * This works fine on OSX and Linux...
1998 * Windows (mingw and MSVC) however expand the template differently for libardour
1999 * AND gtk2_ardour. We end up with two identical static functions
2000 * at different addresses!!
2002 * The Solution: have gtk2_ardour never include LuaBridge headers directly
2003 * and always go via libardour function calls for classes that are registered
2004 * in libardour. (calling lua itself is fine, calling c-functions in the GUI
2005 * which expand the template is not)
2007 * (the actual cause: even static symbols in a .dll have no fixed address
2008 * and are mapped when loading the dll. static functions in .exe do have a fixed
2012 * 0000000000000000 I __imp__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
2013 * 0000000000000000 I __nm__ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
2014 * 0000000000000000 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
2017 * 000000000104f560 d .data$_ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
2018 * 000000000104f560 D _ZZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEvE5value
2019 * 0000000000e9baf0 T _ZN9luabridge9ClassInfoIN6ARDOUR7SessionEE11getClassKeyEv
2023 luabridge::push <Session *> (L, s);
2024 lua_setglobal (L, "Session");
2027 // call lua function.
2028 luabridge::LuaRef cb_ses = luabridge::getGlobal (L, "new_session");
2029 if (cb_ses.type() == LUA_TFUNCTION) { cb_ses(s->name()); } // TODO args