diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-10 17:31:16 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-10 17:31:16 +0000 |
commit | 325671e20afa56f5c796d14ce9bb76146a232f0b (patch) | |
tree | d8eca3efc7d95d013459cee81fa55732a5b6d35d /libs | |
parent | b2bc408cef1715de0009c65ff082c6e914de1991 (diff) |
how about that ... a monitor/main section .. GUI is still unfinished .. several small fixes to processor loading/listen mgmt and a few debug output lines rmeoved. knob images are provisional, and can be found in icons/knob.png and related files
git-svn-id: svn://localhost/ardour2/branches/3.0@6744 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/amp.cc | 68 | ||||
-rw-r--r-- | libs/ardour/ardour/amp.h | 3 | ||||
-rw-r--r-- | libs/ardour/ardour/internal_send.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/monitor_processor.h | 87 | ||||
-rw-r--r-- | libs/ardour/ardour/processor.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/monitor_processor.cc | 221 | ||||
-rw-r--r-- | libs/ardour/processor.cc | 7 | ||||
-rw-r--r-- | libs/ardour/route.cc | 59 | ||||
-rw-r--r-- | libs/ardour/send.cc | 1 | ||||
-rw-r--r-- | libs/ardour/session.cc | 74 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 8 | ||||
-rw-r--r-- | libs/ardour/wscript | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/wscript | 1 |
16 files changed, 492 insertions, 61 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index ddcb3f84db..35b567688c 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -179,10 +179,10 @@ Amp::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, n void Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target) { - /** Apply a (potentially) declicked gain to the audio buffers of @a bufs + /** Apply a (potentially) declicked gain to the buffers of @a bufs */ - if (nframes == 0 || bufs.count().n_audio() == 0) { + if (nframes == 0 || bufs.count().n_total() == 0) { return; } @@ -196,7 +196,6 @@ Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t targ gain_t delta; double fractional_shift = -1.0/declick; double fractional_pos; - gain_t polscale = 1.0f; if (target < initial) { /* fade out: remove more and more of delta from initial */ @@ -232,7 +231,7 @@ Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t targ fractional_pos = 1.0; for (nframes_t nx = 0; nx < declick; ++nx) { - buffer[nx] *= polscale * (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos)))); + buffer[nx] *= (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos)))); fractional_pos += fractional_shift; } @@ -250,6 +249,57 @@ Amp::apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t targ } void +Amp::apply_gain (AudioBuffer& buf, nframes_t nframes, gain_t initial, gain_t target) +{ + /** Apply a (potentially) declicked gain to the contents of @a buf + */ + + if (nframes == 0) { + return; + } + + // if we don't need to declick, defer to apply_simple_gain + if (initial == target) { + apply_simple_gain (buf, nframes, target); + return; + } + + const nframes_t declick = std::min ((nframes_t)128, nframes); + gain_t delta; + double fractional_shift = -1.0/declick; + double fractional_pos; + + if (target < initial) { + /* fade out: remove more and more of delta from initial */ + delta = -(initial - target); + } else { + /* fade in: add more and more of delta from initial */ + delta = target - initial; + } + + + Sample* const buffer = buf.data(); + + fractional_pos = 1.0; + + for (nframes_t nx = 0; nx < declick; ++nx) { + buffer[nx] *= (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos)))); + fractional_pos += fractional_shift; + } + + /* now ensure the rest of the buffer has the target value applied, if necessary. */ + + if (declick != nframes) { + + if (target == 0.0) { + memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick)); + } else if (target != 1.0) { + apply_gain_to_buffer (&buffer[declick], nframes - declick, target); + } + } +} + +void Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target) { if (target == 0.0) { @@ -289,6 +339,16 @@ Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target) } void +Amp::apply_simple_gain (AudioBuffer& buf, nframes_t nframes, gain_t target) +{ + if (target == 0.0) { + memset (buf.data(), 0, sizeof (Sample) * nframes); + } else if (target != 1.0) { + apply_gain_to_buffer (buf.data(), nframes, target); + } +} + +void Amp::inc_gain (gain_t factor, void *src) { float desired_gain = _gain_control->user_float(); diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 54bd9defe2..4db2292653 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -59,6 +59,9 @@ public: static void apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target); static void apply_simple_gain(BufferSet& bufs, nframes_t nframes, gain_t target); + + static void apply_gain (AudioBuffer& buf, nframes_t nframes, gain_t initial, gain_t target); + static void apply_simple_gain(AudioBuffer& buf, nframes_t nframes, gain_t target); gain_t gain () const { return _gain_control->user_float(); } diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 243106fb54..ad498b852d 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -47,6 +47,7 @@ class InternalSend : public Send void set_block_size (nframes_t); boost::shared_ptr<Route> target_route() const { return _send_to; } + const PBD::ID& target_id() const { return _send_to_id; } private: BufferSet mixbufs; diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h new file mode 100644 index 0000000000..a66338c75b --- /dev/null +++ b/libs/ardour/ardour/monitor_processor.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2010 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_monitor_processor_h__ +#define __ardour_monitor_processor_h__ + +#include <vector> + +#include "pbd/signals.h" + +#include "ardour/types.h" +#include "ardour/processor.h" + +class XMLNode; + +namespace ARDOUR { + +class Session; + +class MonitorProcessor : public Processor +{ + public: + MonitorProcessor (Session&); + MonitorProcessor (Session&, const XMLNode& name); + + bool display_to_user() const; + + void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/, bool /*result_required*/); + + XMLNode& state (bool full); + int set_state (const XMLNode&, int /* version */); + + bool configure_io (ChanCount in, ChanCount out); + bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; + + void set_cut_all (bool); + void set_dim_all (bool); + void set_polarity (uint32_t, bool invert); + void set_cut (uint32_t, bool cut); + void set_dim (uint32_t, bool dim); + void set_solo (uint32_t, bool); + + void set_dim_level (gain_t); + void set_solo_boost_level (gain_t); + + gain_t dim_level() const { return _dim_level; } + gain_t solo_boost_level() const { return _solo_boost_level; } + + bool dimmed (uint32_t chn) const; + bool soloed (uint32_t chn) const; + bool inverted (uint32_t chn) const; + bool cut (uint32_t chn) const; + + PBD::Signal0<void> Changed; + + private: + std::vector<gain_t> current_gain; + std::vector<gain_t> _cut; + std::vector<bool> _dim; + std::vector<gain_t> _polarity; + std::vector<bool> _soloed; + uint32_t solo_cnt; + bool _dim_all; + bool _cut_all; + volatile gain_t _dim_level; + volatile gain_t _solo_boost_level; +}; + +} /* namespace */ + +#endif /* __ardour_monitor_processor_h__ */ diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 2dd78c66f4..95d0c0a286 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2009-2010 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 4157541229..9f7d9d5d5a 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -54,6 +54,7 @@ class Processor; class RouteGroup; class Send; class InternalReturn; +class MonitorProcessor; class Route : public SessionObject, public AutomatableControls, public RouteGroupMember { @@ -80,7 +81,6 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou bool active() const { return _active; } void set_active (bool yn); - static std::string ensure_track_or_route_name(std::string, Session &); std::string comment() { return _comment; } @@ -190,10 +190,11 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou /* special processors */ - boost::shared_ptr<Delivery> control_outs() const { return _control_outs; } - boost::shared_ptr<Delivery> main_outs() const { return _main_outs; } - boost::shared_ptr<InternalReturn> internal_return() const { return _intreturn; } - boost::shared_ptr<Send> internal_send_for (boost::shared_ptr<const Route> target) const; + boost::shared_ptr<Delivery> control_outs() const { return _control_outs; } + boost::shared_ptr<Delivery> main_outs() const { return _main_outs; } + boost::shared_ptr<InternalReturn> internal_return() const { return _intreturn; } + boost::shared_ptr<MonitorProcessor> monitor_control() const { return _monitor_control; } + boost::shared_ptr<Send> internal_send_for (boost::shared_ptr<const Route> target) const; void add_internal_return (); BufferSet* get_return_buffer () const; void release_return_buffer () const; @@ -210,7 +211,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou }; int add_processor (boost::shared_ptr<Processor>, Placement placement, ProcessorStreams* err = 0); - int add_processor (boost::shared_ptr<Processor>, ProcessorList::iterator iter, ProcessorStreams* err = 0); + int add_processor (boost::shared_ptr<Processor>, ProcessorList::iterator iter, ProcessorStreams* err = 0, bool activation_allowed = true); int add_processors (const ProcessorList&, boost::shared_ptr<Processor> before, ProcessorStreams* err = 0); int add_processors (const ProcessorList&, ProcessorList::iterator iter, ProcessorStreams* err = 0); int remove_processor (boost::shared_ptr<Processor>, ProcessorStreams* err = 0); @@ -364,6 +365,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou boost::shared_ptr<Delivery> _main_outs; boost::shared_ptr<Delivery> _control_outs; boost::shared_ptr<InternalReturn> _intreturn; + boost::shared_ptr<MonitorProcessor> _monitor_control; Flag _flags; int _pending_declick; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 7d94515efa..5cb8cbd78f 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -993,8 +993,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::scoped_ptr<SessionDirectory> _session_dir; - void hookup_io (); - void when_engine_running (); + void hookup_io (bool new_session); + void when_engine_running (bool new_session); void graph_reordered (); std::string _current_snapshot_name; diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc new file mode 100644 index 0000000000..b0de25f92b --- /dev/null +++ b/libs/ardour/monitor_processor.cc @@ -0,0 +1,221 @@ +#include "pbd/xml++.h" + +#include "ardour/amp.h" +#include "ardour/dB.h" +#include "ardour/monitor_processor.h" +#include "ardour/session.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace std; + +MonitorProcessor::MonitorProcessor (Session& s) + : Processor (s, X_("MonitorOut")) +{ + solo_cnt = 0; + _cut_all = false; + _dim_all = false; + _dim_level = 0.2; + _solo_boost_level = 1.0; +} + +MonitorProcessor::MonitorProcessor (Session& s, const XMLNode& node) + : Processor (s, node) +{ + set_state (node, Stateful::loading_state_version); +} + +int +MonitorProcessor::set_state (const XMLNode& node, int version) +{ + return Processor::set_state (node, version); +} + +XMLNode& +MonitorProcessor::state (bool full) +{ + XMLNode& node (Processor::state (full)); + + /* this replaces any existing "type" property */ + + node.add_property (X_("type"), X_("monitor")); + + return node; +} + +void +MonitorProcessor::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_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 ? 0.0f : 1.0f); + gain_t global_dim = (_dim_all ? dim_level_this_time : 1.0f); + gain_t solo_boost; + + if (_session.listening() || _session.soloing()) { + solo_boost = _solo_boost_level; + } else { + solo_boost = 1.0; + } + + 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 */ + + gain_t dim_level = (global_dim == 1.0 ? (_dim[chn] ? dim_level_this_time : 1.0) : 1.0); + + if (_soloed[chn]) { + target_gain = _polarity[chn] * _cut[chn] * dim_level * global_cut * global_dim * solo_boost; + } else { + if (solo_cnt == 0) { + target_gain = _polarity[chn] * _cut[chn] * dim_level * global_cut * global_dim * solo_boost; + } else { + target_gain = 0.0; + } + } + + if (target_gain != current_gain[chn] || target_gain != 1.0f) { + + Amp::apply_gain (*b, nframes, current_gain[chn], target_gain); + current_gain[chn] = target_gain; + } + + ++chn; + } +} + +bool +MonitorProcessor::configure_io (ChanCount in, ChanCount out) +{ + uint32_t needed = in.n_audio(); + + while (current_gain.size() > needed) { + current_gain.pop_back (); + _dim.pop_back (); + _cut.pop_back (); + _polarity.pop_back (); + + if (_soloed.back()) { + if (solo_cnt > 0) { + --solo_cnt; + } + } + + _soloed.pop_back (); + } + + while (current_gain.size() < needed) { + current_gain.push_back (1.0); + _dim.push_back (false); + _cut.push_back (1.0); + _polarity.push_back (1.0); + _soloed.push_back (false); + } + + return Processor::configure_io (in, out); +} + +bool +MonitorProcessor::can_support_io_configuration (const ChanCount& in, ChanCount& out) const +{ + return in == out; +} + +void +MonitorProcessor::set_polarity (uint32_t chn, bool invert) +{ + if (invert) { + _polarity[chn] = -1.0f; + } else { + _polarity[chn] = 1.0f; + } +} + +void +MonitorProcessor::set_dim (uint32_t chn, bool yn) +{ + _dim[chn] = yn; +} + +void +MonitorProcessor::set_cut (uint32_t chn, bool yn) +{ + if (yn) { + _cut[chn] = 0.0f; + } else { + _cut[chn] = 1.0f; + } +} + +void +MonitorProcessor::set_solo (uint32_t chn, bool solo) +{ + _soloed[chn] = solo; + + if (solo) { + solo_cnt++; + } else { + if (solo_cnt > 0) { + solo_cnt--; + } + } +} + +void +MonitorProcessor::set_cut_all (bool yn) +{ + _cut_all = yn; +} + +void +MonitorProcessor::set_dim_all (bool yn) +{ + _dim_all = yn; +} + +bool +MonitorProcessor::display_to_user () const +{ + return false; +} + +void +MonitorProcessor::set_dim_level (gain_t val) +{ + _dim_level = val; +} + +void +MonitorProcessor::set_solo_boost_level (gain_t val) +{ + _solo_boost_level = val; +} + +bool +MonitorProcessor::soloed (uint32_t chn) const +{ + return _soloed[chn]; +} + + +bool +MonitorProcessor::inverted (uint32_t chn) const +{ + return _polarity[chn] < 0.0f; +} + + +bool +MonitorProcessor::cut (uint32_t chn) const +{ + return _cut[chn] == 0.0f; +} + +bool +MonitorProcessor::dimmed (uint32_t chn) const +{ + return _dim[chn]; +} + diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 712ca927e5..1abcc57f41 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -84,7 +84,6 @@ Processor::Processor (Session& session, const XMLNode& node) , _display_to_user (true) { set_state (node, Stateful::loading_state_version); - _pending_active = _active; } XMLNode& @@ -167,6 +166,7 @@ Processor::set_state_2X (const XMLNode & node, int /*version*/) if ((prop = (*i)->property ("active")) != 0) { if (_active != string_is_affirmative (prop->value())) { _active = !_active; + _pending_active = _active; ActiveChanged (); /* EMIT_SIGNAL */ } } @@ -238,8 +238,6 @@ Processor::set_state (const XMLNode& node, int version) } if ((prop = node.property ("active")) == 0) { - warning << _("XML node describing a processor is missing the `active' field," - "trying legacy active flag from child node") << endmsg; if (legacy_active) { prop = legacy_active; } else { @@ -250,7 +248,8 @@ Processor::set_state (const XMLNode& node, int version) if (_active != string_is_affirmative (prop->value())) { _active = !_active; - ActiveChanged (); /* EMIT_SIGNAL */ + _pending_active = _active; + ActiveChanged (); /* EMIT_SIGNAL */ } return 0; diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index ccf95c5bf9..41bd1207b5 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -45,6 +45,7 @@ #include "ardour/ladspa_plugin.h" #include "ardour/meter.h" #include "ardour/mix.h" +#include "ardour/monitor_processor.h" #include "ardour/panner.h" #include "ardour/plugin_insert.h" #include "ardour/port.h" @@ -84,12 +85,16 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) _meter.reset (new PeakMeter (_session)); _meter->set_display_to_user (false); + add_processor (_meter, PostFader); - if (_flags & ControlOut) { + if (is_control()) { /* where we listen to tracks */ _intreturn.reset (new InternalReturn (_session)); add_processor (_intreturn, PreFader); + + _monitor_control.reset (new MonitorProcessor (_session)); + add_processor (_monitor_control, PostFader); } _main_outs.reset (new Delivery (_session, _output, _mute_master, _name, Delivery::Main)); @@ -485,7 +490,6 @@ Route::passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, feeding the listen "stream". data will "arrive" into the route from the intreturn processor element. */ - bufs.silence (nframes, 0); } else { @@ -745,7 +749,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, Placement placemen * @a position is used. */ int -Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::iterator iter, ProcessorStreams* err) +Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::iterator iter, ProcessorStreams* err, bool activation_allowed) { ChanCount old_pms = processor_max_streams; @@ -803,8 +807,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite } - if (_control_outs != processor) { - // XXX: do we want to emit the signal here ? change call order. + if (activation_allowed && (processor != _control_outs)) { processor->activate (); } @@ -861,6 +864,20 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter _meter->set_display_to_user (_meter_point == MeterCustom); processor = _meter; + } else if (prop->value() == "monitor") { + + if (_monitor_control) { + if (_monitor_control->set_state (node, Stateful::loading_state_version)) { + return false; + } else { + return true; + } + } + + _monitor_control.reset (new MonitorProcessor (_session)); + _monitor_control->set_state (node, Stateful::loading_state_version); + processor = _monitor_control; + } else if (prop->value() == "amp") { /* amp always exists */ @@ -875,10 +892,25 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter } else if (prop->value() == "intsend") { - processor.reset (new InternalSend (_session, _mute_master, node)); + InternalSend* isend = new InternalSend (_session, _mute_master, node); + + if (_session.control_out() && (isend->target_id() == _session.control_out()->id())) { + _control_outs.reset (isend); + if (_control_outs->active()) { + _control_outs->set_solo_level (1); + } else { + _control_outs->set_solo_level (0); + } + } + + processor.reset (isend); } else if (prop->value() == "intreturn") { + /* a route only has one internal return. If it exists already + just set its state, and return + */ + if (_intreturn) { if (_intreturn->set_state (node, Stateful::loading_state_version)) { return false; @@ -919,7 +951,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter iter = p; } - return (add_processor (processor, iter) == 0); + return (add_processor (processor, iter, 0, false) == 0); } else { error << _("Processor XML node has no type property") << endmsg; @@ -1979,10 +2011,13 @@ Route::_set_state_2X (const XMLNode& node, int version) _meter.reset (new PeakMeter (_session)); add_processor (_meter, PreFader); - if (_flags & ControlOut) { + if (is_control()) { /* where we listen to tracks */ _intreturn.reset (new InternalReturn (_session)); add_processor (_intreturn, PreFader); + + _monitor_control.reset (new MonitorProcessor (_session)); + add_processor (_monitor_control, PostFader); } _main_outs.reset (new Delivery (_session, _output, _mute_master, _name, Delivery::Main)); @@ -2351,6 +2386,11 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a if (route == _session.control_out()) { _control_outs = boost::dynamic_pointer_cast<Delivery>(d); + if (_control_outs->active()) { + _control_outs->set_solo_level (1); + } else { + _control_outs->set_solo_level (0); + } } /* already listening via the specified IO: do nothing */ @@ -2385,11 +2425,8 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a if (route == _session.control_out()) { _control_outs = listener; - /* send to control/listen/monitor bus is active by default */ - listener->activate (); } - add_processor (listener, placement); return 0; diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 89a66afa46..037ae9b043 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -162,7 +162,6 @@ Send::set_state (const XMLNode& node, int version) _bitslot = _session.next_send_id(); } else { sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot); - cerr << this << " scanned " << prop->value() << " to get " << _bitslot << endl; _session.mark_send_id (_bitslot); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index e077e8b570..c38b5a8660 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -483,7 +483,7 @@ Session::set_worst_io_latencies () } void -Session::when_engine_running () +Session::when_engine_running (bool new_session) { string first_physical_output; @@ -644,9 +644,9 @@ Session::when_engine_running () BootMessage (_("Setup signal flow and plugins")); - hookup_io (); + hookup_io (new_session); - if (!no_auto_connect()) { + if (new_session && !no_auto_connect()) { if (_master_out && Config->get_auto_connect_standard_busses()) { @@ -758,7 +758,7 @@ Session::when_engine_running () } void -Session::hookup_io () +Session::hookup_io (bool new_session) { /* stop graph reordering notifications from causing resorts, etc. @@ -771,7 +771,6 @@ Session::hookup_io () /* we delay creating the auditioner till now because it makes its own connections to ports. - the engine has to be running for this to work. */ try { @@ -798,30 +797,34 @@ Session::hookup_io () Delivery::reset_panners (); - /* Connect tracks to listen/solo etc. busses XXX generalize this beyond control_out */ - - if (_control_out) { + /* Connect tracks to monitor/listen bus if there is one. + Note that in an existing session, the internal sends will + already exist, but we want the routes to notice that + they connect to the control out specifically. + */ + if (_control_out) { boost::shared_ptr<RouteList> r = routes.reader (); - - for (RouteList::iterator x = r->begin(); x != r->end(); ++x) { - - if ((*x)->is_control()) { - - /* relax */ - - } else if ((*x)->is_master()) { - - (*x)->listen_via (_control_out, PostFader, false, false); - + for (RouteList::iterator x = r->begin(); x != r->end(); ++x) { + + if ((*x)->is_control()) { + + /* relax */ + + } else if ((*x)->is_master()) { + + /* relax */ + } else { - + + cerr << "Connecting route " << (*x)->name() << " to control outs\n"; + (*x)->listen_via (_control_out, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), false, false); } - } - } + } + } /* Anyone who cares about input state, wake up and do something */ @@ -2078,7 +2081,7 @@ Session::add_routes (RouteList& new_routes, bool save) if ((*x)->is_control()) { /* relax */ } else if ((*x)->is_master()) { - (*x)->listen_via (_control_out, PostFader, false, false); + /* relax */ } else { (*x)->listen_via (_control_out, (Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader), @@ -2394,9 +2397,10 @@ Session::route_solo_changed (void* /*src*/, boost::weak_ptr<Route> wpr) void Session::update_route_solo_state (boost::shared_ptr<RouteList> r) { - /* now figure out if anything that matters is soloed */ + /* now figure out if anything that matters is soloed (or is "listening")*/ bool something_soloed = false; + uint32_t listeners = 0; if (!r) { r = routes.reader(); @@ -2407,14 +2411,20 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) something_soloed = true; break; } + + if (!(*i)->is_hidden() && (*i)->listening()) { + listeners++; + } } - cerr << "something soloed ? " << something_soloed << endl; + if (something_soloed != _non_soloed_outs_muted) { + _non_soloed_outs_muted = something_soloed; + SoloActive (_non_soloed_outs_muted); /* EMIT SIGNAL */ + } - if (something_soloed != _non_soloed_outs_muted) { - _non_soloed_outs_muted = something_soloed; - SoloActive (_non_soloed_outs_muted); /* EMIT SIGNAL */ - } + if (listeners) { + _listen_cnt = listeners; + } } boost::shared_ptr<RouteList> @@ -3291,6 +3301,12 @@ Session::cancel_audition () bool Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) { + if (a->is_control()) { + return true; + } + if (b->is_control()) { + return false; + } return a->order_key(N_("signal")) < b->order_key(N_("signal")); } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 1ab26d4bef..e8b7b12e2f 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -780,8 +780,6 @@ Session::send_full_time_code(nframes_t /*nframes*/) msg[7] = timecode.seconds; msg[8] = timecode.frames; - cerr << "MTC: Sending full time code at " << outbound_mtc_timecode_frame << endl; - // Send message at offset 0, sent time is for the start of this cycle if (_mtc_port->midimsg (msg, sizeof (msg), 0)) { error << _("Session: could not send full MIDI time code") << endmsg; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index f960660555..d6060cf6ad 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -339,7 +339,7 @@ Session::second_stage_init (bool new_session) _engine.Xrun.connect_same_thread (*this, boost::bind (&Session::xrun_recovery, this)); try { - when_engine_running(); + when_engine_running (new_session); } /* handle this one in a different way than all others, so that its clear what happened */ @@ -1046,6 +1046,12 @@ Session::state(bool full_state) RouteList public_order (*r); public_order.sort (cmp); + /* the sort should have put control outs first */ + + if (_control_out) { + assert (_control_out == public_order.front()); + } + for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { if (!(*i)->is_hidden()) { if (full_state) { diff --git a/libs/ardour/wscript b/libs/ardour/wscript index bd3ceeb668..2fd3a013f8 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -123,6 +123,7 @@ libardour_sources = [ 'midi_track.cc', 'midi_ui.cc', 'mix.cc', + 'monitor_processor.cc', 'mtc_slave.cc', 'mtdm.cc', 'mute_master.cc', diff --git a/libs/gtkmm2ext/wscript b/libs/gtkmm2ext/wscript index 46babcc7cf..1f8144294b 100644 --- a/libs/gtkmm2ext/wscript +++ b/libs/gtkmm2ext/wscript @@ -34,6 +34,7 @@ gtkmm2ext_sources = [ 'gtk_ui.cc', 'idle_adjustment.cc', 'keyboard.cc', + 'motionfeedback.cc', 'pixfader.cc', 'pixscroller.cc', 'popup.cc', |