13
0

NO-OP: whitespace

This commit is contained in:
Robin Gareus 2016-09-16 22:38:14 +02:00
parent 140c4bb115
commit a1fae47c15

View File

@ -76,7 +76,7 @@ ARDOUR::LuaAPI::new_luaproc (Session *s, const string& name)
LuaScriptInfoPtr spi; LuaScriptInfoPtr spi;
ARDOUR::LuaScriptList & _scripts (LuaScripting::instance ().scripts (LuaScriptInfo::DSP)); ARDOUR::LuaScriptList & _scripts (LuaScripting::instance ().scripts (LuaScriptInfo::DSP));
for (LuaScriptList::const_iterator i = _scripts.begin(); i != _scripts.end(); ++i) { for (LuaScriptList::const_iterator i = _scripts.begin (); i != _scripts.end (); ++i) {
if (name == (*i)->name) { if (name == (*i)->name) {
spi = *i; spi = *i;
break; break;
@ -90,7 +90,7 @@ ARDOUR::LuaAPI::new_luaproc (Session *s, const string& name)
PluginPtr p; PluginPtr p;
try { try {
LuaPluginInfoPtr lpi (new LuaPluginInfo(spi)); LuaPluginInfoPtr lpi (new LuaPluginInfo (spi));
p = (lpi->load (*s)); p = (lpi->load (*s));
} catch (...) { } catch (...) {
warning << _("Failed to instantiate Lua Processor\n"); warning << _("Failed to instantiate Lua Processor\n");
@ -103,24 +103,24 @@ ARDOUR::LuaAPI::new_luaproc (Session *s, const string& name)
PluginInfoPtr PluginInfoPtr
ARDOUR::LuaAPI::new_plugin_info (const string& name, ARDOUR::PluginType type) ARDOUR::LuaAPI::new_plugin_info (const string& name, ARDOUR::PluginType type)
{ {
PluginManager& manager = PluginManager::instance(); PluginManager& manager = PluginManager::instance ();
PluginInfoList all_plugs; PluginInfoList all_plugs;
all_plugs.insert(all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.ladspa_plugin_info ().begin (), manager.ladspa_plugin_info ().end ());
all_plugs.insert(all_plugs.end(), manager.lua_plugin_info().begin(), manager.lua_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.lua_plugin_info ().begin (), manager.lua_plugin_info ().end ());
#ifdef WINDOWS_VST_SUPPORT #ifdef WINDOWS_VST_SUPPORT
all_plugs.insert(all_plugs.end(), manager.windows_vst_plugin_info().begin(), manager.windows_vst_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.windows_vst_plugin_info ().begin (), manager.windows_vst_plugin_info ().end ());
#endif #endif
#ifdef LXVST_SUPPORT #ifdef LXVST_SUPPORT
all_plugs.insert(all_plugs.end(), manager.lxvst_plugin_info().begin(), manager.lxvst_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.lxvst_plugin_info ().begin (), manager.lxvst_plugin_info ().end ());
#endif #endif
#ifdef AUDIOUNIT_SUPPORT #ifdef AUDIOUNIT_SUPPORT
all_plugs.insert(all_plugs.end(), manager.au_plugin_info().begin(), manager.au_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.au_plugin_info ().begin (), manager.au_plugin_info ().end ());
#endif #endif
#ifdef LV2_SUPPORT #ifdef LV2_SUPPORT
all_plugs.insert(all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end()); all_plugs.insert (all_plugs.end (), manager.lv2_plugin_info ().begin (), manager.lv2_plugin_info ().end ());
#endif #endif
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) { for (PluginInfoList::const_iterator i = all_plugs.begin (); i != all_plugs.end (); ++i) {
if (((*i)->name == name || (*i)->unique_id == name) && (*i)->type == type) { if (((*i)->name == name || (*i)->unique_id == name) && (*i)->type == type) {
return *i; return *i;
} }
@ -146,7 +146,7 @@ ARDOUR::LuaAPI::new_plugin (Session *s, const string& name, ARDOUR::PluginType t
return boost::shared_ptr<Processor> (); return boost::shared_ptr<Processor> ();
} }
if (!preset.empty()) { if (!preset.empty ()) {
const Plugin::PresetRecord *pr = p->preset_by_label (preset); const Plugin::PresetRecord *pr = p->preset_by_label (preset);
if (pr) { if (pr) {
p->load_preset (*pr); p->load_preset (*pr);
@ -159,7 +159,7 @@ ARDOUR::LuaAPI::new_plugin (Session *s, const string& name, ARDOUR::PluginType t
bool bool
ARDOUR::LuaAPI::set_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, float val) ARDOUR::LuaAPI::set_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, float val)
{ {
boost::shared_ptr<Plugin> plugin = pi->plugin(); boost::shared_ptr<Plugin> plugin = pi->plugin ();
if (!plugin) { return false; } if (!plugin) { return false; }
bool ok=false; bool ok=false;
@ -171,7 +171,7 @@ ARDOUR::LuaAPI::set_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uin
if (plugin->get_parameter_descriptor (controlid, pd) != 0) { return false; } if (plugin->get_parameter_descriptor (controlid, pd) != 0) { return false; }
if (val < pd.lower || val > pd.upper) { return false; } if (val < pd.lower || val > pd.upper) { return false; }
boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid)); boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter (PluginAutomation, 0, controlid));
c->set_value (val, PBD::Controllable::NoGroup); c->set_value (val, PBD::Controllable::NoGroup);
return true; return true;
} }
@ -180,7 +180,7 @@ float
ARDOUR::LuaAPI::get_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, bool &ok) ARDOUR::LuaAPI::get_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, bool &ok)
{ {
ok=false; ok=false;
boost::shared_ptr<Plugin> plugin = pi->plugin(); boost::shared_ptr<Plugin> plugin = pi->plugin ();
if (!plugin) { return 0; } if (!plugin) { return 0; }
uint32_t controlid = plugin->nth_parameter (which, ok); uint32_t controlid = plugin->nth_parameter (which, ok);
if (!ok) { return 0; } if (!ok) { return 0; }
@ -209,11 +209,11 @@ ARDOUR::LuaAPI::plugin_automation (lua_State *L)
{ {
typedef boost::shared_ptr<Processor> T; typedef boost::shared_ptr<Processor> T;
int top = lua_gettop(L); int top = lua_gettop (L);
if (top < 2) { if (top < 2) {
return luaL_argerror (L, 1, "invalid number of arguments, :plugin_automation (plugin, parameter_number)"); return luaL_argerror (L, 1, "invalid number of arguments, :plugin_automation (plugin, parameter_number)");
} }
T* const p = luabridge::Userdata::get<T>(L, 1, false); T* const p = luabridge::Userdata::get<T> (L, 1, false);
uint32_t which = luabridge::Stack<uint32_t>::get (L, 2); uint32_t which = luabridge::Stack<uint32_t>::get (L, 2);
if (!p) { if (!p) {
return luaL_error (L, "Invalid pointer to Ardour:Processor"); return luaL_error (L, "Invalid pointer to Ardour:Processor");
@ -222,7 +222,7 @@ ARDOUR::LuaAPI::plugin_automation (lua_State *L)
if (!pi) { if (!pi) {
return luaL_error (L, "Given Processor is not a Plugin Insert"); return luaL_error (L, "Given Processor is not a Plugin Insert");
} }
boost::shared_ptr<Plugin> plugin = pi->plugin(); boost::shared_ptr<Plugin> plugin = pi->plugin ();
if (!plugin) { if (!plugin) {
return luaL_error (L, "Given Processor is not a Plugin"); return luaL_error (L, "Given Processor is not a Plugin");
} }
@ -241,10 +241,10 @@ ARDOUR::LuaAPI::plugin_automation (lua_State *L)
return luaL_error (L, "Cannot describe parameter"); return luaL_error (L, "Cannot describe parameter");
} }
boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid)); 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<AutomationList> >::push (L, c->alist ());
luabridge::Stack<boost::shared_ptr<Evoral::ControlList> >::push (L, c->list()); luabridge::Stack<boost::shared_ptr<Evoral::ControlList> >::push (L, c->list ());
luabridge::Stack<ParameterDescriptor>::push (L, pd); luabridge::Stack<ParameterDescriptor>::push (L, pd);
return 3; return 3;
} }
@ -260,30 +260,30 @@ ARDOUR::LuaOSC::Address::send (lua_State *L)
return luaL_error (L, "Invalid Destination Address"); return luaL_error (L, "Invalid Destination Address");
} }
int top = lua_gettop(L); int top = lua_gettop (L);
if (top < 3) { if (top < 3) {
return luaL_argerror (L, 1, "invalid number of arguments, :send (path, type, ...)"); return luaL_argerror (L, 1, "invalid number of arguments, :send (path, type, ...)");
} }
const char* path = luaL_checkstring (L, 2); const char* path = luaL_checkstring (L, 2);
const char* type = luaL_checkstring (L, 3); const char* type = luaL_checkstring (L, 3);
assert (path && type); assert (path && type);
if ((int) strlen(type) != top - 3) { if ((int) strlen (type) != top - 3) {
return luaL_argerror (L, 3, "type description does not match arguments"); return luaL_argerror (L, 3, "type description does not match arguments");
} }
lo_message msg = lo_message_new (); lo_message msg = lo_message_new ();
for (int i = 4; i <= top; ++i) { for (int i = 4; i <= top; ++i) {
char t = type[i - 4]; char t = type[i - 4];
int lt = lua_type(L, i); int lt = lua_type (L, i);
int ok = -1; int ok = -1;
switch(lt) { switch (lt) {
case LUA_TSTRING: case LUA_TSTRING:
if (t == LO_STRING) { if (t == LO_STRING) {
ok = lo_message_add_string (msg, luaL_checkstring(L, i)); ok = lo_message_add_string (msg, luaL_checkstring (L, i));
} else if (t == LO_CHAR) { } else if (t == LO_CHAR) {
char c = luaL_checkstring (L, i) [0]; char c = luaL_checkstring (L, i) [0];
ok = lo_message_add_char (msg, c); ok = lo_message_add_char (msg, c);
} }
@ -299,16 +299,16 @@ ARDOUR::LuaOSC::Address::send (lua_State *L)
break; break;
case LUA_TNUMBER: case LUA_TNUMBER:
if (t == LO_INT32) { if (t == LO_INT32) {
ok = lo_message_add_int32 (msg, (int32_t) luaL_checkinteger(L, i)); ok = lo_message_add_int32 (msg, (int32_t) luaL_checkinteger (L, i));
} }
else if (t == LO_FLOAT) { else if (t == LO_FLOAT) {
ok = lo_message_add_float (msg, (float) luaL_checknumber(L, i)); ok = lo_message_add_float (msg, (float) luaL_checknumber (L, i));
} }
else if (t == LO_DOUBLE) { else if (t == LO_DOUBLE) {
ok = lo_message_add_double (msg, (double) luaL_checknumber(L, i)); ok = lo_message_add_double (msg, (double) luaL_checknumber (L, i));
} }
else if (t == LO_INT64) { else if (t == LO_INT64) {
ok = lo_message_add_double (msg, (int64_t) luaL_checknumber(L, i)); ok = lo_message_add_double (msg, (int64_t) luaL_checknumber (L, i));
} }
break; break;
default: default:
@ -337,7 +337,7 @@ static double hue2rgb (const double p, const double q, double t) {
int int
ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L) ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L)
{ {
int top = lua_gettop(L); int top = lua_gettop (L);
if (top < 3) { if (top < 3) {
return luaL_argerror (L, 1, "invalid number of arguments, :hsla_to_rgba (h, s, l [,a])"); return luaL_argerror (L, 1, "invalid number of arguments, :hsla_to_rgba (h, s, l [,a])");
} }
@ -352,7 +352,7 @@ ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L)
// we can't use ArdourCanvas::hsva_to_color here // we can't use ArdourCanvas::hsva_to_color here
// besides we want HSL not HSV and without intermediate // besides we want HSL not HSV and without intermediate
// color_to_rgba (rgba_to_color ()) // color_to_rgba (rgba_to_color ())
double r,g,b; double r, g, b;
const double cq = l < 0.5 ? l * (1 + s) : l + s - l * s; const double cq = l < 0.5 ? l * (1 + s) : l + s - l * s;
const double cp = 2.f * l - cq; const double cp = 2.f * l - cq;
r = hue2rgb (cp, cq, h + 1.0 / 3.0); r = hue2rgb (cp, cq, h + 1.0 / 3.0);
@ -370,16 +370,16 @@ int
ARDOUR::LuaAPI::build_filename (lua_State *L) ARDOUR::LuaAPI::build_filename (lua_State *L)
{ {
std::vector<std::string> elem; std::vector<std::string> elem;
int top = lua_gettop(L); int top = lua_gettop (L);
if (top < 1) { if (top < 1) {
return luaL_argerror (L, 1, "invalid number of arguments, build_filename (path, ...)"); return luaL_argerror (L, 1, "invalid number of arguments, build_filename (path, ...)");
} }
for (int i = 1; i <= top; ++i) { for (int i = 1; i <= top; ++i) {
int lt = lua_type (L, i); int lt = lua_type (L, i);
if (lt != LUA_TSTRING) { if (lt != LUA_TSTRING) {
return luaL_argerror (L, i, "invalid argument type, expected string"); return luaL_argerror (L, i, "invalid argument type, expected string");
} }
elem.push_back (luaL_checkstring(L, i)); elem.push_back (luaL_checkstring (L, i));
} }
luabridge::Stack<std::string>::push (L, Glib::build_filename (elem)); luabridge::Stack<std::string>::push (L, Glib::build_filename (elem));
@ -388,14 +388,14 @@ ARDOUR::LuaAPI::build_filename (lua_State *L)
luabridge::LuaRef::Proxy& luabridge::LuaRef::Proxy&
luabridge::LuaRef::Proxy::clone_instance (const void* classkey, void* p) { luabridge::LuaRef::Proxy::clone_instance (const void* classkey, void* p) {
lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef); lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_tableRef);
lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef); lua_rawgeti (m_L, LUA_REGISTRYINDEX, m_keyRef);
luabridge::UserdataPtr::push_raw (m_L, p, classkey); luabridge::UserdataPtr::push_raw (m_L, p, classkey);
lua_rawset (m_L, -3); lua_rawset (m_L, -3);
lua_pop (m_L, 1); lua_pop (m_L, 1);
return *this; return *this;
} }
LuaTableRef::LuaTableRef () {} LuaTableRef::LuaTableRef () {}
@ -408,10 +408,10 @@ LuaTableRef::get (lua_State* L)
for (std::vector<LuaTableEntry>::const_iterator i = _data.begin (); i != _data.end (); ++i) { for (std::vector<LuaTableEntry>::const_iterator i = _data.begin (); i != _data.end (); ++i) {
switch ((*i).keytype) { switch ((*i).keytype) {
case LUA_TSTRING: case LUA_TSTRING:
assign(&rv, i->k_s, *i); assign (&rv, i->k_s, *i);
break; break;
case LUA_TNUMBER: case LUA_TNUMBER:
assign(&rv, i->k_n, *i); assign (&rv, i->k_n, *i);
break; break;
} }
} }
@ -430,8 +430,8 @@ LuaTableRef::set (lua_State* L)
while (lua_next (L, -2)) { while (lua_next (L, -2)) {
lua_pushvalue (L, -2); lua_pushvalue (L, -2);
LuaTableEntry s (lua_type(L, -1), lua_type(L, -2)); LuaTableEntry s (lua_type (L, -1), lua_type (L, -2));
switch (lua_type(L, -1)) { switch (lua_type (L, -1)) {
case LUA_TSTRING: case LUA_TSTRING:
s.k_s = luabridge::Stack<std::string>::get (L, -1); s.k_s = luabridge::Stack<std::string>::get (L, -1);
break; break;
@ -445,7 +445,7 @@ LuaTableRef::set (lua_State* L)
continue; continue;
} }
switch(lua_type(L, -2)) { switch (lua_type (L, -2)) {
case LUA_TSTRING: case LUA_TSTRING:
s.s = luabridge::Stack<std::string>::get (L, -2); s.s = luabridge::Stack<std::string>::get (L, -2);
break; break;
@ -471,7 +471,7 @@ LuaTableRef::set (lua_State* L)
s.c = classkey; s.c = classkey;
s.p = luabridge::Userdata::get_ptr (L, -2); s.p = luabridge::Userdata::get_ptr (L, -2);
} }
} else { } else {
lua_pop (L, 2); lua_pop (L, 2);
} }
@ -490,7 +490,7 @@ LuaTableRef::set (lua_State* L)
continue; continue;
} }
_data.push_back(s); _data.push_back (s);
lua_pop (L, 2); lua_pop (L, 2);
} }
return 0; return 0;
@ -499,11 +499,11 @@ LuaTableRef::set (lua_State* L)
void* void*
LuaTableRef::findclasskey (lua_State *L, const void* key) LuaTableRef::findclasskey (lua_State *L, const void* key)
{ {
lua_pushvalue(L, LUA_REGISTRYINDEX); lua_pushvalue (L, LUA_REGISTRYINDEX);
lua_pushnil (L); lua_pushnil (L);
while (lua_next (L, -2)) { while (lua_next (L, -2)) {
lua_pushvalue (L, -2); lua_pushvalue (L, -2);
if (lua_topointer(L, -2) == key) { if (lua_topointer (L, -2) == key) {
void* rv = lua_touserdata (L, -1); void* rv = lua_touserdata (L, -1);
lua_pop (L, 4); lua_pop (L, 4);
return rv; return rv;