2 Copyright (C) 2000-2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __ardour_route_h__
20 #define __ardour_route_h__
29 #include <boost/shared_ptr.hpp>
30 #include <boost/weak_ptr.hpp>
31 #include <boost/dynamic_bitset.hpp>
32 #include <boost/enable_shared_from_this.hpp>
34 #include <glibmm/threads.h>
35 #include "pbd/fastlog.h"
36 #include "pbd/xml++.h"
38 #include "pbd/stateful.h"
39 #include "pbd/controllable.h"
40 #include "pbd/destructible.h"
42 #include "ardour/ardour.h"
43 #include "ardour/gain_control.h"
44 #include "ardour/instrument_info.h"
45 #include "ardour/io.h"
46 #include "ardour/io_vector.h"
47 #include "ardour/libardour_visibility.h"
48 #include "ardour/types.h"
49 #include "ardour/mute_master.h"
50 #include "ardour/route_group_member.h"
51 #include "ardour/stripable.h"
52 #include "ardour/graphnode.h"
53 #include "ardour/automatable.h"
54 #include "ardour/unknown_processor.h"
56 class RoutePinWindowProxy;
72 class MonitorProcessor;
74 class CapturingProcessor;
78 class LIBARDOUR_API Route : public Stripable, public Automatable, public RouteGroupMember, public GraphNode, public boost::enable_shared_from_this<Route>
82 typedef std::list<boost::shared_ptr<Processor> > ProcessorList;
90 Route (Session&, std::string name, Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
95 boost::shared_ptr<IO> input() const { return _input; }
96 boost::shared_ptr<IO> output() const { return _output; }
97 IOVector all_inputs () const;
98 IOVector all_outputs () const;
100 ChanCount n_inputs() const { return _input->n_ports(); }
101 ChanCount n_outputs() const { return _output->n_ports(); }
103 bool active() const { return _active; }
104 void set_active (bool yn, void *);
106 static std::string ensure_track_or_route_name(std::string, Session &);
108 std::string comment() { return _comment; }
109 void set_comment (std::string str, void *src);
111 bool set_name (const std::string& str);
112 static void set_name_in_state (XMLNode &, const std::string &, bool rename_playlist = true);
114 uint32_t order_key () const;
115 bool has_order_key () const;
116 void set_order_key (uint32_t);
118 bool is_auditioner() const { return _flags & Auditioner; }
119 bool is_master() const { return _flags & MasterOut; }
120 bool is_monitor() const { return _flags & MonitorOut; }
122 virtual MonitorState monitoring_state () const;
123 virtual MeterState metering_state () const;
125 /* these are the core of the API of a Route. see the protected sections as well */
127 virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
128 int declick, bool& need_butler);
130 virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
131 bool state_changing);
133 virtual int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
136 virtual bool can_record() { return false; }
138 virtual void set_record_enabled (bool /*yn*/, PBD::Controllable::GroupControlDisposition) {}
139 virtual bool record_enabled() const { return false; }
140 virtual void set_record_safe (bool /*yn*/, PBD::Controllable::GroupControlDisposition) {}
141 virtual bool record_safe () const {return false; }
142 virtual void nonrealtime_handle_transport_stopped (bool abort, bool did_locate, bool flush_processors);
143 virtual void realtime_handle_transport_stopped () {}
144 virtual void realtime_locate () {}
145 virtual void non_realtime_locate (framepos_t);
146 virtual void set_pending_declick (int);
148 /* end of vfunc-based API */
150 void shift (framepos_t, framecnt_t);
152 void set_gain (gain_t val, PBD::Controllable::GroupControlDisposition);
153 void inc_gain (gain_t delta);
155 void set_trim (gain_t val, PBD::Controllable::GroupControlDisposition);
157 void set_mute_points (MuteMaster::MutePoint);
158 MuteMaster::MutePoint mute_points () const;
161 void set_mute (bool yn, PBD::Controllable::GroupControlDisposition);
163 bool muted_by_others_soloing () const;
164 bool muted_by_others () const;
166 /* controls use set_solo() to modify this route's solo state
169 void set_solo (bool yn, PBD::Controllable::GroupControlDisposition group_override = PBD::Controllable::UseGroup);
170 bool soloed () const { return self_soloed () || soloed_by_others (); }
171 void clear_all_solo_state ();
173 bool soloed_by_others () const { return _soloed_by_others_upstream||_soloed_by_others_downstream; }
174 bool soloed_by_others_upstream () const { return _soloed_by_others_upstream; }
175 bool soloed_by_others_downstream () const { return _soloed_by_others_downstream; }
176 bool self_soloed () const { return _self_solo; }
178 void set_solo_isolated (bool yn, PBD::Controllable::GroupControlDisposition group_override = PBD::Controllable::UseGroup);
179 bool solo_isolated() const;
181 void set_solo_safe (bool yn, PBD::Controllable::GroupControlDisposition group_override = PBD::Controllable::UseGroup);
182 bool solo_safe() const;
184 void set_listen (bool yn, PBD::Controllable::GroupControlDisposition group_override = PBD::Controllable::UseGroup);
185 bool listening_via_monitor () const;
186 void enable_monitor_send ();
188 void set_phase_invert (uint32_t, bool yn);
189 void set_phase_invert (boost::dynamic_bitset<>);
190 bool phase_invert (uint32_t) const;
191 boost::dynamic_bitset<> phase_invert () const;
193 void set_denormal_protection (bool yn);
194 bool denormal_protection() const;
196 void set_meter_point (MeterPoint, bool force = false);
197 bool apply_processor_changes_rt ();
198 void emit_pending_signals ();
199 MeterPoint meter_point() const { return _pending_meter_point; }
201 void set_meter_type (MeterType t) { _meter_type = t; }
202 MeterType meter_type() const { return _meter_type; }
206 boost::shared_ptr<Amp> amp() const { return _amp; }
207 boost::shared_ptr<Amp> trim() const { return _trim; }
208 boost::shared_ptr<PeakMeter> peak_meter() { return _meter; }
209 boost::shared_ptr<const PeakMeter> peak_meter() const { return _meter; }
210 boost::shared_ptr<PeakMeter> shared_peak_meter() const { return _meter; }
211 boost::shared_ptr<DelayLine> delay_line() const { return _delayline; }
213 void flush_processors ();
215 void foreach_processor (boost::function<void(boost::weak_ptr<Processor>)> method) {
216 Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
217 for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
218 method (boost::weak_ptr<Processor> (*i));
222 boost::shared_ptr<Processor> nth_processor (uint32_t n) {
223 Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
224 ProcessorList::iterator i;
225 for (i = _processors.begin(); i != _processors.end() && n; ++i, --n) {}
226 if (i == _processors.end()) {
227 return boost::shared_ptr<Processor> ();
233 boost::shared_ptr<Processor> processor_by_id (PBD::ID) const;
235 boost::shared_ptr<Processor> nth_plugin (uint32_t n) const;
236 boost::shared_ptr<Processor> nth_send (uint32_t n) const;
238 bool has_io_processor_named (const std::string&);
239 ChanCount max_processor_streams () const { return processor_max_streams; }
241 std::list<std::string> unknown_processors () const;
243 RoutePinWindowProxy * pinmgr_proxy () const { return _pinmgr_proxy; }
244 void set_pingmgr_proxy (RoutePinWindowProxy* wp) { _pinmgr_proxy = wp ; }
246 /* special processors */
248 boost::shared_ptr<InternalSend> monitor_send() const { return _monitor_send; }
249 /** the signal processorat at end of the processing chain which produces output */
250 boost::shared_ptr<Delivery> main_outs() const { return _main_outs; }
251 boost::shared_ptr<InternalReturn> internal_return() const { return _intreturn; }
252 boost::shared_ptr<MonitorProcessor> monitor_control() const { return _monitor_control; }
253 boost::shared_ptr<Send> internal_send_for (boost::shared_ptr<const Route> target) const;
254 void add_internal_return ();
255 void add_send_to_internal_return (InternalSend *);
256 void remove_send_from_internal_return (InternalSend *);
257 void listen_position_changed ();
258 boost::shared_ptr<CapturingProcessor> add_export_point(/* Add some argument for placement later */);
260 /** A record of the stream configuration at some point in the processor list.
261 * Used to return where and why an processor list configuration request failed.
263 struct ProcessorStreams {
264 ProcessorStreams(size_t i=0, ChanCount c=ChanCount()) : index(i), count(c) {}
266 uint32_t index; ///< Index of processor where configuration failed
267 ChanCount count; ///< Input requested of processor
270 int add_processor (boost::shared_ptr<Processor>, Placement placement, ProcessorStreams* err = 0, bool activation_allowed = true);
271 int add_processor_by_index (boost::shared_ptr<Processor>, int, ProcessorStreams* err = 0, bool activation_allowed = true);
272 int add_processor (boost::shared_ptr<Processor>, boost::shared_ptr<Processor>, ProcessorStreams* err = 0, bool activation_allowed = true);
273 int add_processors (const ProcessorList&, boost::shared_ptr<Processor>, ProcessorStreams* err = 0);
274 boost::shared_ptr<Processor> before_processor_for_placement (Placement);
275 boost::shared_ptr<Processor> before_processor_for_index (int);
276 bool processors_reorder_needs_configure (const ProcessorList& new_order);
277 /** remove plugin/processor
279 * @param proc processor to remove
280 * @param err error report (index where removal vailed, channel-count why it failed) may be nil
281 * @param need_process_lock if locking is required (set to true, unless called from RT context with lock)
282 * @returns 0 on success
284 int remove_processor (boost::shared_ptr<Processor> proc, ProcessorStreams* err = 0, bool need_process_lock = true);
285 /** replace plugin/processor with another
287 * @param old processor to remove
288 * @param sub processor to substitute the old one with
289 * @param err error report (index where removal vailed, channel-count why it failed) may be nil
290 * @returns 0 on success
292 int replace_processor (boost::shared_ptr<Processor> old, boost::shared_ptr<Processor> sub, ProcessorStreams* err = 0);
293 int remove_processors (const ProcessorList&, ProcessorStreams* err = 0);
294 int reorder_processors (const ProcessorList& new_order, ProcessorStreams* err = 0);
295 void disable_processors (Placement);
296 void disable_processors ();
297 void disable_plugins (Placement);
298 void disable_plugins ();
299 void ab_plugins (bool forward);
300 void clear_processors (Placement);
301 void all_visible_processors_active (bool);
303 bool strict_io () const { return _strict_io; }
304 bool set_strict_io (bool);
305 /** reset plugin-insert configuration to default, disable customizations.
307 * This is equivalent to calling
309 * customize_plugin_insert (proc, 0, unused)
312 * @param proc Processor to reset
313 * @returns true if successful
315 bool reset_plugin_insert (boost::shared_ptr<Processor> proc);
316 /** enable custom plugin-insert configuration
317 * @param proc Processor to customize
318 * @param count number of plugin instances to use (if zero, reset to default)
319 * @param outs output port customization
320 * @param sinks input pins for variable-I/O plugins
321 * @returns true if successful
323 bool customize_plugin_insert (boost::shared_ptr<Processor> proc, uint32_t count, ChanCount outs, ChanCount sinks);
324 bool add_remove_sidechain (boost::shared_ptr<Processor> proc, bool);
325 bool plugin_preset_output (boost::shared_ptr<Processor> proc, ChanCount outs);
327 /* enable sidechain input for a given processor
329 * The sidechain itself is an IO port object with variable number of channels and configured independently.
330 * Adding/removing the port itself however requires reconfiguring the route and is hence
331 * not a plugin operation itself.
333 * @param proc the processor to add sidechain inputs to
334 * @returns true on success
336 bool add_sidechain (boost::shared_ptr<Processor> proc) { return add_remove_sidechain (proc, true); }
337 /* remove sidechain input from given processor
338 * @param proc the processor to remove the sidechain input from
339 * @returns true on success
341 bool remove_sidechain (boost::shared_ptr<Processor> proc) { return add_remove_sidechain (proc, false); }
343 framecnt_t set_private_port_latencies (bool playback) const;
344 void set_public_port_latencies (framecnt_t, bool playback) const;
346 framecnt_t update_signal_latency();
347 virtual void set_latency_compensation (framecnt_t);
349 void set_user_latency (framecnt_t);
350 framecnt_t initial_delay() const { return _initial_delay; }
351 framecnt_t signal_latency() const { return _signal_latency; }
353 PBD::Signal0<void> active_changed;
354 PBD::Signal0<void> denormal_protection_changed;
355 PBD::Signal0<void> comment_changed;
356 PBD::Signal0<void> mute_points_changed;
358 /** track numbers - assigned by session
359 * nubers > 0 indicate tracks (audio+midi)
360 * nubers < 0 indicate busses
361 * zero is reserved for unnumbered special busses.
363 PBD::Signal0<void> track_number_changed;
364 int64_t track_number() const { return _track_number; }
366 void set_track_number(int64_t tn) {
367 if (tn == _track_number) { return; }
369 track_number_changed();
370 PropertyChanged (ARDOUR::Properties::name);
373 enum PluginSetupOptions {
379 static PBD::Signal3<int,boost::shared_ptr<Route>, boost::shared_ptr<PluginInsert>, PluginSetupOptions > PluginSetup;
381 /** the processors have changed; the parameter indicates what changed */
382 PBD::Signal1<void,RouteProcessorChange> processors_changed;
383 PBD::Signal1<void,void*> record_enable_changed;
384 /** the metering point has changed */
385 PBD::Signal0<void> meter_change;
386 PBD::Signal0<void> signal_latency_changed;
387 PBD::Signal0<void> initial_delay_changed;
389 /** Emitted with the process lock held */
390 PBD::Signal0<void> io_changed;
392 /* gui's call this for their own purposes. */
394 PBD::Signal2<void,std::string,void*> gui_changed;
398 XMLNode& get_state();
399 virtual int set_state (const XMLNode&, int version);
400 virtual XMLNode& get_template();
402 XMLNode& get_processor_state ();
403 virtual void set_processor_state (const XMLNode&);
405 int save_as_template (const std::string& path, const std::string& name);
407 PBD::Signal1<void,void*> SelectedChanged;
409 int add_aux_send (boost::shared_ptr<Route>, boost::shared_ptr<Processor>);
410 void remove_aux_or_listen (boost::shared_ptr<Route>);
413 * return true if this route feeds the first argument via at least one
414 * (arbitrarily long) signal pathway.
416 bool feeds (boost::shared_ptr<Route>, bool* via_send_only = 0);
419 * return true if this route feeds the first argument directly, via
420 * either its main outs or a send. This is checked by the actual
421 * connections, rather than by what the graph is currently doing.
423 bool direct_feeds_according_to_reality (boost::shared_ptr<Route>, bool* via_send_only = 0);
426 * return true if this route feeds the first argument directly, via
427 * either its main outs or a send, according to the graph that
428 * is currently being processed.
430 bool direct_feeds_according_to_graph (boost::shared_ptr<Route>, bool* via_send_only = 0);
432 bool feeds_according_to_graph (boost::shared_ptr<Route>);
435 boost::weak_ptr<Route> r;
438 FeedRecord (boost::shared_ptr<Route> rp, bool sendsonly)
440 , sends_only (sendsonly) {}
443 struct FeedRecordCompare {
444 bool operator() (const FeedRecord& a, const FeedRecord& b) const {
449 typedef std::set<FeedRecord,FeedRecordCompare> FedBy;
451 const FedBy& fed_by() const { return _fed_by; }
452 void clear_fed_by ();
453 bool add_fed_by (boost::shared_ptr<Route>, bool sends_only);
455 /* Controls (not all directly owned by the Route) */
457 boost::shared_ptr<AutomationControl> get_control (const Evoral::Parameter& param);
459 class RouteAutomationControl : public AutomationControl {
461 RouteAutomationControl (const std::string& name,
462 AutomationType atype,
463 boost::shared_ptr<AutomationList> alist,
464 boost::shared_ptr<Route> route);
468 void route_set_value (double val) {
469 AutomationControl::set_value (val, Controllable::NoGroup);
472 boost::weak_ptr<Route> _route;
475 class BooleanRouteAutomationControl : public RouteAutomationControl {
477 BooleanRouteAutomationControl (const std::string& name,
478 AutomationType atype,
479 boost::shared_ptr<AutomationList> alist,
480 boost::shared_ptr<Route> route)
481 : RouteAutomationControl (name, atype, alist, route) {}
483 double get_masters_value_locked() const;
487 class GainControllable : public GainControl {
489 GainControllable (Session& session,
491 boost::shared_ptr<Route> route);
493 void set_value (double val, PBD::Controllable::GroupControlDisposition group_override) {
494 boost::shared_ptr<Route> r = _route.lock();
496 /* Route must mediate group control */
497 r->set_control ((AutomationType) parameter().type(), val, group_override);
504 void route_set_value (double val) {
505 GainControl::set_value (val, Controllable::NoGroup);
508 boost::weak_ptr<Route> _route;
511 class SoloControllable : public BooleanRouteAutomationControl {
513 SoloControllable (std::string name, boost::shared_ptr<Route>);
514 void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
515 void set_value_unchecked (double);
516 double get_value () const;
518 /* Export additional API so that objects that only get access
519 * to a Controllable/AutomationControl can do more fine-grained
520 * operations with respect to solo. Obviously, they would need
521 * to dynamic_cast<Route::SoloControllable> first.
523 * Solo state is not representable by a single scalar value,
524 * so this AutomationControl maps set_value() and get_value()
525 * to r->set_self_solo() and r->soloed() respectively. This
526 * means that the Controllable is technically asymmetric. It is
527 * possible to call ::set_value (0.0) to disable (self)solo,
528 * and then call ::get_value() and get a return of 1.0 because
529 * the Route owner is soloed by upstream/downstream.
532 void set_self_solo (bool yn) {
533 boost::shared_ptr<Route> r(_route.lock()); if (r) r->set_self_solo (yn);
535 void mod_solo_by_others_upstream (int32_t delta) {
536 boost::shared_ptr<Route> r(_route.lock()); if (r) r->mod_solo_by_others_upstream (delta);
538 void mod_solo_by_others_downstream (int32_t delta) {
539 boost::shared_ptr<Route> r(_route.lock()); if (r) r->mod_solo_by_others_downstream (delta);
541 bool soloed_by_others () const {
542 boost::shared_ptr<Route> r(_route.lock()); if (r) return r->soloed_by_others(); else return false;
544 bool soloed_by_others_upstream () const {
545 boost::shared_ptr<Route> r(_route.lock()); if (r) return r->soloed_by_others_upstream(); else return false;
547 bool soloed_by_others_downstream () const {
548 boost::shared_ptr<Route> r(_route.lock()); if (r) return r->soloed_by_others_downstream(); else return false;
550 bool self_soloed () const {
551 boost::shared_ptr<Route> r(_route.lock()); if (r) return r->self_soloed(); else return false;
555 void master_changed (bool, PBD::Controllable::GroupControlDisposition);
558 void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
561 struct MuteControllable : public BooleanRouteAutomationControl {
563 MuteControllable (std::string name, boost::shared_ptr<Route>);
564 void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
565 void set_value_unchecked (double);
566 double get_value () const;
568 /* Pretend to change value, but do not affect actual route mute. */
569 void set_superficial_value(bool muted);
571 void master_changed (bool, PBD::Controllable::GroupControlDisposition);
574 boost::weak_ptr<Route> _route;
575 void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
578 class LIBARDOUR_API PhaseControllable : public BooleanRouteAutomationControl {
580 PhaseControllable (std::string name, boost::shared_ptr<Route>);
581 void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
582 /* currently no automation, so no need for set_value_unchecked() */
583 void set_channel (uint32_t);
584 double get_value () const;
585 uint32_t channel() const;
587 uint32_t _current_phase;
588 void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
591 class LIBARDOUR_API SoloIsolateControllable : public BooleanRouteAutomationControl {
593 SoloIsolateControllable (std::string name, boost::shared_ptr<Route>);
594 void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
595 /* currently no automation, so no need for set_value_unchecked() */
596 double get_value () const;
598 void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
601 class LIBARDOUR_API SoloSafeControllable : public BooleanRouteAutomationControl {
603 SoloSafeControllable (std::string name, boost::shared_ptr<Route>);
604 void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
605 /* currently no automation, so no need for set_value_unchecked() */
606 double get_value () const;
608 void _set_value (double, PBD::Controllable::GroupControlDisposition group_override);
611 void set_control (AutomationType, double val, PBD::Controllable::GroupControlDisposition group_override);
613 boost::shared_ptr<AutomationControl> solo_control() const {
614 return _solo_control;
617 boost::shared_ptr<AutomationControl> mute_control() const {
618 return _mute_control;
621 boost::shared_ptr<MuteMaster> mute_master() const {
625 boost::shared_ptr<AutomationControl> solo_isolate_control() const {
626 return _solo_isolate_control;
629 boost::shared_ptr<AutomationControl> solo_safe_control() const {
630 return _solo_safe_control;
633 boost::shared_ptr<AutomationControl> monitoring_control() const {
634 /* tracks override this to provide actual monitoring control;
635 busses have no possible choices except input monitoring.
637 return boost::shared_ptr<AutomationControl> ();
640 /* Route doesn't own these items, but sub-objects that it does own have them
641 and to make UI code a bit simpler, we provide direct access to them
645 boost::shared_ptr<Panner> panner() const; /* may return null */
646 boost::shared_ptr<PannerShell> panner_shell() const;
647 boost::shared_ptr<Pannable> pannable() const;
649 boost::shared_ptr<GainControl> gain_control() const;
650 boost::shared_ptr<AutomationControl> trim_control() const;
651 boost::shared_ptr<AutomationControl> phase_control() const;
654 Return the first processor that accepts has at least one MIDI input
655 and at least one audio output. In the vast majority of cases, this
656 will be "the instrument". This does not preclude other MIDI->audio
657 processors later in the processing chain, but that would be a
658 special case not covered by this utility function.
660 boost::shared_ptr<Processor> the_instrument() const;
661 InstrumentInfo& instrument_info() { return _instrument_info; }
663 /* "well-known" controls for panning. Any or all of these may return
667 boost::shared_ptr<AutomationControl> pan_azimuth_control() const;
668 boost::shared_ptr<AutomationControl> pan_elevation_control() const;
669 boost::shared_ptr<AutomationControl> pan_width_control() const;
670 boost::shared_ptr<AutomationControl> pan_frontback_control() const;
671 boost::shared_ptr<AutomationControl> pan_lfe_control() const;
673 /* "well-known" controls for an EQ in this route. Any or all may
674 * be null. eq_band_cnt() must return 0 if there is no EQ present.
675 * Passing an @param band value >= eq_band_cnt() will guarantee the
676 * return of a null ptr (or an empty string for eq_band_name()).
678 uint32_t eq_band_cnt () const;
679 std::string eq_band_name (uint32_t) const;
680 boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const;
681 boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const;
682 boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const;
683 boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const;
684 boost::shared_ptr<AutomationControl> eq_enable_controllable () const;
685 boost::shared_ptr<AutomationControl> eq_hpf_controllable () const;
687 /* "well-known" controls for a compressor in this route. Any or all may
690 boost::shared_ptr<AutomationControl> comp_enable_controllable () const;
691 boost::shared_ptr<AutomationControl> comp_threshold_controllable () const;
692 boost::shared_ptr<AutomationControl> comp_speed_controllable () const;
693 boost::shared_ptr<AutomationControl> comp_mode_controllable () const;
694 boost::shared_ptr<AutomationControl> comp_makeup_controllable () const;
695 boost::shared_ptr<AutomationControl> comp_redux_controllable () const;
697 /* @param mode must be supplied by the comp_mode_controllable(). All other values
698 * result in undefined behaviour
700 std::string comp_mode_name (uint32_t mode) const;
701 /* @param mode - as for comp mode name. This returns the name for the
702 * parameter/control accessed via comp_speed_controllable(), which can
705 std::string comp_speed_name (uint32_t mode) const;
707 /* "well-known" controls for sends to well-known busses in this route. Any or all may
710 * In Mixbus, these are the sends that connect to the mixbusses.
711 * In Ardour, these are user-created sends that connect to user-created
714 boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const;
715 boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const;
716 /* for the same value of @param n, this returns the name of the send
717 * associated with the pair of controllables returned by the above two methods.
719 std::string send_name (uint32_t n) const;
721 /* well known control that enables/disables sending to the master bus.
723 * In Ardour, this returns null.
724 * In Mixbus, it will return a suitable control, or null depending on
727 boost::shared_ptr<AutomationControl> master_send_enable_controllable () const;
729 void protect_automation ();
732 /* These numbers are taken from MIDI Machine Control,
733 which can only control up to 317 tracks without
734 doing sysex segmentation.
736 MasterBusRemoteControlID = 318,
737 MonitorBusRemoteControlID = 319,
740 void set_remote_control_id (uint32_t id, bool notify_class_listeners = true);
741 uint32_t remote_control_id () const;
742 void set_remote_control_id_explicit (uint32_t order_key);
744 /* for things concerned about *this* route's RID */
746 PBD::Signal0<void> RemoteControlIDChanged;
748 /* for things concerned about *any* route's RID changes */
750 static PBD::Signal0<void> RemoteControlIDChange;
751 static PBD::Signal0<void> SyncOrderKeys;
753 bool has_external_redirects() const;
755 /* can only be executed by a route for which is_monitor() is true
756 * (i.e. the monitor out)
758 void monitor_run (framepos_t start_frame, framepos_t end_frame,
759 pframes_t nframes, int declick);
761 bool slaved_to (boost::shared_ptr<VCA>) const;
762 void vca_assign (boost::shared_ptr<VCA>);
763 void vca_unassign (boost::shared_ptr<VCA>);
766 friend class Session;
768 void catch_up_on_solo_mute_override ();
769 void mod_solo_by_others_upstream (int32_t);
770 void mod_solo_by_others_downstream (int32_t);
771 void curve_reallocate ();
772 virtual void set_block_size (pframes_t nframes);
775 virtual framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&) { return nframes; }
777 void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
779 void passthru (BufferSet&, framepos_t start_frame, framepos_t end_frame,
780 pframes_t nframes, int declick);
782 virtual void write_out_of_band_data (BufferSet& /* bufs */, framepos_t /* start_frame */, framepos_t /* end_frame */,
783 framecnt_t /* nframes */) {}
785 virtual void process_output_buffers (BufferSet& bufs,
786 framepos_t start_frame, framepos_t end_frame,
787 pframes_t nframes, int declick,
788 bool gain_automation_ok);
790 virtual void bounce_process (BufferSet& bufs,
791 framepos_t start_frame, framecnt_t nframes,
792 boost::shared_ptr<Processor> endpoint, bool include_endpoint,
793 bool for_export, bool for_freeze);
795 framecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
796 ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
798 boost::shared_ptr<IO> _input;
799 boost::shared_ptr<IO> _output;
802 framecnt_t _signal_latency;
803 framecnt_t _signal_latency_at_amp_position;
804 framecnt_t _signal_latency_at_trim_position;
805 framecnt_t _initial_delay;
806 framecnt_t _roll_delay;
808 ProcessorList _processors;
809 mutable Glib::Threads::RWLock _processor_lock;
810 boost::shared_ptr<Delivery> _main_outs;
811 boost::shared_ptr<InternalSend> _monitor_send;
812 boost::shared_ptr<InternalReturn> _intreturn;
813 boost::shared_ptr<MonitorProcessor> _monitor_control;
814 boost::shared_ptr<Pannable> _pannable;
818 EmitMeterChanged = 0x01,
819 EmitMeterVisibilityChange = 0x02,
820 EmitRtProcessorChange = 0x04
823 ProcessorList _pending_processor_order;
824 gint _pending_process_reorder; // atomic
825 gint _pending_signals; // atomic
828 int _pending_declick;
829 MeterPoint _meter_point;
830 MeterPoint _pending_meter_point;
831 MeterType _meter_type;
832 boost::dynamic_bitset<> _phase_invert;
834 uint32_t _soloed_by_others_upstream;
835 uint32_t _soloed_by_others_downstream;
837 uint32_t _solo_isolated_by_upstream;
839 void mod_solo_isolated_by_upstream (bool);
841 bool _denormal_protection;
843 bool _recordable : 1;
845 bool _declickable : 1;
847 boost::shared_ptr<SoloControllable> _solo_control;
848 boost::shared_ptr<MuteControllable> _mute_control;
849 boost::shared_ptr<MuteMaster> _mute_master;
850 boost::shared_ptr<PhaseControllable> _phase_control;
851 boost::shared_ptr<SoloIsolateControllable> _solo_isolate_control;
852 boost::shared_ptr<SoloSafeControllable> _solo_safe_control;
854 virtual void act_on_mute () {}
856 std::string _comment;
857 bool _have_internal_generator;
859 DataType _default_type;
862 InstrumentInfo _instrument_info;
864 virtual ChanCount input_streams () const;
867 virtual XMLNode& state(bool);
869 int configure_processors (ProcessorStreams*);
871 void passthru_silence (framepos_t start_frame, framepos_t end_frame,
872 pframes_t nframes, int declick);
874 void silence (framecnt_t);
875 void silence_unlocked (framecnt_t);
877 ChanCount processor_max_streams;
878 ChanCount processor_out_streams;
880 uint32_t pans_required() const;
881 ChanCount n_process_buffers ();
883 virtual void maybe_declick (BufferSet&, framecnt_t, int);
885 boost::shared_ptr<GainControllable> _gain_control;
886 boost::shared_ptr<Amp> _amp;
887 boost::shared_ptr<GainControllable> _trim_control;
888 boost::shared_ptr<Amp> _trim;
889 boost::shared_ptr<PeakMeter> _meter;
890 boost::shared_ptr<DelayLine> _delayline;
892 boost::shared_ptr<Processor> the_instrument_unlocked() const;
895 int set_state_2X (const XMLNode&, int);
896 void set_processor_state_2X (XMLNodeList const &, int);
900 uint32_t _remote_control_id;
902 int64_t _track_number;
904 void input_change_handler (IOChange, void *src);
905 void output_change_handler (IOChange, void *src);
906 void sidechain_change_handler (IOChange, void *src);
908 void processor_selfdestruct (boost::weak_ptr<Processor>);
909 std::vector<boost::weak_ptr<Processor> > selfdestruct_sequence;
910 Glib::Threads::Mutex selfdestruct_lock;
912 bool input_port_count_changing (ChanCount);
913 bool output_port_count_changing (ChanCount);
915 bool _in_configure_processors;
916 bool _initial_io_setup;
917 bool _in_sidechain_setup;
919 int configure_processors_unlocked (ProcessorStreams*, Glib::Threads::RWLock::WriterLock*);
920 bool set_meter_point_unlocked ();
921 void apply_processor_order (const ProcessorList& new_order);
923 std::list<std::pair<ChanCount, ChanCount> > try_configure_processors (ChanCount, ProcessorStreams *);
924 std::list<std::pair<ChanCount, ChanCount> > try_configure_processors_unlocked (ChanCount, ProcessorStreams *);
926 bool add_processor_from_xml_2X (const XMLNode&, int);
928 void placement_range (Placement p, ProcessorList::iterator& start, ProcessorList::iterator& end);
930 void set_self_solo (bool yn);
931 void set_mute_master_solo ();
933 void set_processor_positions ();
934 framecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, framecnt_t) const;
936 void setup_invisible_processors ();
939 void set_plugin_state_dir (boost::weak_ptr<Processor>, const std::string&);
941 boost::shared_ptr<CapturingProcessor> _capturing_processor;
943 /** A handy class to keep processor state while we attempt a reconfiguration
946 class ProcessorState {
948 ProcessorState (Route* r)
950 , _processors (r->_processors)
951 , _processor_max_streams (r->processor_max_streams)
955 _route->_processors = _processors;
956 _route->processor_max_streams = _processor_max_streams;
960 /* this should perhaps be a shared_ptr, but ProcessorStates will
961 not hang around long enough for it to matter.
964 ProcessorList _processors;
965 ChanCount _processor_max_streams;
968 friend class ProcessorState;
972 /* no copy construction */
973 Route (Route const &);
975 void maybe_note_meter_position ();
977 /** true if we've made a note of a custom meter position in these variables */
978 bool _custom_meter_position_noted;
979 /** the processor that came after the meter when it was last set to a custom position,
982 boost::weak_ptr<Processor> _processor_after_last_custom_meter;
983 RoutePinWindowProxy *_pinmgr_proxy;
985 void reset_instrument_info ();
987 void set_remote_control_id_internal (uint32_t id, bool notify_class_listeners = true);
990 } // namespace ARDOUR
992 #endif /* __ardour_route_h__ */