13
0

Fix broken whitespace.

git-svn-id: svn://localhost/ardour2/branches/3.0@9270 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2011-04-02 19:52:21 +00:00
parent 0102c5812b
commit 9ca4623451

View File

@ -23,7 +23,6 @@
#include <string> #include <string>
#include "pbd/failed_constructor.h" #include "pbd/failed_constructor.h"
#include "pbd/xml++.h" #include "pbd/xml++.h"
#include "pbd/convert.h" #include "pbd/convert.h"
@ -70,9 +69,9 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
{ {
/* the first is the master */ /* the first is the master */
if (plug) { if (plug) {
_plugins.push_back (plug); _plugins.push_back (plug);
set_automatable (); set_automatable ();
Glib::Mutex::Lock em (_session.engine().process_lock()); Glib::Mutex::Lock em (_session.engine().process_lock());
IO::PortCountChanged (max(input_streams(), output_streams())); IO::PortCountChanged (max(input_streams(), output_streams()));
@ -204,7 +203,7 @@ PluginInsert::set_automatable ()
Evoral::Parameter param(*i); Evoral::Parameter param(*i);
_plugins.front()->get_parameter_descriptor(i->id(), desc); _plugins.front()->get_parameter_descriptor(i->id(), desc);
/* the Parameter belonging to the actual plugin doesn't have its range set /* the Parameter belonging to the actual plugin doesn't have its range set
but we want the Controllable related to this Parameter to have those limits. but we want the Controllable related to this Parameter to have those limits.
*/ */
@ -212,7 +211,7 @@ PluginInsert::set_automatable ()
param.set_range (desc.lower, desc.upper, _plugins.front()->default_value(i->id()), desc.toggled); param.set_range (desc.lower, desc.upper, _plugins.front()->default_value(i->id()), desc.toggled);
can_automate (param); can_automate (param);
boost::shared_ptr<AutomationList> list(new AutomationList(param)); boost::shared_ptr<AutomationList> list(new AutomationList(param));
add_control (boost::shared_ptr<AutomationControl> (new PluginControl(this, param, list))); add_control (boost::shared_ptr<AutomationControl> (new PluginControl(this, param, list)));
} }
} }
} }
@ -238,13 +237,13 @@ PluginInsert::parameter_changed (Evoral::Parameter which, float val)
int int
PluginInsert::set_block_size (pframes_t nframes) PluginInsert::set_block_size (pframes_t nframes)
{ {
int ret = 0; int ret = 0;
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
if ((*i)->set_block_size (nframes) != 0) { if ((*i)->set_block_size (nframes) != 0) {
ret = -1; ret = -1;
} }
} }
return ret; return ret;
} }
void void
@ -253,7 +252,7 @@ PluginInsert::activate ()
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->activate (); (*i)->activate ();
} }
Processor::activate (); Processor::activate ();
} }
@ -270,9 +269,9 @@ PluginInsert::deactivate ()
void void
PluginInsert::flush () PluginInsert::flush ()
{ {
for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->flush (); (*i)->flush ();
} }
} }
void void
@ -385,7 +384,7 @@ PluginInsert::silence (framecnt_t nframes)
if (!active ()) { if (!active ()) {
return; return;
} }
ChanMapping in_map(input_streams()); ChanMapping in_map(input_streams());
ChanMapping out_map(output_streams()); ChanMapping out_map(output_streams());
@ -393,7 +392,7 @@ PluginInsert::silence (framecnt_t nframes)
/* fix the input mapping so that we have maps for each of the plugin's inputs */ /* fix the input mapping so that we have maps for each of the plugin's inputs */
in_map = ChanMapping (natural_input_streams ()); in_map = ChanMapping (natural_input_streams ());
} }
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
(*i)->connect_and_run (_session.get_silent_buffers ((*i)->get_info()->n_inputs), in_map, out_map, nframes, 0); (*i)->connect_and_run (_session.get_silent_buffers ((*i)->get_info()->n_inputs), in_map, out_map, nframes, 0);
} }
@ -438,7 +437,7 @@ PluginInsert::set_parameter (Evoral::Parameter param, float val)
{ {
if (param.type() != PluginAutomation) { if (param.type() != PluginAutomation) {
return; return;
} }
/* the others will be set from the event triggered by this */ /* the others will be set from the event triggered by this */
@ -612,19 +611,19 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
ChanCount inputs = _plugins[0]->get_info()->n_inputs; ChanCount inputs = _plugins[0]->get_info()->n_inputs;
ChanCount outputs = _plugins[0]->get_info()->n_outputs; ChanCount outputs = _plugins[0]->get_info()->n_outputs;
bool no_inputs = true; bool no_inputs = true;
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
if (inputs.get (*t) != 0) { if (inputs.get (*t) != 0) {
no_inputs = false; no_inputs = false;
break; break;
} }
} }
if (no_inputs) { if (no_inputs) {
/* no inputs so we can take any input configuration since we throw it away */ /* no inputs so we can take any input configuration since we throw it away */
out = outputs; out = outputs;
return true; return true;
} }
// Plugin inputs match requested inputs exactly // Plugin inputs match requested inputs exactly
if (inputs == in) { if (inputs == in) {
@ -633,37 +632,37 @@ PluginInsert::can_support_io_configuration (const ChanCount& in, ChanCount& out)
} }
// See if replication is possible // See if replication is possible
// We allow replication only for plugins with either zero or 1 inputs and outputs // We allow replication only for plugins with either zero or 1 inputs and outputs
// for every valid data type. // for every valid data type.
uint32_t f = 0; uint32_t f = 0;
bool can_replicate = true; bool can_replicate = true;
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
uint32_t nin = inputs.get (*t); uint32_t nin = inputs.get (*t);
// No inputs of this type // No inputs of this type
if (nin == 0 && in.get(*t) == 0) { if (nin == 0 && in.get(*t) == 0) {
continue; continue;
} }
if (nin != 1 || outputs.get (*t) != 1) { if (nin != 1 || outputs.get (*t) != 1) {
can_replicate = false; can_replicate = false;
break; break;
} }
// Potential factor not set yet // Potential factor not set yet
if (f == 0) { if (f == 0) {
f = in.get(*t) / nin; f = in.get(*t) / nin;
} }
// Factor for this type does not match another type, can not replicate // Factor for this type does not match another type, can not replicate
if (f != (in.get(*t) / nin)) { if (f != (in.get(*t) / nin)) {
can_replicate = false; can_replicate = false;
break; break;
} }
} }
if (can_replicate) { if (can_replicate) {
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
out.set (*t, outputs.get(*t) * f); out.set (*t, outputs.get(*t) * f);
@ -765,11 +764,11 @@ PluginInsert::state (bool full)
node.add_child_nocopy (_plugins[0]->get_state()); node.add_child_nocopy (_plugins[0]->get_state());
for (Controls::iterator c = controls().begin(); c != controls().end(); ++c) { for (Controls::iterator c = controls().begin(); c != controls().end(); ++c) {
boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> ((*c).second); boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> ((*c).second);
if (ac) { if (ac) {
node.add_child_nocopy (ac->get_state()); node.add_child_nocopy (ac->get_state());
} }
} }
return node; return node;
} }
@ -777,28 +776,29 @@ PluginInsert::state (bool full)
void void
PluginInsert::set_control_ids (const XMLNode& node, int version) PluginInsert::set_control_ids (const XMLNode& node, int version)
{ {
const XMLNodeList& nlist = node.children(); const XMLNodeList& nlist = node.children();
XMLNodeConstIterator iter; XMLNodeConstIterator iter;
set<Evoral::Parameter>::const_iterator p; set<Evoral::Parameter>::const_iterator p;
for (iter = nlist.begin(); iter != nlist.end(); ++iter) { for (iter = nlist.begin(); iter != nlist.end(); ++iter) {
if ((*iter)->name() == Controllable::xml_node_name) { if ((*iter)->name() == Controllable::xml_node_name) {
const XMLProperty* prop; const XMLProperty* prop;
if ((prop = (*iter)->property (X_("parameter"))) != 0) { if ((prop = (*iter)->property (X_("parameter"))) != 0) {
uint32_t p = atoi (prop->value()); uint32_t p = atoi (prop->value());
boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p)); boost::shared_ptr<Evoral::Control> c = control (Evoral::Parameter (PluginAutomation, 0, p));
if (!c) { if (!c) {
continue; continue;
} }
boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> (c); boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> (c);
if (ac) { if (ac) {
ac->set_state (**iter, version); ac->set_state (**iter, version);
} }
} }
} }
} }
} }
int int
PluginInsert::set_state(const XMLNode& node, int version) PluginInsert::set_state(const XMLNode& node, int version)
{ {
@ -834,11 +834,11 @@ PluginInsert::set_state(const XMLNode& node, int version)
#ifdef VST_SUPPORT #ifdef VST_SUPPORT
/* older sessions contain VST plugins with only an "id" field. /* older sessions contain VST plugins with only an "id" field.
*/ */
if (type == ARDOUR::VST) { if (type == ARDOUR::VST) {
prop = node.property ("id"); prop = node.property ("id");
} }
#endif #endif
/* recheck */ /* recheck */
if (prop == 0) { if (prop == 0) {
@ -883,7 +883,7 @@ PluginInsert::set_state(const XMLNode& node, int version)
if (need_automatables) { if (need_automatables) {
set_automatable (); set_automatable ();
set_control_ids (node, version); set_control_ids (node, version);
} }
/* Handle the node list for this Processor (or Insert if an A2 session) */ /* Handle the node list for this Processor (or Insert if an A2 session) */
@ -898,13 +898,13 @@ PluginInsert::set_state(const XMLNode& node, int version)
} }
} }
Processor::set_state (node, version); Processor::set_state (node, version);
if (version < 3000) { if (version < 3000) {
/* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above /* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above
this is all handled by Automatable this is all handled by Automatable
*/ */
for (niter = nlist.begin(); niter != nlist.end(); ++niter) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == "Redirect") { if ((*niter)->name() == "Redirect") {
@ -913,14 +913,14 @@ PluginInsert::set_state(const XMLNode& node, int version)
break; break;
} }
} }
set_parameter_state_2X (node, version); set_parameter_state_2X (node, version);
} }
// The name of the PluginInsert comes from the plugin, nothing else // The name of the PluginInsert comes from the plugin, nothing else
_name = plugin->get_info()->name; _name = plugin->get_info()->name;
/* catch up on I/O */ /* catch up on I/O */
{ {
Glib::Mutex::Lock em (_session.engine().process_lock()); Glib::Mutex::Lock em (_session.engine().process_lock());
@ -937,7 +937,7 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
XMLNodeIterator niter; XMLNodeIterator niter;
/* look for port automation node */ /* look for port automation node */
for (niter = nlist.begin(); niter != nlist.end(); ++niter) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() != port_automation_node_name) { if ((*niter)->name() != port_automation_node_name) {
@ -954,18 +954,18 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
cnodes = (*niter)->children ("port"); cnodes = (*niter)->children ("port");
for (iter = cnodes.begin(); iter != cnodes.end(); ++iter){ for (iter = cnodes.begin(); iter != cnodes.end(); ++iter){
child = *iter; child = *iter;
if ((cprop = child->property("number")) != 0) { if ((cprop = child->property("number")) != 0) {
port = cprop->value().c_str(); port = cprop->value().c_str();
} else { } else {
warning << _("PluginInsert: Auto: no ladspa port number") << endmsg; warning << _("PluginInsert: Auto: no ladspa port number") << endmsg;
continue; continue;
} }
sscanf (port, "%" PRIu32, &port_id); sscanf (port, "%" PRIu32, &port_id);
if (port_id >= _plugins[0]->parameter_count()) { if (port_id >= _plugins[0]->parameter_count()) {
warning << _("PluginInsert: Auto: port id out of range") << endmsg; warning << _("PluginInsert: Auto: port id out of range") << endmsg;
continue; continue;
@ -995,7 +995,7 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
if (min_y == FLT_MIN) { if (min_y == FLT_MIN) {
min_y = desc.lower; min_y = desc.lower;
} }
if (max_y == FLT_MAX) { if (max_y == FLT_MAX) {
max_y = desc.upper; max_y = desc.upper;
} }
@ -1006,11 +1006,11 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
error << string_compose (_("PluginInsert: automatable control %1 not found - ignored"), port_id) << endmsg; error << string_compose (_("PluginInsert: automatable control %1 not found - ignored"), port_id) << endmsg;
} }
} }
/* done */ /* done */
break; break;
} }
} }
@ -1019,7 +1019,7 @@ PluginInsert::describe_parameter (Evoral::Parameter param)
{ {
if (param.type() != PluginAutomation) { if (param.type() != PluginAutomation) {
return Automatable::describe_parameter(param); return Automatable::describe_parameter(param);
} }
return _plugins[0]->describe_parameter (param); return _plugins[0]->describe_parameter (param);
} }
@ -1074,7 +1074,7 @@ PluginInsert::PluginControl::set_value (double user_val)
double double
PluginInsert::PluginControl::user_to_plugin (double val) const PluginInsert::PluginControl::user_to_plugin (double val) const
{ {
/* no known transformations at this time */ /* no known transformations at this time */
return val; return val;
} }
@ -1112,20 +1112,20 @@ PluginInsert::PluginControl::plugin_to_ui (double val) const
double double
PluginInsert::PluginControl::plugin_to_user (double val) const PluginInsert::PluginControl::plugin_to_user (double val) const
{ {
/* no known transformations at this time */ /* no known transformations at this time */
return val; return val;
} }
XMLNode& XMLNode&
PluginInsert::PluginControl::get_state () PluginInsert::PluginControl::get_state ()
{ {
stringstream ss; stringstream ss;
XMLNode& node (AutomationControl::get_state()); XMLNode& node (AutomationControl::get_state());
ss << parameter().id(); ss << parameter().id();
node.add_property (X_("parameter"), ss.str()); node.add_property (X_("parameter"), ss.str());
return node; return node;
} }
/** @return `user' val */ /** @return `user' val */
@ -1187,7 +1187,7 @@ PluginInsert::set_splitting (bool s)
if (_splitting == s) { if (_splitting == s) {
return; return;
} }
_splitting = s; _splitting = s;
SplittingChanged (); /* EMIT SIGNAL */ SplittingChanged (); /* EMIT SIGNAL */
} }