diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-23 17:20:28 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-23 17:20:28 +0100 |
commit | 60686a7b37707600e97b1d3b5e2e2edd7e0ebc03 (patch) | |
tree | f0879b539af97bef84e95ae9149ca085ff5f2ab1 /libs/ardour/monitor_processor.cc | |
parent | c97116083fd51e1d3108cabf92c890c45292fbab (diff) |
NO-OP: whitespace
Diffstat (limited to 'libs/ardour/monitor_processor.cc')
-rw-r--r-- | libs/ardour/monitor_processor.cc | 444 |
1 files changed, 221 insertions, 223 deletions
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc index b4e996a52e..42a23a7b4d 100644 --- a/libs/ardour/monitor_processor.cc +++ b/libs/ardour/monitor_processor.cc @@ -45,39 +45,39 @@ namespace ARDOUR { } MonitorProcessor::MonitorProcessor (Session& s) - : Processor (s, X_("MonitorOut")) - , solo_cnt (0) - , _monitor_active (false) - - , _dim_all_ptr (new MPControl<bool> (false, _("monitor dim"), Controllable::Toggle)) - , _cut_all_ptr (new MPControl<bool> (false, _("monitor cut"), Controllable::Toggle)) - , _mono_ptr (new MPControl<bool> (false, _("monitor mono"), Controllable::Toggle)) - , _dim_level_ptr (new MPControl<volatile gain_t> - /* default is -12dB, range is -20dB to 0dB */ - (dB_to_coefficient(-12.0), _("monitor dim level"), Controllable::Flag (0), - dB_to_coefficient(-20.0), dB_to_coefficient (0.0))) - , _solo_boost_level_ptr (new MPControl<volatile gain_t> - /* default is 0dB, range is 0dB to +20dB */ - (dB_to_coefficient(0.0), _("monitor solo boost level"), Controllable::Flag (0), - dB_to_coefficient(0.0), dB_to_coefficient(10.0))) - , _dim_all_control (_dim_all_ptr) - , _cut_all_control (_cut_all_ptr) - , _mono_control (_mono_ptr) - , _dim_level_control (_dim_level_ptr) - , _solo_boost_level_control (_solo_boost_level_ptr) - - , _dim_all (*_dim_all_ptr) - , _cut_all (*_cut_all_ptr) - , _mono (*_mono_ptr) - , _dim_level (*_dim_level_ptr) - , _solo_boost_level (*_solo_boost_level_ptr) + : Processor (s, X_("MonitorOut")) + , solo_cnt (0) + , _monitor_active (false) + + , _dim_all_ptr (new MPControl<bool> (false, _("monitor dim"), Controllable::Toggle)) + , _cut_all_ptr (new MPControl<bool> (false, _("monitor cut"), Controllable::Toggle)) + , _mono_ptr (new MPControl<bool> (false, _("monitor mono"), Controllable::Toggle)) + , _dim_level_ptr (new MPControl<volatile gain_t> + /* default is -12dB, range is -20dB to 0dB */ + (dB_to_coefficient(-12.0), _("monitor dim level"), Controllable::Flag (0), + dB_to_coefficient(-20.0), dB_to_coefficient (0.0))) + , _solo_boost_level_ptr (new MPControl<volatile gain_t> + /* default is 0dB, range is 0dB to +20dB */ + (dB_to_coefficient(0.0), _("monitor solo boost level"), Controllable::Flag (0), + dB_to_coefficient(0.0), dB_to_coefficient(10.0))) + , _dim_all_control (_dim_all_ptr) + , _cut_all_control (_cut_all_ptr) + , _mono_control (_mono_ptr) + , _dim_level_control (_dim_level_ptr) + , _solo_boost_level_control (_solo_boost_level_ptr) + + , _dim_all (*_dim_all_ptr) + , _cut_all (*_cut_all_ptr) + , _mono (*_mono_ptr) + , _dim_level (*_dim_level_ptr) + , _solo_boost_level (*_solo_boost_level_ptr) { } MonitorProcessor::~MonitorProcessor () { - allocate_channels (0); + allocate_channels (0); /* special case for MPControl */ _dim_all_control->DropReferences (); /* EMIT SIGNAL */ @@ -90,135 +90,135 @@ MonitorProcessor::~MonitorProcessor () void MonitorProcessor::allocate_channels (uint32_t size) { - while (_channels.size() > size) { - if (_channels.back()->soloed) { - if (solo_cnt > 0) { - --solo_cnt; - } - } - ChannelRecord* cr = _channels.back(); - _channels.pop_back(); - delete cr; - } + while (_channels.size() > size) { + if (_channels.back()->soloed) { + if (solo_cnt > 0) { + --solo_cnt; + } + } + ChannelRecord* cr = _channels.back(); + _channels.pop_back(); + delete cr; + } - uint32_t n = _channels.size() + 1; + uint32_t n = _channels.size() + 1; - while (_channels.size() < size) { - _channels.push_back (new ChannelRecord (n)); - } + while (_channels.size() < size) { + _channels.push_back (new ChannelRecord (n)); + } } int MonitorProcessor::set_state (const XMLNode& node, int version) { - int ret = Processor::set_state (node, version); + int ret = Processor::set_state (node, version); - if (ret != 0) { - return ret; - } + if (ret != 0) { + return ret; + } - std::string type_name; - if (!node.get_property (X_("type"), type_name)) { - error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings have no type information")) - << endmsg; - return -1; - } + std::string type_name; + if (!node.get_property (X_("type"), type_name)) { + error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings have no type information")) + << endmsg; + return -1; + } - if (type_name != X_("monitor")) { - error << string_compose (X_("programming error: %1"), X_("MonitorProcessor given unknown XML settings")) - << endmsg; - return -1; - } + if (type_name != X_("monitor")) { + error << string_compose (X_("programming error: %1"), X_("MonitorProcessor given unknown XML settings")) + << endmsg; + return -1; + } - uint32_t channels = 0; - if (!node.get_property (X_("channels"), channels)) { - error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings are missing a channel cnt")) - << endmsg; - return -1; - } + uint32_t channels = 0; + if (!node.get_property (X_("channels"), channels)) { + error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings are missing a channel cnt")) + << endmsg; + return -1; + } - allocate_channels (channels); + allocate_channels (channels); - // need to check that these conversions are working as expected - gain_t val; - if (node.get_property (X_("dim-level"), val)) { - _dim_level = val; - } + // need to check that these conversions are working as expected + gain_t val; + if (node.get_property (X_("dim-level"), val)) { + _dim_level = val; + } - if (node.get_property (X_("solo-boost-level"), val)) { - _solo_boost_level = val; - } + if (node.get_property (X_("solo-boost-level"), val)) { + _solo_boost_level = val; + } - bool bool_val; - if (node.get_property (X_("cut-all"), bool_val)) { - _cut_all = bool_val; - } + bool bool_val; + if (node.get_property (X_("cut-all"), bool_val)) { + _cut_all = bool_val; + } - if (node.get_property (X_("dim-all"), bool_val)) { - _dim_all = bool_val; - } + if (node.get_property (X_("dim-all"), bool_val)) { + _dim_all = bool_val; + } - if (node.get_property (X_("mono"), bool_val)) { - _mono = bool_val; - } + if (node.get_property (X_("mono"), bool_val)) { + _mono = bool_val; + } - for (XMLNodeList::const_iterator i = node.children().begin(); i != node.children().end(); ++i) { - - if ((*i)->name() == X_("Channel")) { - - uint32_t chn; - if (!(*i)->get_property (X_("id"), chn)) { - error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings are missing an ID")) - << endmsg; - return -1; - } - - if (chn >= _channels.size()) { - error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings has an illegal channel count")) - << endmsg; - return -1; - } - ChannelRecord& cr (*_channels[chn]); - - bool gain_coeff_zero; - if ((*i)->get_property ("cut", gain_coeff_zero)) { - if (gain_coeff_zero) { - cr.cut = GAIN_COEFF_ZERO; - } else { - cr.cut = GAIN_COEFF_UNITY; - } - } - - bool dim; - if ((*i)->get_property ("dim", dim)) { - cr.dim = dim; - } - - bool invert_polarity; - if ((*i)->get_property ("invert", invert_polarity)) { - if (invert_polarity) { - cr.polarity = -1.0f; - } else { - cr.polarity = 1.0f; - } - } - - bool soloed; - if ((*i)->get_property ("solo", soloed)) { - cr.soloed = soloed; - } - } - } + for (XMLNodeList::const_iterator i = node.children().begin(); i != node.children().end(); ++i) { - /* reset solo cnt */ + if ((*i)->name() == X_("Channel")) { - solo_cnt = 0; + uint32_t chn; + if (!(*i)->get_property (X_("id"), chn)) { + error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings are missing an ID")) + << endmsg; + return -1; + } - for (vector<ChannelRecord*>::const_iterator x = _channels.begin(); x != _channels.end(); ++x) { - if ((*x)->soloed) { - solo_cnt++; - } - } + if (chn >= _channels.size()) { + error << string_compose (X_("programming error: %1"), X_("MonitorProcessor XML settings has an illegal channel count")) + << endmsg; + return -1; + } + ChannelRecord& cr (*_channels[chn]); + + bool gain_coeff_zero; + if ((*i)->get_property ("cut", gain_coeff_zero)) { + if (gain_coeff_zero) { + cr.cut = GAIN_COEFF_ZERO; + } else { + cr.cut = GAIN_COEFF_UNITY; + } + } + + bool dim; + if ((*i)->get_property ("dim", dim)) { + cr.dim = dim; + } + + bool invert_polarity; + if ((*i)->get_property ("invert", invert_polarity)) { + if (invert_polarity) { + cr.polarity = -1.0f; + } else { + cr.polarity = 1.0f; + } + } + + bool soloed; + if ((*i)->get_property ("solo", soloed)) { + cr.soloed = soloed; + } + } + } + + /* reset solo cnt */ + + solo_cnt = 0; + + for (vector<ChannelRecord*>::const_iterator x = _channels.begin(); x != _channels.end(); ++x) { + if ((*x)->soloed) { + solo_cnt++; + } + } update_monitor_state (); return 0; @@ -246,7 +246,7 @@ MonitorProcessor::state () uint32_t chn = 0; for (vector<ChannelRecord*>::const_iterator x = _channels.begin (); x != _channels.end (); - ++x, ++chn) { + ++x, ++chn) { chn_node = new XMLNode (X_("Channel")); chn_node->set_property ("id", chn); @@ -266,87 +266,87 @@ MonitorProcessor::state () void MonitorProcessor::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool /*result_required*/) { - uint32_t chn = 0; - gain_t target_gain; - gain_t dim_level_this_time = _dim_level; - gain_t global_cut = (_cut_all ? GAIN_COEFF_ZERO : GAIN_COEFF_UNITY); - gain_t global_dim = (_dim_all ? dim_level_this_time : GAIN_COEFF_UNITY); - gain_t solo_boost; - - if (_session.listening() || _session.soloing()) { - solo_boost = _solo_boost_level; - } else { - solo_boost = GAIN_COEFF_UNITY; - } + uint32_t chn = 0; + gain_t target_gain; + gain_t dim_level_this_time = _dim_level; + gain_t global_cut = (_cut_all ? GAIN_COEFF_ZERO : GAIN_COEFF_UNITY); + gain_t global_dim = (_dim_all ? dim_level_this_time : GAIN_COEFF_UNITY); + gain_t solo_boost; + + if (_session.listening() || _session.soloing()) { + solo_boost = _solo_boost_level; + } else { + solo_boost = GAIN_COEFF_UNITY; + } - for (BufferSet::audio_iterator b = bufs.audio_begin(); b != bufs.audio_end(); ++b) { + for (BufferSet::audio_iterator b = bufs.audio_begin(); b != bufs.audio_end(); ++b) { - /* don't double-scale by both track dim and global dim coefficients */ + /* don't double-scale by both track dim and global dim coefficients */ - gain_t dim_level = (global_dim == GAIN_COEFF_UNITY ? (_channels[chn]->dim ? dim_level_this_time : GAIN_COEFF_UNITY) : GAIN_COEFF_UNITY); + gain_t dim_level = (global_dim == GAIN_COEFF_UNITY ? (_channels[chn]->dim ? dim_level_this_time : GAIN_COEFF_UNITY) : GAIN_COEFF_UNITY); - if (_channels[chn]->soloed) { - target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost; - } else { - if (solo_cnt == 0) { - target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost; - } else { - target_gain = GAIN_COEFF_ZERO; - } - } + if (_channels[chn]->soloed) { + target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost; + } else { + if (solo_cnt == 0) { + target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost; + } else { + target_gain = GAIN_COEFF_ZERO; + } + } - if (target_gain != _channels[chn]->current_gain || target_gain != GAIN_COEFF_UNITY) { + if (target_gain != _channels[chn]->current_gain || target_gain != GAIN_COEFF_UNITY) { - _channels[chn]->current_gain = Amp::apply_gain (*b, _session.nominal_sample_rate(), nframes, _channels[chn]->current_gain, target_gain); - } + _channels[chn]->current_gain = Amp::apply_gain (*b, _session.nominal_sample_rate(), nframes, _channels[chn]->current_gain, target_gain); + } - ++chn; - } + ++chn; + } - if (_mono) { - DEBUG_TRACE (DEBUG::Monitor, "mono-izing\n"); + if (_mono) { + DEBUG_TRACE (DEBUG::Monitor, "mono-izing\n"); - /* chn is now the number of channels, use as a scaling factor when mixing - */ - gain_t scale = 1.f / (float)chn; - BufferSet::audio_iterator b = bufs.audio_begin(); - AudioBuffer& ab (*b); - Sample* buf = ab.data(); + /* chn is now the number of channels, use as a scaling factor when mixing + */ + gain_t scale = 1.f / (float)chn; + BufferSet::audio_iterator b = bufs.audio_begin(); + AudioBuffer& ab (*b); + Sample* buf = ab.data(); - /* scale the first channel */ + /* scale the first channel */ - for (pframes_t n = 0; n < nframes; ++n) { - buf[n] *= scale; - } + for (pframes_t n = 0; n < nframes; ++n) { + buf[n] *= scale; + } - /* add every other channel into the first channel's buffer */ + /* add every other channel into the first channel's buffer */ - ++b; - for (; b != bufs.audio_end(); ++b) { - AudioBuffer& ob (*b); - Sample* obuf = ob.data (); - for (pframes_t n = 0; n < nframes; ++n) { - buf[n] += obuf[n] * scale; - } - } + ++b; + for (; b != bufs.audio_end(); ++b) { + AudioBuffer& ob (*b); + Sample* obuf = ob.data (); + for (pframes_t n = 0; n < nframes; ++n) { + buf[n] += obuf[n] * scale; + } + } - /* copy the first channel to every other channel's buffer */ + /* copy the first channel to every other channel's buffer */ - b = bufs.audio_begin(); - ++b; - for (; b != bufs.audio_end(); ++b) { - AudioBuffer& ob (*b); - Sample* obuf = ob.data (); - memcpy (obuf, buf, sizeof (Sample) * nframes); - } - } + b = bufs.audio_begin(); + ++b; + for (; b != bufs.audio_end(); ++b) { + AudioBuffer& ob (*b); + Sample* obuf = ob.data (); + memcpy (obuf, buf, sizeof (Sample) * nframes); + } + } } bool MonitorProcessor::configure_io (ChanCount in, ChanCount out) { - allocate_channels (in.n_audio()); - return Processor::configure_io (in, out); + allocate_channels (in.n_audio()); + return Processor::configure_io (in, out); } bool @@ -426,51 +426,49 @@ MonitorProcessor::set_dim_all (bool yn) bool MonitorProcessor::display_to_user () const { - return false; + return false; } bool MonitorProcessor::soloed (uint32_t chn) const { - return _channels[chn]->soloed; + return _channels[chn]->soloed; } - bool MonitorProcessor::inverted (uint32_t chn) const { - return _channels[chn]->polarity < 0.0f; + return _channels[chn]->polarity < 0.0f; } - bool MonitorProcessor::cut (uint32_t chn) const { - return _channels[chn]->cut == GAIN_COEFF_ZERO; + return _channels[chn]->cut == GAIN_COEFF_ZERO; } bool MonitorProcessor::dimmed (uint32_t chn) const { - return _channels[chn]->dim; + return _channels[chn]->dim; } bool MonitorProcessor::mono () const { - return _mono; + return _mono; } bool MonitorProcessor::dim_all () const { - return _dim_all; + return _dim_all; } bool MonitorProcessor::cut_all () const { - return _cut_all; + return _cut_all; } void @@ -499,37 +497,37 @@ MonitorProcessor::update_monitor_state () boost::shared_ptr<Controllable> MonitorProcessor::channel_cut_control (uint32_t chn) const { - if (chn < _channels.size()) { - return _channels[chn]->cut_control; - } - return boost::shared_ptr<Controllable>(); + if (chn < _channels.size()) { + return _channels[chn]->cut_control; + } + return boost::shared_ptr<Controllable>(); } boost::shared_ptr<Controllable> MonitorProcessor::channel_dim_control (uint32_t chn) const { - if (chn < _channels.size()) { - return _channels[chn]->dim_control; - } - return boost::shared_ptr<Controllable>(); + if (chn < _channels.size()) { + return _channels[chn]->dim_control; + } + return boost::shared_ptr<Controllable>(); } boost::shared_ptr<Controllable> MonitorProcessor::channel_polarity_control (uint32_t chn) const { - if (chn < _channels.size()) { - return _channels[chn]->polarity_control; - } - return boost::shared_ptr<Controllable>(); + if (chn < _channels.size()) { + return _channels[chn]->polarity_control; + } + return boost::shared_ptr<Controllable>(); } boost::shared_ptr<Controllable> MonitorProcessor::channel_solo_control (uint32_t chn) const { - if (chn < _channels.size()) { - return _channels[chn]->soloed_control; - } - return boost::shared_ptr<Controllable>(); + if (chn < _channels.size()) { + return _channels[chn]->soloed_control; + } + return boost::shared_ptr<Controllable>(); } MonitorProcessor::ChannelRecord::ChannelRecord (uint32_t chn) |