13
0

re-do previous commit

* do not include _by_name() API. Port names are locale dependent
* proper whitespace (after comma, before bracket) and styleguide
This commit is contained in:
Robin Gareus 2016-09-16 22:35:27 +02:00
parent 2b8979647b
commit 140c4bb115
3 changed files with 41 additions and 0 deletions

View File

@ -82,6 +82,16 @@ namespace ARDOUR { namespace LuaAPI {
* @returns true on success, false on error or out-of-bounds value * @returns true on success, false on error or out-of-bounds value
*/ */
bool set_processor_param (boost::shared_ptr<ARDOUR::Processor> proc, uint32_t which, float val); bool set_processor_param (boost::shared_ptr<ARDOUR::Processor> proc, uint32_t which, float val);
/** get a plugin control parameter value
*
* @param proc Plugin-Processor
* @param which control port to set (starting at 0, including ports of type input and output))
* @param ok boolean variable contains true or false after call returned. to be checked by caller before using value.
* @returns value
*/
float get_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, bool &ok);
/** set a plugin control-input parameter value /** set a plugin control-input parameter value
* *
* This is a wrapper around set_processor_param which looks up the Processor by plugin-insert. * This is a wrapper around set_processor_param which looks up the Processor by plugin-insert.
@ -93,6 +103,15 @@ namespace ARDOUR { namespace LuaAPI {
*/ */
bool set_plugin_insert_param (boost::shared_ptr<ARDOUR::PluginInsert> pi, uint32_t which, float val); bool set_plugin_insert_param (boost::shared_ptr<ARDOUR::PluginInsert> pi, uint32_t which, float val);
/** get a plugin control parameter value
*
* @param proc Plugin-Insert
* @param which control port to query (starting at 0, including ports of type input and output)
* @param ok boolean variable contains true or false after call returned. to be checked by caller before using value.
* @returns value
*/
float get_plugin_insert_param (boost::shared_ptr<ARDOUR::PluginInsert> pi, uint32_t which, bool &ok);
/** /**
* A convenience function to get a Automation Lists and ParamaterDescriptor * A convenience function to get a Automation Lists and ParamaterDescriptor
* for a given plugin control. * for a given plugin control.

View File

@ -176,6 +176,17 @@ ARDOUR::LuaAPI::set_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uin
return true; return true;
} }
float
ARDOUR::LuaAPI::get_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, bool &ok)
{
ok=false;
boost::shared_ptr<Plugin> plugin = pi->plugin();
if (!plugin) { return 0; }
uint32_t controlid = plugin->nth_parameter (which, ok);
if (!ok) { return 0; }
return plugin->get_parameter ( controlid );
}
bool bool
ARDOUR::LuaAPI::set_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, float val) ARDOUR::LuaAPI::set_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, float val)
{ {
@ -184,6 +195,15 @@ ARDOUR::LuaAPI::set_processor_param (boost::shared_ptr<Processor> proc, uint32_t
return set_plugin_insert_param (pi, which, val); return set_plugin_insert_param (pi, which, val);
} }
float
ARDOUR::LuaAPI::get_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, bool &ok)
{
ok=false;
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (proc);
if (!pi) { return false; }
return get_plugin_insert_param (pi, which, ok);
}
int int
ARDOUR::LuaAPI::plugin_automation (lua_State *L) ARDOUR::LuaAPI::plugin_automation (lua_State *L)
{ {

View File

@ -1466,6 +1466,8 @@ LuaBindings::common (lua_State* L)
.addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin) .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin)
.addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param) .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param)
.addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param) .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param)
.addRefFunction ("get_processor_param", ARDOUR::LuaAPI::get_processor_param)
.addRefFunction ("get_plugin_insert_param", ARDOUR::LuaAPI::get_plugin_insert_param)
.addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation) .addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)
.addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba) .addCFunction ("hsla_to_rgba", ARDOUR::LuaAPI::hsla_to_rgba)
.addFunction ("usleep", Glib::usleep) .addFunction ("usleep", Glib::usleep)