diff options
author | Robin Gareus <robin@gareus.org> | 2016-04-10 17:35:02 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-04-10 20:56:14 +0200 |
commit | 86a45e3cac26fd02fe49b5ef7ebe7259a1aad979 (patch) | |
tree | a177b02804d98e7b255a33e7100b7e8c75d66446 /libs/ardour/lua_api.cc | |
parent | 1c084d1e0e7aae0b6366cf8fcf73db2eacf5c1ab (diff) |
add lua bindings for Automation Events
Diffstat (limited to 'libs/ardour/lua_api.cc')
-rw-r--r-- | libs/ardour/lua_api.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index 02a4de4658..e24902999d 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -184,6 +184,51 @@ ARDOUR::LuaAPI::set_processor_param (boost::shared_ptr<Processor> proc, uint32_t } int +ARDOUR::LuaAPI::plugin_automation (lua_State *L) +{ + typedef boost::shared_ptr<Processor> T; + + int top = lua_gettop(L); + if (top < 2) { + return luaL_argerror (L, 1, "invalid number of arguments, :plugin_automation (plugin, parameter_number)"); + } + T* const p = luabridge::Userdata::get<T>(L, 1, false); + uint32_t which = luabridge::Stack<uint32_t>::get (L, 2); + if (!p) { + return luaL_error (L, "Invalid pointer to Ardour:Processor"); + } + boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (*p); + if (!pi) { + return luaL_error (L, "Given Processor is not a Plugin Insert"); + } + boost::shared_ptr<Plugin> plugin = pi->plugin(); + if (!plugin) { + return luaL_error (L, "Given Processor is not a Plugin"); + } + + bool ok=false; + uint32_t controlid = plugin->nth_parameter (which, ok); + if (!ok) { + return luaL_error (L, "Invalid Parameter"); + } + if (!plugin->parameter_is_input (controlid)) { + return luaL_error (L, "Given Parameter is not an input"); + } + + ParameterDescriptor pd; + if (plugin->get_parameter_descriptor (controlid, pd) != 0) { + return luaL_error (L, "Cannot describe parameter"); + } + + boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid)); + + luabridge::Stack<boost::shared_ptr<AutomationList> >::push (L, c->alist()); + luabridge::Stack<boost::shared_ptr<Evoral::ControlList> >::push (L, c->list()); + luabridge::Stack<ParameterDescriptor>::push (L, pd); + return 3; +} + +int ARDOUR::LuaOSC::Address::send (lua_State *L) { Address * const luaosc = luabridge::Userdata::get <Address> (L, 1, false); |