13
0

add a static function to access processor selection from a Lua script

local ps = ArdourUI.processor_selection()
  for p in ps:iter() do print (p:name ()) end
This commit is contained in:
Robin Gareus 2016-08-26 03:24:06 +02:00
parent d696363021
commit 7837122e45
2 changed files with 23 additions and 2 deletions

View File

@ -37,6 +37,7 @@
#include "luainstance.h"
#include "luasignal.h"
#include "marker.h"
#include "processor_box.h"
#include "time_axis_view.h"
#include "selection.h"
#include "script_selector.h"
@ -349,6 +350,16 @@ const char *luasignalstr[] = {
}; // namespace
/** special cases for Ardour's Mixer UI */
namespace LuaMixer {
ProcessorBox::ProcSelection
processor_selection (lua_State* L) {
return ProcessorBox::current_processor_selection ();
}
};
////////////////////////////////////////////////////////////////////////////////
#define xstr(s) stringify(s)
@ -545,6 +556,8 @@ LuaInstance::register_classes (lua_State* L)
.addFunction ("http_get", (std::string (*)(const std::string&))&ArdourCurl::http_get)
.addFunction ("processor_selection", &LuaMixer::processor_selection)
.beginStdList <ArdourMarker*> ("ArdourMarkerList")
.endClass ()

View File

@ -454,6 +454,16 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
static Gtkmm2ext::Bindings* bindings;
static void register_actions();
typedef std::vector<boost::shared_ptr<ARDOUR::Processor> > ProcSelection;
static ProcSelection current_processor_selection () {
ProcSelection ps;
if (_current_processor_box) {
_current_processor_box->get_selected_processors (ps);
}
return ps;
}
#ifndef NDEBUG
static bool show_all_processors;
#endif
@ -535,8 +545,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
void ab_plugins ();
typedef std::vector<boost::shared_ptr<ARDOUR::Processor> > ProcSelection;
void cut_processors (const ProcSelection&);
void copy_processors (const ProcSelection&);
void delete_processors (const ProcSelection&);