From 148c1f805bca9d459d9a24a6b5c8d5f277680a9e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Mar 2011 21:53:10 +0000 Subject: Fix broken indentation. git-svn-id: svn://localhost/ardour2/branches/3.0@9151 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_diskstream.cc | 160 ++++---- libs/ardour/port.cc | 261 ++++++------ libs/ardour/route.cc | 863 ++++++++++++++++++++------------------- libs/ardour/session.cc | 329 ++++++++------- libs/ardour/session_transport.cc | 136 +++--- 5 files changed, 888 insertions(+), 861 deletions(-) (limited to 'libs') diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index d7d0b8513a..36d72ce124 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -174,11 +174,11 @@ AudioDiskstream::non_realtime_input_change () remove_channel_from (c, _n_channels.n_audio() - _io->n_ports().n_audio()); } } - + get_input_sources (); set_capture_offset (); - set_align_style_from_io (); - + set_align_style_from_io (); + input_change_pending = IOChange::NoChange; /* implicit unlock */ @@ -223,11 +223,11 @@ AudioDiskstream::get_input_sources () connections.clear (); - cerr << "Getting Nth connection from io " << n << " = " << _io->nth(n) << endl; + cerr << "Getting Nth connection from io " << n << " = " << _io->nth(n) << endl; if (_io->nth (n)->get_connections (connections) == 0) { - cerr << "\tThere were NO connections, apparently ...\n"; + cerr << "\tThere were NO connections, apparently ...\n"; if ((*chan)->source) { // _source->disable_metering (); } @@ -235,7 +235,7 @@ AudioDiskstream::get_input_sources () (*chan)->source = 0; } else { - cerr << "\tThere were some connections, apparently ... to " << connections[0] << endl; + cerr << "\tThere were some connections, apparently ... to " << connections[0] << endl; (*chan)->source = dynamic_cast(_session.engine().get_port_by_name (connections[0]) ); } } @@ -421,7 +421,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca framecnt_t rec_nframes = 0; bool collect_playback = false; - playback_distance = 0; + playback_distance = 0; if (!_io || !_io->active()) { return 0; @@ -433,9 +433,9 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca return 0; } - Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK); + Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK); - if (!sm.locked()) { + if (!sm.locked()) { return 1; } @@ -446,31 +446,31 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca (*chan)->current_playback_buffer = 0; } - /* two conditions to test for here: - - A: this track is rec-enabled, and the session has confirmed that we can record - B: this track is rec-enabled, has been recording, and we are set up for auto-punch-in + /* two conditions to test for here: - The second test is necessary to capture the extra material that arrives AFTER the transport - frame has left the punch range (which will cause the "can_record" argument to be false). - */ + A: this track is rec-enabled, and the session has confirmed that we can record + B: this track is rec-enabled, has been recording, and we are set up for auto-punch-in + + The second test is necessary to capture the extra material that arrives AFTER the transport + frame has left the punch range (which will cause the "can_record" argument to be false). + */ - // Safeguard against situations where process() goes haywire when autopunching - // and last_recordable_frame < first_recordable_frame + // Safeguard against situations where process() goes haywire when autopunching + // and last_recordable_frame < first_recordable_frame + + if (last_recordable_frame < first_recordable_frame) { + last_recordable_frame = max_framepos; + } + + OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); - if (last_recordable_frame < first_recordable_frame) { - last_recordable_frame = max_framepos; - } - - OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); + calculate_record_range (ot, transport_frame, nframes, rec_nframes, rec_offset); - calculate_record_range (ot, transport_frame, nframes, rec_nframes, rec_offset); - - if (rec_nframes && !was_recording) { - capture_captured = 0; - was_recording = true; - } + if (rec_nframes && !was_recording) { + capture_captured = 0; + was_recording = true; + } if (can_record && !_last_capture_sources.empty()) { _last_capture_sources.clear (); @@ -643,9 +643,9 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca ret = 0; - if (commit (nframes)) { - need_butler = true; - } + if (commit (nframes)) { + need_butler = true; + } out: return ret; @@ -1476,7 +1476,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo // cerr << _name << ": there are " << capture_info.size() << " capture_info records\n"; - _playlist->clear_changes (); + _playlist->clear_changes (); _playlist->freeze (); for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) { @@ -1594,8 +1594,8 @@ void AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr c) { was_recording = false; - first_recordable_frame = max_framepos; - last_recordable_frame = max_framepos; + first_recordable_frame = max_framepos; + last_recordable_frame = max_framepos; if (capture_captured == 0) { return; @@ -1724,7 +1724,7 @@ AudioDiskstream::get_state () boost::shared_ptr c = channels.reader(); snprintf (buf, sizeof(buf), "%zd", c->size()); node.add_property ("channels", buf); - + if (!capturing_sources.empty() && _session.get_record_enabled()) { XMLNode* cs_child = new XMLNode (X_("CapturingSources")); @@ -1777,9 +1777,9 @@ AudioDiskstream::set_state (const XMLNode& node, int version) } } - if (Diskstream::set_state (node, version)) { - return -1; - } + if (Diskstream::set_state (node, version)) { + return -1; + } if ((prop = node.property ("channels")) != 0) { nchans = atoi (prop->value().c_str()); @@ -1801,14 +1801,14 @@ AudioDiskstream::set_state (const XMLNode& node, int version) } - - if (!destructive() && capture_pending_node) { - /* destructive streams have one and only one source per channel, - and so they never end up in pending capture in any useful - sense. - */ - use_pending_capture_data (*capture_pending_node); - } + + if (!destructive() && capture_pending_node) { + /* destructive streams have one and only one source per channel, + and so they never end up in pending capture in any useful + sense. + */ + use_pending_capture_data (*capture_pending_node); + } in_set_state = false; @@ -1840,8 +1840,8 @@ AudioDiskstream::use_new_write_source (uint32_t n) ChannelInfo* chan = (*c)[n]; try { - if ((chan->write_source = _session.create_audio_source_for_session (n_channels().n_audio(), - name(), n, destructive())) == 0) { + if ((chan->write_source = _session.create_audio_source_for_session ( + n_channels().n_audio(), name(), n, destructive())) == 0) { throw failed_constructor(); } } @@ -1862,9 +1862,9 @@ AudioDiskstream::use_new_write_source (uint32_t n) list > AudioDiskstream::steal_write_sources() { - /* not possible to steal audio write sources */ - list > ret; - return ret; + /* not possible to steal audio write sources */ + list > ret; + return ret; } void @@ -1891,13 +1891,13 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/) (*chan)->write_source->done_with_peakfile_writes (); } - if ((*chan)->write_source->removable()) { - (*chan)->write_source->mark_for_remove (); - (*chan)->write_source->drop_references (); - } + if ((*chan)->write_source->removable()) { + (*chan)->write_source->mark_for_remove (); + (*chan)->write_source->drop_references (); + } - (*chan)->write_source.reset (); - } + (*chan)->write_source.reset (); + } use_new_write_source (n); @@ -2004,9 +2004,9 @@ AudioDiskstream::set_align_style_from_io () { bool have_physical = false; - if (_alignment_choice != Automatic) { - return; - } + if (_alignment_choice != Automatic) { + return; + } if (_io == 0) { return; @@ -2016,17 +2016,17 @@ AudioDiskstream::set_align_style_from_io () boost::shared_ptr c = channels.reader(); - cerr << "Checking " << c->size() << " for physical connections\n"; + cerr << "Checking " << c->size() << " for physical connections\n"; for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - cerr << "Channel connected via " << (*chan)->source << endl; + cerr << "Channel connected via " << (*chan)->source << endl; if ((*chan)->source && (*chan)->source->flags() & JackPortIsPhysical) { - cerr << "\tchannel has physical connection to " << (*chan)->source->name() << endl; + cerr << "\tchannel has physical connection to " << (*chan)->source->name() << endl; have_physical = true; break; } } - cerr << "\tphysical? " << have_physical << endl; + cerr << "\tphysical? " << have_physical << endl; if (have_physical) { set_align_style (ExistingMaterial); @@ -2039,10 +2039,13 @@ int AudioDiskstream::add_channel_to (boost::shared_ptr c, uint32_t how_many) { while (how_many--) { - c->push_back (new ChannelInfo(_session.butler()->audio_diskstream_playback_buffer_size(), - _session.butler()->audio_diskstream_capture_buffer_size(), - speed_buffer_size, wrap_buffer_size)); - interpolation.add_channel_to (_session.butler()->audio_diskstream_playback_buffer_size(), speed_buffer_size); + c->push_back (new ChannelInfo( + _session.butler()->audio_diskstream_playback_buffer_size(), + _session.butler()->audio_diskstream_capture_buffer_size(), + speed_buffer_size, wrap_buffer_size)); + interpolation.add_channel_to ( + _session.butler()->audio_diskstream_playback_buffer_size(), + speed_buffer_size); } _n_channels.set(DataType::AUDIO, c->size()); @@ -2142,8 +2145,9 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) try { fs = boost::dynamic_pointer_cast ( - SourceFactory::createWritable (DataType::AUDIO, _session, - prop->value(), string(), false, _session.frame_rate())); + SourceFactory::createWritable ( + DataType::AUDIO, _session, + prop->value(), string(), false, _session.frame_rate())); } catch (failed_constructor& err) { @@ -2294,8 +2298,8 @@ AudioDiskstream::adjust_playback_buffering () boost::shared_ptr c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - (*chan)->resize_playback (_session.butler()->audio_diskstream_playback_buffer_size()); - } + (*chan)->resize_playback (_session.butler()->audio_diskstream_playback_buffer_size()); + } } void @@ -2304,8 +2308,8 @@ AudioDiskstream::adjust_capture_buffering () boost::shared_ptr c = channels.reader(); for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { - (*chan)->resize_capture (_session.butler()->audio_diskstream_capture_buffer_size()); - } + (*chan)->resize_capture (_session.butler()->audio_diskstream_capture_buffer_size()); + } } AudioDiskstream::ChannelInfo::ChannelInfo (framecnt_t playback_bufsize, framecnt_t capture_bufsize, framecnt_t speed_size, framecnt_t wrap_size) @@ -2338,7 +2342,7 @@ AudioDiskstream::ChannelInfo::ChannelInfo (framecnt_t playback_bufsize, framecnt void AudioDiskstream::ChannelInfo::resize_playback (framecnt_t playback_bufsize) { - delete playback_buf; + delete playback_buf; playback_buf = new RingBufferNPT (playback_bufsize); memset (playback_buf->buffer(), 0, sizeof (Sample) * playback_buf->bufsize()); } @@ -2346,7 +2350,7 @@ AudioDiskstream::ChannelInfo::resize_playback (framecnt_t playback_bufsize) void AudioDiskstream::ChannelInfo::resize_capture (framecnt_t capture_bufsize) { - delete capture_buf; + delete capture_buf; capture_buf = new RingBufferNPT (capture_bufsize); memset (capture_buf->buffer(), 0, sizeof (Sample) * capture_buf->bufsize()); @@ -2354,7 +2358,7 @@ AudioDiskstream::ChannelInfo::resize_capture (framecnt_t capture_bufsize) AudioDiskstream::ChannelInfo::~ChannelInfo () { - write_source.reset (); + write_source.reset (); delete [] speed_buffer; speed_buffer = 0; diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index a2fe3ab06d..bd3004ba02 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -40,9 +40,9 @@ using namespace ARDOUR; using namespace PBD; AudioEngine* Port::_engine = 0; -bool Port::_connecting_blocked = false; -pframes_t Port::_global_port_buffer_offset = 0; -pframes_t Port::_cycle_nframes = 0; +bool Port::_connecting_blocked = false; +pframes_t Port::_global_port_buffer_offset = 0; +pframes_t Port::_cycle_nframes = 0; /** @param n Port short name */ Port::Port (std::string const & n, DataType t, Flags f) @@ -51,14 +51,14 @@ Port::Port (std::string const & n, DataType t, Flags f) , _flags (f) , _last_monitor (false) { - _private_playback_latency.min = 0; - _private_playback_latency.max = 0; - _private_capture_latency.min = 0; - _private_capture_latency.max = 0; - - /* Unfortunately we have to pass the DataType into this constructor so that we can - create the right kind of JACK port; aside from this we'll use the virtual function type () - to establish type. + _private_playback_latency.min = 0; + _private_playback_latency.max = 0; + _private_capture_latency.min = 0; + _private_capture_latency.max = 0; + + /* Unfortunately we have to pass the DataType into this constructor so that + we can create the right kind of JACK port; aside from this we'll use the + virtual function type () to establish type. */ assert (_name.find_first_of (':') == std::string::npos); @@ -68,7 +68,7 @@ Port::Port (std::string const & n, DataType t, Flags f) } if ((_jack_port = jack_port_register (_engine->jack (), _name.c_str (), t.to_jack_type (), _flags, 0)) == 0) { - cerr << "Failed to register JACK port, reason is unknown from here\n"; + cerr << "Failed to register JACK port, reason is unknown from here\n"; throw failed_constructor (); } } @@ -103,15 +103,16 @@ Port::disconnect_all () bool Port::connected_to (std::string const & o) const { - if (!_engine->connected()) { - /* in some senses, this answer isn't the right one all the time, - because we know about our connections and will re-establish - them when we reconnect to JACK. - */ - return false; - } - - return jack_port_connected_to (_jack_port, _engine->make_port_name_non_relative(o).c_str ()); + if (!_engine->connected()) { + /* in some senses, this answer isn't the right one all the time, + because we know about our connections and will re-establish + them when we reconnect to JACK. + */ + return false; + } + + return jack_port_connected_to (_jack_port, + _engine->make_port_name_non_relative(o).c_str ()); } /** @param o Filled in with port full names of ports that we are connected to */ @@ -120,17 +121,17 @@ Port::get_connections (std::vector & c) const { int n = 0; - if (_engine->connected()) { - const char** jc = jack_port_get_connections (_jack_port); - if (jc) { - for (int i = 0; jc[i]; ++i) { - c.push_back (jc[i]); - ++n; - } + if (_engine->connected()) { + const char** jc = jack_port_get_connections (_jack_port); + if (jc) { + for (int i = 0; jc[i]; ++i) { + c.push_back (jc[i]); + ++n; + } - jack_free (jc); - } - } + jack_free (jc); + } + } return n; } @@ -178,7 +179,7 @@ Port::disconnect (std::string const & other) _connections.erase (other); } - return r; + return r; } @@ -239,118 +240,134 @@ Port::increment_port_buffer_offset (pframes_t nframes) void Port::set_public_latency_range (jack_latency_range_t& range, bool playback) const { - /* this sets the visible latency that the rest of JACK sees. because we do latency - compensation, all (most) of our visible port latency values are identical. - */ + /* this sets the visible latency that the rest of JACK sees. because we do latency + compensation, all (most) of our visible port latency values are identical. + */ - if (!jack_port_set_latency_range) { - return; - } + if (!jack_port_set_latency_range) { + return; + } - DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 %4 PUBLIC latency now [%2 - %3]\n", name(), - range.min, - range.max, - (playback ? "PLAYBACK" : "CAPTURE")));; - - jack_port_set_latency_range (_jack_port, (playback ? JackPlaybackLatency : JackCaptureLatency), &range); + DEBUG_TRACE (DEBUG::Latency, + string_compose ("SET PORT %1 %4 PUBLIC latency now [%2 - %3]\n", + name(), range.min, range.max, + (playback ? "PLAYBACK" : "CAPTURE")));; + + jack_port_set_latency_range (_jack_port, + (playback ? JackPlaybackLatency : JackCaptureLatency), + &range); } void Port::set_private_latency_range (jack_latency_range_t& range, bool playback) { - if (playback) { - _private_playback_latency = range; - DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 playback PRIVATE latency now [%2 - %3]\n", name(), - _private_playback_latency.min, - _private_playback_latency.max)); - } else { - _private_capture_latency = range; - DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 capture PRIVATE latency now [%2 - %3]\n", name(), - _private_capture_latency.min, - _private_capture_latency.max)); - } - - /* push to public (JACK) location so that everyone else can see it */ - - set_public_latency_range (range, playback); + if (playback) { + _private_playback_latency = range; + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "SET PORT %1 playback PRIVATE latency now [%2 - %3]\n", + name(), + _private_playback_latency.min, + _private_playback_latency.max)); + } else { + _private_capture_latency = range; + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "SET PORT %1 capture PRIVATE latency now [%2 - %3]\n", + name(), + _private_capture_latency.min, + _private_capture_latency.max)); + } + + /* push to public (JACK) location so that everyone else can see it */ + + set_public_latency_range (range, playback); } const jack_latency_range_t& Port::private_latency_range (bool playback) const { - if (playback) { - DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1 playback PRIVATE latency now [%2 - %3]\n", name(), - _private_playback_latency.min, - _private_playback_latency.max)); - return _private_playback_latency; - } else { - DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1 capture PRIVATE latency now [%2 - %3]\n", name(), - _private_playback_latency.min, - _private_playback_latency.max)); - return _private_capture_latency; - } + if (playback) { + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "GET PORT %1 playback PRIVATE latency now [%2 - %3]\n", + name(), + _private_playback_latency.min, + _private_playback_latency.max)); + return _private_playback_latency; + } else { + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "GET PORT %1 capture PRIVATE latency now [%2 - %3]\n", + name(), + _private_playback_latency.min, + _private_playback_latency.max)); + return _private_capture_latency; + } } jack_latency_range_t Port::public_latency_range (bool playback) const { - jack_latency_range_t r; - - jack_port_get_latency_range (_jack_port, - sends_output() ? JackPlaybackLatency : JackCaptureLatency, - &r); - DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1: %4 PUBLIC latency range %2 .. %3\n", - name(), r.min, r.max, - sends_output() ? "PLAYBACK" : "CAPTURE")); - return r; + jack_latency_range_t r; + + jack_port_get_latency_range (_jack_port, + sends_output() ? JackPlaybackLatency : JackCaptureLatency, + &r); + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "GET PORT %1: %4 PUBLIC latency range %2 .. %3\n", + name(), r.min, r.max, + sends_output() ? "PLAYBACK" : "CAPTURE")); + return r; } void Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) const { - if (!jack_port_get_latency_range) { - return; - } + if (!jack_port_get_latency_range) { + return; + } - vector connections; - jack_client_t* jack = _engine->jack(); + vector connections; + jack_client_t* jack = _engine->jack(); - if (!jack) { - range.min = 0; - range.max = 0; - PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg; - return; - } + if (!jack) { + range.min = 0; + range.max = 0; + PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg; + return; + } - get_connections (connections); + get_connections (connections); - if (!connections.empty()) { + if (!connections.empty()) { - range.min = ~((jack_nframes_t) 0); - range.max = 0; - - for (vector::iterator c = connections.begin(); c != connections.end(); ++c) { - - cerr << "Connection between " << name() << " and " << *c << endl; - - jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str()); - jack_latency_range_t lr; - - if (remote_port) { - jack_port_get_latency_range (remote_port, (playback ? JackPlaybackLatency : JackCaptureLatency), &lr); - DEBUG_TRACE (DEBUG::Latency, string_compose ("\t%1 <-> %2 : latter has latency range %3 .. %4\n", name(), *c, lr.min, lr.max)); - range.min = min (range.min, lr.min); - range.max = max (range.max, lr.max); - } else { - cerr << "\t NO PORT BY NAME!\n"; - } - } - - } else { + range.min = ~((jack_nframes_t) 0); + range.max = 0; + + for (vector::const_iterator c = connections.begin(); + c != connections.end(); ++c) { + + cerr << "Connection between " << name() << " and " << *c << endl; + + jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str()); + jack_latency_range_t lr; + + if (remote_port) { + jack_port_get_latency_range ( + remote_port, + (playback ? JackPlaybackLatency : JackCaptureLatency), + &lr); + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "\t%1 <-> %2 : latter has latency range %3 .. %4\n", + name(), *c, lr.min, lr.max)); + range.min = min (range.min, lr.min); + range.max = max (range.max, lr.max); + } else { + cerr << "\t NO PORT BY NAME!\n"; + } + } - range.min = 0; - range.max = 0; - } + } else { + range.min = 0; + range.max = 0; + } } int @@ -420,17 +437,17 @@ Port::physically_connected () const if (jc) { for (int i = 0; jc[i]; ++i) { - jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]); + jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]); - if (port && (jack_port_flags (port) & JackPortIsPhysical)) { - jack_free (jc); - return true; - } + if (port && (jack_port_flags (port) & JackPortIsPhysical)) { + jack_free (jc); + return true; + } } jack_free (jc); } - return false; + return false; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index c8c023c0b5..d368198e22 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -83,27 +83,27 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) : SessionObject (sess, name) , Automatable (sess) , GraphNode( sess.route_graph ) - , _active (true) - , _signal_latency (0) - , _initial_delay (0) - , _roll_delay (0) + , _active (true) + , _signal_latency (0) + , _initial_delay (0) + , _roll_delay (0) , _flags (flg) - , _pending_declick (true) - , _meter_point (MeterPostFader) - , _self_solo (false) - , _soloed_by_others_upstream (0) - , _soloed_by_others_downstream (0) - , _solo_isolated (0) - , _denormal_protection (false) - , _recordable (true) - , _silent (false) - , _declickable (false) + , _pending_declick (true) + , _meter_point (MeterPostFader) + , _self_solo (false) + , _soloed_by_others_upstream (0) + , _soloed_by_others_downstream (0) + , _solo_isolated (0) + , _denormal_protection (false) + , _recordable (true) + , _silent (false) + , _declickable (false) , _mute_master (new MuteMaster (sess, name)) - , _have_internal_generator (false) - , _solo_safe (false) + , _have_internal_generator (false) + , _solo_safe (false) , _default_type (default_type) - , _remote_control_id (0) - , _in_configure_processors (false) + , _remote_control_id (0) + , _in_configure_processors (false) { processor_max_streams.reset(); order_keys[N_("signal")] = order_key_cnt++; @@ -112,7 +112,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type) int Route::init () { - /* add standard controls */ + /* add standard controls */ _solo_control.reset (new SoloControllable (X_("solo"), shared_from_this ())); _mute_control.reset (new MuteControllable (X_("mute"), shared_from_this ())); @@ -123,13 +123,13 @@ Route::init () add_control (_solo_control); add_control (_mute_control); - /* panning */ - + /* panning */ + Pannable* p = new Pannable (_session); #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS boost_debug_shared_ptr_mark_interesting (p, "Pannable"); #endif - _pannable.reset (p); + _pannable.reset (p); /* input and output objects */ @@ -162,16 +162,16 @@ Route::init () _intreturn.reset (new InternalReturn (_session)); _intreturn->activate (); - /* the thing that provides proper control over a control/monitor/listen bus - (such as per-channel cut, dim, solo, invert, etc). - */ - _monitor_control.reset (new MonitorProcessor (_session)); + /* the thing that provides proper control over a control/monitor/listen bus + (such as per-channel cut, dim, solo, invert, etc). + */ + _monitor_control.reset (new MonitorProcessor (_session)); _monitor_control->activate (); } - if (is_master() || is_monitor() || is_hidden()) { - _mute_master->set_solo_ignore (true); - } + if (is_master() || is_monitor() || is_hidden()) { + _mute_master->set_solo_ignore (true); + } /* now that we have _meter, its safe to connect to this */ @@ -183,7 +183,7 @@ Route::init () configure_processors (0); } - return 0; + return 0; } Route::~Route () @@ -383,9 +383,9 @@ Route::set_gain (gain_t val, void *src) void Route::maybe_declick (BufferSet&, framecnt_t, int) { - /* this is the "bus" implementation and they never declick. - */ - return; + /* this is the "bus" implementation and they never declick. + */ + return; } /** Process this route for one (sub) cycle (process thread) @@ -409,12 +409,12 @@ Route::process_output_buffers (BufferSet& bufs, bufs.is_silent (false); /* figure out if we're going to use gain automation */ - if (gain_automation_ok) { - _amp->setup_gain_automation (start_frame, end_frame, nframes); - } else { - _amp->apply_gain_automation (false); - } - + if (gain_automation_ok) { + _amp->setup_gain_automation (start_frame, end_frame, nframes); + } else { + _amp->apply_gain_automation (false); + } + /* tell main outs what to do about monitoring */ _main_outs->no_outs_cuz_we_no_monitor (!monitor); @@ -423,7 +423,7 @@ Route::process_output_buffers (BufferSet& bufs, GLOBAL DECLICK (for transport changes etc.) ----------------------------------------------------------------------------------------- */ - maybe_declick (bufs, nframes, declick); + maybe_declick (bufs, nframes, declick); _pending_declick = 0; /* ------------------------------------------------------------------------------------------- @@ -489,21 +489,21 @@ Route::process_output_buffers (BufferSet& bufs, } #ifndef NDEBUG - /* if it has any inputs, make sure they match */ - if ((*i)->input_streams() != ChanCount::ZERO) { - if (bufs.count() != (*i)->input_streams()) { - cerr << _name << " bufs = " << bufs.count() - << " input for " << (*i)->name() << " = " << (*i)->input_streams() - << endl; - abort (); - } - } + /* if it has any inputs, make sure they match */ + if ((*i)->input_streams() != ChanCount::ZERO) { + if (bufs.count() != (*i)->input_streams()) { + cerr << _name << " bufs = " << bufs.count() + << " input for " << (*i)->name() << " = " << (*i)->input_streams() + << endl; + abort (); + } + } #endif - /* should we NOT run plugins here if the route is inactive? - do we catch route != active somewhere higher? - */ + /* should we NOT run plugins here if the route is inactive? + do we catch route != active somewhere higher? + */ - (*i)->run (bufs, start_frame, end_frame, nframes, *i != _processors.back()); + (*i)->run (bufs, start_frame, end_frame, nframes, *i != _processors.back()); bufs.set_count ((*i)->output_streams()); } } @@ -566,18 +566,18 @@ Route::passthru_silence (framepos_t start_frame, framepos_t end_frame, pframes_t void Route::set_listen (bool yn, void* src) { - if (_solo_safe) { - return; - } + if (_solo_safe) { + return; + } if (_monitor_send) { if (yn != _monitor_send->active()) { if (yn) { _monitor_send->activate (); - _mute_master->set_soloed (true); - } else { + _mute_master->set_soloed (true); + } else { _monitor_send->deactivate (); - _mute_master->set_soloed (false); + _mute_master->set_soloed (false); } listen_changed (src); /* EMIT SIGNAL */ @@ -624,7 +624,7 @@ Route::set_solo (bool yn, void *src) if (self_soloed() != yn) { set_self_solo (yn); - set_mute_master_solo (); + set_mute_master_solo (); solo_changed (true, src); /* EMIT SIGNAL */ _solo_control->Changed (); /* EMIT SIGNAL */ } @@ -633,17 +633,17 @@ Route::set_solo (bool yn, void *src) void Route::set_self_solo (bool yn) { - _self_solo = yn; + _self_solo = yn; } void Route::mod_solo_by_others_upstream (int32_t delta) { - if (_solo_safe) { - return; - } + if (_solo_safe) { + return; + } - uint32_t old_sbu = _soloed_by_others_upstream; + uint32_t old_sbu = _soloed_by_others_upstream; if (delta < 0) { if (_soloed_by_others_upstream >= (uint32_t) abs (delta)) { @@ -655,50 +655,51 @@ Route::mod_solo_by_others_upstream (int32_t delta) _soloed_by_others_upstream += delta; } - DEBUG_TRACE (DEBUG::Solo, string_compose ("%1 SbU delta %2 = %3 old = %4 sbd %5 ss %6 exclusive %7\n", - name(), delta, _soloed_by_others_upstream, old_sbu, - _soloed_by_others_downstream, _self_solo, Config->get_exclusive_solo())); - - /* push the inverse solo change to everything that feeds us. - - This is important for solo-within-group. When we solo 1 track out of N that - feed a bus, that track will cause mod_solo_by_upstream (+1) to be called - on the bus. The bus then needs to call mod_solo_by_downstream (-1) on all - tracks that feed it. This will silence them if they were audible because - of a bus solo, but the newly soloed track will still be audible (because - it is self-soloed). - - but .. do this only when we are being told to solo-by-upstream (i.e delta = +1), - not in reverse. - */ - - if ((_self_solo || _soloed_by_others_downstream) && - ((old_sbu == 0 && _soloed_by_others_upstream > 0) || - (old_sbu > 0 && _soloed_by_others_upstream == 0))) { - - if (delta > 0 || !Config->get_exclusive_solo()) { - DEBUG_TRACE (DEBUG::Solo, "\t ... INVERT push\n"); - for (FedBy::iterator i = _fed_by.begin(); i != _fed_by.end(); ++i) { - boost::shared_ptr sr = i->r.lock(); - if (sr) { - sr->mod_solo_by_others_downstream (-delta); - } - } - } - } - - set_mute_master_solo (); - solo_changed (false, this); + DEBUG_TRACE (DEBUG::Solo, string_compose ( + "%1 SbU delta %2 = %3 old = %4 sbd %5 ss %6 exclusive %7\n", + name(), delta, _soloed_by_others_upstream, old_sbu, + _soloed_by_others_downstream, _self_solo, Config->get_exclusive_solo())); + + /* push the inverse solo change to everything that feeds us. + + This is important for solo-within-group. When we solo 1 track out of N that + feed a bus, that track will cause mod_solo_by_upstream (+1) to be called + on the bus. The bus then needs to call mod_solo_by_downstream (-1) on all + tracks that feed it. This will silence them if they were audible because + of a bus solo, but the newly soloed track will still be audible (because + it is self-soloed). + + but .. do this only when we are being told to solo-by-upstream (i.e delta = +1), + not in reverse. + */ + + if ((_self_solo || _soloed_by_others_downstream) && + ((old_sbu == 0 && _soloed_by_others_upstream > 0) || + (old_sbu > 0 && _soloed_by_others_upstream == 0))) { + + if (delta > 0 || !Config->get_exclusive_solo()) { + DEBUG_TRACE (DEBUG::Solo, "\t ... INVERT push\n"); + for (FedBy::iterator i = _fed_by.begin(); i != _fed_by.end(); ++i) { + boost::shared_ptr sr = i->r.lock(); + if (sr) { + sr->mod_solo_by_others_downstream (-delta); + } + } + } + } + + set_mute_master_solo (); + solo_changed (false, this); } void Route::mod_solo_by_others_downstream (int32_t delta) { - if (_solo_safe) { - return; - } + if (_solo_safe) { + return; + } - if (delta < 0) { + if (delta < 0) { if (_soloed_by_others_downstream >= (uint32_t) abs (delta)) { _soloed_by_others_downstream += delta; } else { @@ -708,16 +709,16 @@ Route::mod_solo_by_others_downstream (int32_t delta) _soloed_by_others_downstream += delta; } - DEBUG_TRACE (DEBUG::Solo, string_compose ("%1 SbD delta %2 = %3\n", name(), delta, _soloed_by_others_downstream)); + DEBUG_TRACE (DEBUG::Solo, string_compose ("%1 SbD delta %2 = %3\n", name(), delta, _soloed_by_others_downstream)); - set_mute_master_solo (); - solo_changed (false, this); + set_mute_master_solo (); + solo_changed (false, this); } void Route::set_mute_master_solo () { - _mute_master->set_soloed (self_soloed() || soloed_by_others_downstream() || soloed_by_others_upstream()); + _mute_master->set_soloed (self_soloed() || soloed_by_others_downstream() || soloed_by_others_upstream()); } void @@ -738,8 +739,8 @@ Route::set_solo_isolated (bool yn, void *src) for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { if ((*i).get() == this || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_hidden()) { - continue; - } + continue; + } bool sends_only; bool does_feed = direct_feeds (*i, &sends_only); // we will recurse anyway, so don't use ::feeds() @@ -749,29 +750,29 @@ Route::set_solo_isolated (bool yn, void *src) } } - /* XXX should we back-propagate as well? (April 2010: myself and chris goddard think not) */ + /* XXX should we back-propagate as well? (April 2010: myself and chris goddard think not) */ - bool changed = false; + bool changed = false; if (yn) { - if (_solo_isolated == 0) { - _mute_master->set_solo_ignore (true); - changed = true; - } + if (_solo_isolated == 0) { + _mute_master->set_solo_ignore (true); + changed = true; + } _solo_isolated++; } else { if (_solo_isolated > 0) { _solo_isolated--; - if (_solo_isolated == 0) { - _mute_master->set_solo_ignore (false); - changed = true; - } + if (_solo_isolated == 0) { + _mute_master->set_solo_ignore (false); + changed = true; + } } } - if (changed) { - solo_isolated_changed (src); - } + if (changed) { + solo_isolated_changed (src); + } } bool @@ -783,13 +784,13 @@ Route::solo_isolated () const void Route::set_mute_points (MuteMaster::MutePoint mp) { - _mute_master->set_mute_points (mp); - mute_points_changed (); /* EMIT SIGNAL */ - - if (_mute_master->muted_by_self()) { - mute_changed (this); /* EMIT SIGNAL */ + _mute_master->set_mute_points (mp); + mute_points_changed (); /* EMIT SIGNAL */ + + if (_mute_master->muted_by_self()) { + mute_changed (this); /* EMIT SIGNAL */ _mute_control->Changed (); /* EMIT SIGNAL */ - } + } } void @@ -801,7 +802,7 @@ Route::set_mute (bool yn, void *src) } if (muted() != yn) { - _mute_master->set_muted_by_self (yn); + _mute_master->set_muted_by_self (yn); mute_changed (src); /* EMIT SIGNAL */ _mute_control->Changed (); /* EMIT SIGNAL */ } @@ -810,7 +811,7 @@ Route::set_mute (bool yn, void *src) bool Route::muted () const { - return _mute_master->muted_by_self(); + return _mute_master->muted_by_self(); } #if 0 @@ -856,7 +857,8 @@ Route::add_processor (boost::shared_ptr processor, ProcessorList::ite assert (processor != _meter); assert (processor != _main_outs); - DEBUG_TRACE (DEBUG::Processors, string_compose ("%1 adding processor %2\n", name(), processor->name())); + DEBUG_TRACE (DEBUG::Processors, string_compose ( + "%1 adding processor %2\n", name(), processor->name())); ChanCount old_pms = processor_max_streams; @@ -986,9 +988,9 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version) return false; } - if (processor->set_state (node, version)) { - return false; - } + if (processor->set_state (node, version)) { + return false; + } return (add_processor (processor, placement) == 0); } @@ -1059,7 +1061,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false)); } - + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr pi; @@ -1494,7 +1496,7 @@ Route::configure_processors (ProcessorStreams* err) ChanCount Route::input_streams () const { - return _input->n_ports (); + return _input->n_ports (); } list > @@ -1738,7 +1740,7 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err } } - /* now remove from old order - its taken care of no matter what */ + /* now remove from old order - its taken care of no matter what */ oiter = _processors.erase (oiter); } @@ -1843,7 +1845,7 @@ Route::state(bool full_state) cmt->add_content (_comment); } - node->add_child_nocopy (_pannable->state (full_state)); + node->add_child_nocopy (_pannable->state (full_state)); for (i = _processors.begin(); i != _processors.end(); ++i) { node->add_child_nocopy((*i)->state (full_state)); @@ -1893,9 +1895,9 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) _flags = Flag (0); } - if (is_master() || is_monitor() || is_hidden()) { - _mute_master->set_solo_ignore (true); - } + if (is_master() || is_monitor() || is_hidden()) { + _mute_master->set_solo_ignore (true); + } /* add all processors (except amp, which is always present) */ @@ -1923,9 +1925,9 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) } - if (child->name() == X_("Pannable")) { - _pannable->set_state (*child, version); - } + if (child->name() == X_("Pannable")) { + _pannable->set_state (*child, version); + } } set_processor_state (processor_state); @@ -1968,7 +1970,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) if ((prop = node.property (X_("meter-point"))) != 0) { MeterPoint mp = MeterPoint (string_2_enum (prop->value (), _meter_point)); - set_meter_point (mp, true); + set_meter_point (mp, true); if (_meter) { _meter->set_display_to_user (_meter_point == MeterCustom); } @@ -2274,8 +2276,8 @@ Route::_set_state_2X (const XMLNode& node, int version) _solo_control->set_state (*child, version); } else if (prop->value() == X_("mute")) { _mute_control->set_state (*child, version); - } - + } + } else if (child->name() == X_("RemoteControl")) { if ((prop = child->property (X_("id"))) != 0) { int32_t x; @@ -2319,74 +2321,74 @@ Route::set_processor_state (const XMLNode& node) { const XMLNodeList &nlist = node.children(); XMLNodeConstIterator niter; - ProcessorList new_order; - bool must_configure = false; + ProcessorList new_order; + bool must_configure = false; for (niter = nlist.begin(); niter != nlist.end(); ++niter) { XMLProperty* prop = (*niter)->property ("type"); if (prop->value() == "amp") { - _amp->set_state (**niter, Stateful::current_state_version); - new_order.push_back (_amp); - } else if (prop->value() == "meter") { - _meter->set_state (**niter, Stateful::current_state_version); - } else if (prop->value() == "main-outs") { - _main_outs->set_state (**niter, Stateful::current_state_version); - } else if (prop->value() == "intreturn") { - if (!_intreturn) { - _intreturn.reset (new InternalReturn (_session)); - must_configure = true; - } - _intreturn->set_state (**niter, Stateful::current_state_version); - } else if (is_monitor() && prop->value() == "monitor") { - if (!_monitor_control) { - _monitor_control.reset (new MonitorProcessor (_session)); - must_configure = true; - } - _monitor_control->set_state (**niter, Stateful::current_state_version); + _amp->set_state (**niter, Stateful::current_state_version); + new_order.push_back (_amp); + } else if (prop->value() == "meter") { + _meter->set_state (**niter, Stateful::current_state_version); + } else if (prop->value() == "main-outs") { + _main_outs->set_state (**niter, Stateful::current_state_version); + } else if (prop->value() == "intreturn") { + if (!_intreturn) { + _intreturn.reset (new InternalReturn (_session)); + must_configure = true; + } + _intreturn->set_state (**niter, Stateful::current_state_version); + } else if (is_monitor() && prop->value() == "monitor") { + if (!_monitor_control) { + _monitor_control.reset (new MonitorProcessor (_session)); + must_configure = true; + } + _monitor_control->set_state (**niter, Stateful::current_state_version); } else if (prop->value() == "capture") { _capturing_processor.reset (new CapturingProcessor (_session)); - } else { - ProcessorList::iterator o; + } else { + ProcessorList::iterator o; for (o = _processors.begin(); o != _processors.end(); ++o) { XMLProperty* id_prop = (*niter)->property(X_("id")); if (id_prop && (*o)->id() == id_prop->value()) { - (*o)->set_state (**niter, Stateful::current_state_version); - new_order.push_back (*o); + (*o)->set_state (**niter, Stateful::current_state_version); + new_order.push_back (*o); break; } } - // If the processor (*niter) is not on the route then create it - - if (o == _processors.end()) { - - boost::shared_ptr processor; - - if (prop->value() == "intsend") { - - processor.reset (new InternalSend (_session, _pannable, _mute_master, boost::shared_ptr(), Delivery::Role (0))); - } else if (prop->value() == "ladspa" || prop->value() == "Ladspa" || - prop->value() == "lv2" || - prop->value() == "vst" || - prop->value() == "audiounit") { - - processor.reset (new PluginInsert(_session)); - - } else if (prop->value() == "port") { - - processor.reset (new PortInsert (_session, _pannable, _mute_master)); - - } else if (prop->value() == "send") { - - processor.reset (new Send (_session, _pannable, _mute_master)); - - } else { - error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; - continue; - } + // If the processor (*niter) is not on the route then create it + + if (o == _processors.end()) { + + boost::shared_ptr processor; + + if (prop->value() == "intsend") { + + processor.reset (new InternalSend (_session, _pannable, _mute_master, boost::shared_ptr(), Delivery::Role (0))); + } else if (prop->value() == "ladspa" || prop->value() == "Ladspa" || + prop->value() == "lv2" || + prop->value() == "vst" || + prop->value() == "audiounit") { + + processor.reset (new PluginInsert(_session)); + + } else if (prop->value() == "port") { + + processor.reset (new PortInsert (_session, _pannable, _mute_master)); + + } else if (prop->value() == "send") { + + processor.reset (new Send (_session, _pannable, _mute_master)); + + } else { + error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; + continue; + } if (processor->set_state (**niter, Stateful::current_state_version) != 0) { /* This processor could not be configured. Turn it into a UnknownProcessor */ @@ -2407,22 +2409,22 @@ Route::set_processor_state (const XMLNode& node) new_order.push_back (processor); must_configure = true; - } - } - } + } + } + } { Glib::RWLock::WriterLock lm (_processor_lock); - _processors = new_order; + _processors = new_order; - if (must_configure) { + if (must_configure) { Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); - configure_processors_unlocked (0); - } + configure_processors_unlocked (0); + } for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { - (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false)); + (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false)); boost::shared_ptr pi; @@ -2433,9 +2435,9 @@ Route::set_processor_state (const XMLNode& node) } } } - } + } - processors_changed (RouteProcessorChange ()); + processors_changed (RouteProcessorChange ()); set_processor_positions (); } @@ -2593,7 +2595,7 @@ Route::drop_listen (boost::shared_ptr route) remove_processor (*x, &err); rl.acquire (); - /* list could have been demolished while we dropped the lock + /* list could have been demolished while we dropped the lock so start over. */ @@ -2619,47 +2621,47 @@ Route::set_comment (string cmt, void *src) bool Route::add_fed_by (boost::shared_ptr other, bool via_sends_only) { - FeedRecord fr (other, via_sends_only); + FeedRecord fr (other, via_sends_only); - pair result = _fed_by.insert (fr); + pair result = _fed_by.insert (fr); - if (!result.second) { + if (!result.second) { - /* already a record for "other" - make sure sends-only information is correct */ - if (!via_sends_only && result.first->sends_only) { - FeedRecord* frp = const_cast(&(*result.first)); - frp->sends_only = false; - } - } - - return result.second; + /* already a record for "other" - make sure sends-only information is correct */ + if (!via_sends_only && result.first->sends_only) { + FeedRecord* frp = const_cast(&(*result.first)); + frp->sends_only = false; + } + } + + return result.second; } void Route::clear_fed_by () { - _fed_by.clear (); + _fed_by.clear (); } bool Route::feeds (boost::shared_ptr other, bool* via_sends_only) { - const FedBy& fed_by (other->fed_by()); + const FedBy& fed_by (other->fed_by()); - for (FedBy::iterator f = fed_by.begin(); f != fed_by.end(); ++f) { - boost::shared_ptr sr = f->r.lock(); + for (FedBy::iterator f = fed_by.begin(); f != fed_by.end(); ++f) { + boost::shared_ptr sr = f->r.lock(); - if (sr && (sr.get() == this)) { + if (sr && (sr.get() == this)) { - if (via_sends_only) { - *via_sends_only = f->sends_only; - } + if (via_sends_only) { + *via_sends_only = f->sends_only; + } - return true; - } - } + return true; + } + } - return false; + return false; } bool @@ -2706,7 +2708,7 @@ void Route::nonrealtime_handle_transport_stopped (bool /*abort_ignored*/, bool did_locate, bool can_flush_processors) { framepos_t now = _session.transport_frame(); - + { Glib::RWLock::ReaderLock lm (_processor_lock); @@ -2714,14 +2716,14 @@ Route::nonrealtime_handle_transport_stopped (bool /*abort_ignored*/, bool did_lo automation_snapshot (now, true); } - Automatable::transport_stopped (now); + Automatable::transport_stopped (now); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (!_have_internal_generator && (Config->get_plugins_stop_with_transport() && can_flush_processors)) { - (*i)->flush (); + (*i)->flush (); } - + (*i)->transport_stopped (now); } } @@ -2771,7 +2773,7 @@ Route::output_change_handler (IOChange change, void * /*src*/) already there */ start.set (*i, start.get (*i) + 1); - + _session.auto_connect_route (this, dummy, dummy, false, false, ChanCount(), change.before); } } @@ -2845,18 +2847,18 @@ Route::check_initial_delay (framecnt_t nframes, framecnt_t& transport_frame) silence_unlocked (_roll_delay); transport_frame += _roll_delay; - /* shuffle all the port buffers for things that lead "out" of this Route - to reflect that we just wrote _roll_delay frames of silence. - */ + /* shuffle all the port buffers for things that lead "out" of this Route + to reflect that we just wrote _roll_delay frames of silence. + */ - Glib::RWLock::ReaderLock lm (_processor_lock); - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - boost::shared_ptr iop = boost::dynamic_pointer_cast (*i); - if (iop) { - iop->increment_port_buffer_offset (_roll_delay); - } - } - _output->increment_port_buffer_offset (_roll_delay); + Glib::RWLock::ReaderLock lm (_processor_lock); + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr iop = boost::dynamic_pointer_cast (*i); + if (iop) { + iop->increment_port_buffer_offset (_roll_delay); + } + } + _output->increment_port_buffer_offset (_roll_delay); _roll_delay = 0; @@ -2952,7 +2954,7 @@ Route::flush_processors () Glib::RWLock::ReaderLock lm (_processor_lock); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - (*i)->flush (); + (*i)->flush (); } } @@ -3067,7 +3069,7 @@ Route::update_signal_latency () DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: internal signal latency = %2\n", _name, l)); if (_signal_latency != l) { - _signal_latency = l; + _signal_latency = l; signal_latency_changed (); /* EMIT SIGNAL */ } @@ -3092,8 +3094,10 @@ Route::set_latency_compensation (framecnt_t longest_session_latency) _initial_delay = 0; } - DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: compensate for maximum latency of %2, given own latency of %3, using initial delay of %4\n", - name(), longest_session_latency, _signal_latency, _initial_delay)); + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "%1: compensate for maximum latency of %2," + "given own latency of %3, using initial delay of %4\n", + name(), longest_session_latency, _signal_latency, _initial_delay)); if (_initial_delay != old) { initial_delay_changed (); /* EMIT SIGNAL */ @@ -3107,7 +3111,7 @@ Route::set_latency_compensation (framecnt_t longest_session_latency) void Route::automation_snapshot (framepos_t now, bool force) { - _pannable->automation_snapshot (now, force); + _pannable->automation_snapshot (now, force); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->automation_snapshot (now, force); } @@ -3237,30 +3241,30 @@ void Route::shift (framepos_t pos, framecnt_t frames) { /* gain automation */ - { - boost::shared_ptr gc = _amp->gain_control(); - - XMLNode &before = gc->alist()->get_state (); - gc->alist()->shift (pos, frames); - XMLNode &after = gc->alist()->get_state (); - _session.add_command (new MementoCommand (*gc->alist().get(), &before, &after)); - } + { + boost::shared_ptr gc = _amp->gain_control(); + + XMLNode &before = gc->alist()->get_state (); + gc->alist()->shift (pos, frames); + XMLNode &after = gc->alist()->get_state (); + _session.add_command (new MementoCommand (*gc->alist().get(), &before, &after)); + } /* pan automation */ - { - ControlSet::Controls& c (_pannable->controls()); - - for (ControlSet::Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { - boost::shared_ptr pc = boost::dynamic_pointer_cast (ci->second); - if (pc) { - boost::shared_ptr al = pc->alist(); - XMLNode& before = al->get_state (); - al->shift (pos, frames); - XMLNode& after = al->get_state (); - _session.add_command (new MementoCommand (*al.get(), &before, &after)); - } - } - } + { + ControlSet::Controls& c (_pannable->controls()); + + for (ControlSet::Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { + boost::shared_ptr pc = boost::dynamic_pointer_cast (ci->second); + if (pc) { + boost::shared_ptr al = pc->alist(); + XMLNode& before = al->get_state (); + al->shift (pos, frames); + XMLNode& after = al->get_state (); + _session.add_command (new MementoCommand (*al.get(), &before, &after)); + } + } + } /* redirect automation */ { @@ -3270,16 +3274,16 @@ Route::shift (framepos_t pos, framecnt_t frames) set parameters = (*i)->what_can_be_automated(); for (set::const_iterator p = parameters.begin (); p != parameters.end (); ++p) { - boost::shared_ptr ac = (*i)->automation_control (*p); - if (ac) { - boost::shared_ptr al = ac->alist(); - XMLNode &before = al->get_state (); - al->shift (pos, frames); - XMLNode &after = al->get_state (); - _session.add_command (new MementoCommand (*al.get(), &before, &after)); - } - } - } + boost::shared_ptr ac = (*i)->automation_control (*p); + if (ac) { + boost::shared_ptr al = ac->alist(); + XMLNode &before = al->get_state (); + al->shift (pos, frames); + XMLNode &after = al->get_state (); + _session.add_command (new MementoCommand (*al.get(), &before, &after)); + } + } + } } } @@ -3358,7 +3362,7 @@ Route::set_phase_invert (uint32_t c, bool yn) if (_phase_invert[c] != yn) { _phase_invert[c] = yn; phase_invert_changed (); /* EMIT SIGNAL */ - _session.set_dirty (); + _session.set_dirty (); } } @@ -3368,7 +3372,7 @@ Route::set_phase_invert (boost::dynamic_bitset<> p) if (_phase_invert != p) { _phase_invert = p; phase_invert_changed (); /* EMIT SIGNAL */ - _session.set_dirty (); + _session.set_dirty (); } } @@ -3446,7 +3450,7 @@ Route::pannable() const boost::shared_ptr Route::panner() const { - /* may be null ! */ + /* may be null ! */ return _main_outs->panner_shell()->panner(); } @@ -3529,19 +3533,19 @@ Route::nth_send (uint32_t n) bool Route::has_io_processor_named (const string& name) { - Glib::RWLock::ReaderLock lm (_processor_lock); - ProcessorList::iterator i; - - for (i = _processors.begin(); i != _processors.end(); ++i) { - if (boost::dynamic_pointer_cast (*i) || - boost::dynamic_pointer_cast (*i)) { - if ((*i)->name() == name) { - return true; - } - } - } - - return false; + Glib::RWLock::ReaderLock lm (_processor_lock); + ProcessorList::iterator i; + + for (i = _processors.begin(); i != _processors.end(); ++i) { + if (boost::dynamic_pointer_cast (*i) || + boost::dynamic_pointer_cast (*i)) { + if ((*i)->name() == name) { + return true; + } + } + } + + return false; } MuteMaster::MutePoint @@ -3599,45 +3603,45 @@ Route::unknown_processors () const framecnt_t Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, framecnt_t our_latency) const { - /* we assume that all our input ports feed all our output ports. its not - universally true, but the alternative is way too corner-case to worry about. - */ - - jack_latency_range_t all_connections; - - all_connections.min = ~((jack_nframes_t) 0); - all_connections.max = 0; - - /* iterate over all "from" ports and determine the latency range for all of their - connections to the "outside" (outside of this Route). - */ - - for (PortSet::iterator p = from.begin(); p != from.end(); ++p) { - - jack_latency_range_t range; - - p->get_connected_latency_range (range, playback); - - all_connections.min = min (all_connections.min, range.min); - all_connections.max = max (all_connections.max, range.max); - } - - /* set the "from" port latencies to the max/min range of all their connections */ - - for (PortSet::iterator p = from.begin(); p != from.end(); ++p) { - p->set_private_latency_range (all_connections, playback); - } - - /* set the ports "in the direction of the flow" to the same value as above plus our own signal latency */ - - all_connections.min += our_latency; - all_connections.max += our_latency; - - for (PortSet::iterator p = to.begin(); p != to.end(); ++p) { - p->set_private_latency_range (all_connections, playback); - } - - return all_connections.max; + /* we assume that all our input ports feed all our output ports. its not + universally true, but the alternative is way too corner-case to worry about. + */ + + jack_latency_range_t all_connections; + + all_connections.min = ~((jack_nframes_t) 0); + all_connections.max = 0; + + /* iterate over all "from" ports and determine the latency range for all of their + connections to the "outside" (outside of this Route). + */ + + for (PortSet::iterator p = from.begin(); p != from.end(); ++p) { + + jack_latency_range_t range; + + p->get_connected_latency_range (range, playback); + + all_connections.min = min (all_connections.min, range.min); + all_connections.max = max (all_connections.max, range.max); + } + + /* set the "from" port latencies to the max/min range of all their connections */ + + for (PortSet::iterator p = from.begin(); p != from.end(); ++p) { + p->set_private_latency_range (all_connections, playback); + } + + /* set the ports "in the direction of the flow" to the same value as above plus our own signal latency */ + + all_connections.min += our_latency; + all_connections.max += our_latency; + + for (PortSet::iterator p = to.begin(); p != to.end(); ++p) { + p->set_private_latency_range (all_connections, playback); + } + + return all_connections.max; } framecnt_t @@ -3645,15 +3649,16 @@ Route::set_private_port_latencies (bool playback) const { framecnt_t own_latency = 0; - /* Processor list not protected by lock: MUST BE CALLED FROM PROCESS THREAD OR - LATENCY CALLBACK. + /* Processor list not protected by lock: MUST BE CALLED FROM PROCESS THREAD + OR LATENCY CALLBACK. - This is called (early) from the latency callback. It computes the REAL latency associated - with each port and stores the result as the "private" latency of the port. A later - call to Route::set_public_port_latencies() sets all ports to the same value to reflect - the fact that we do latency compensation and so all signals are delayed by the - same amount as they flow through ardour. - */ + This is called (early) from the latency callback. It computes the REAL + latency associated with each port and stores the result as the "private" + latency of the port. A later call to Route::set_public_port_latencies() + sets all ports to the same value to reflect the fact that we do latency + compensation and so all signals are delayed by the same amount as they + flow through ardour. + */ for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->active ()) { @@ -3661,40 +3666,40 @@ Route::set_private_port_latencies (bool playback) const } } - if (playback) { - /* playback: propagate latency from "outside the route" to outputs to inputs */ - return update_port_latencies (_output->ports (), _input->ports (), true, own_latency); - } else { - /* capture: propagate latency from "outside the route" to inputs to outputs */ - return update_port_latencies (_input->ports (), _output->ports (), false, own_latency); - } + if (playback) { + /* playback: propagate latency from "outside the route" to outputs to inputs */ + return update_port_latencies (_output->ports (), _input->ports (), true, own_latency); + } else { + /* capture: propagate latency from "outside the route" to inputs to outputs */ + return update_port_latencies (_input->ports (), _output->ports (), false, own_latency); + } } void Route::set_public_port_latencies (framecnt_t value, bool playback) const { - /* this is called to set the JACK-visible port latencies, which take latency compensation - into account. - */ + /* this is called to set the JACK-visible port latencies, which take + latency compensation into account. + */ + + jack_latency_range_t range; - jack_latency_range_t range; + range.min = value; + range.max = value; - range.min = value; - range.max = value; - - { - const PortSet& ports (_input->ports()); - for (PortSet::const_iterator p = ports.begin(); p != ports.end(); ++p) { - p->set_public_latency_range (range, playback); - } - } + { + const PortSet& ports (_input->ports()); + for (PortSet::const_iterator p = ports.begin(); p != ports.end(); ++p) { + p->set_public_latency_range (range, playback); + } + } - { - const PortSet& ports (_output->ports()); - for (PortSet::const_iterator p = ports.begin(); p != ports.end(); ++p) { - p->set_public_latency_range (range, playback); - } - } + { + const PortSet& ports (_output->ports()); + for (PortSet::const_iterator p = ports.begin(); p != ports.end(); ++p) { + p->set_public_latency_range (range, playback); + } + } } /** Put the invisible processors in the right place in _processors. @@ -3704,14 +3709,14 @@ void Route::setup_invisible_processors () { #ifndef NDEBUG - Glib::RWLock::WriterLock lm (_processor_lock, Glib::TRY_LOCK); + Glib::RWLock::WriterLock lm (_processor_lock, Glib::TRY_LOCK); assert (!lm.locked ()); #endif - if (!_main_outs) { - /* too early to be doing this stuff */ - return; - } + if (!_main_outs) { + /* too early to be doing this stuff */ + return; + } /* we'll build this new list here and then use it */ @@ -3752,10 +3757,10 @@ Route::setup_invisible_processors () new_processors.insert (amp, _meter); break; case MeterPostFader: - /* do nothing here */ + /* do nothing here */ break; case MeterOutput: - /* do nothing here */ + /* do nothing here */ break; case MeterCustom: /* the meter is visible, so we don't touch it here */ @@ -3765,60 +3770,60 @@ Route::setup_invisible_processors () /* MAIN OUTS */ - assert (_main_outs); - assert (!_main_outs->display_to_user ()); - new_processors.push_back (_main_outs); + assert (_main_outs); + assert (!_main_outs->display_to_user ()); + new_processors.push_back (_main_outs); - /* iterator for the main outs */ - - ProcessorList::iterator main = new_processors.end(); - --main; + /* iterator for the main outs */ - /* OUTPUT METERING */ + ProcessorList::iterator main = new_processors.end(); + --main; - if (_meter && (_meter_point == MeterOutput || _meter_point == MeterPostFader)) { - assert (!_meter->display_to_user ()); + /* OUTPUT METERING */ - /* add the processor just before or just after the main outs */ - - ProcessorList::iterator meter_point = main; + if (_meter && (_meter_point == MeterOutput || _meter_point == MeterPostFader)) { + assert (!_meter->display_to_user ()); - if (_meter_point == MeterOutput) { - ++meter_point; - } - new_processors.insert (meter_point, _meter); - } + /* add the processor just before or just after the main outs */ + + ProcessorList::iterator meter_point = main; + + if (_meter_point == MeterOutput) { + ++meter_point; + } + new_processors.insert (meter_point, _meter); + } /* MONITOR SEND */ if (_monitor_send && !is_monitor ()) { assert (!_monitor_send->display_to_user ()); - if (Config->get_solo_control_is_listen_control()) { - switch (Config->get_listen_position ()) { - case PreFaderListen: - switch (Config->get_pfl_position ()) { - case PFLFromBeforeProcessors: - new_processors.push_front (_monitor_send); - break; - case PFLFromAfterProcessors: - new_processors.insert (amp, _monitor_send); - break; - } - break; - case AfterFaderListen: - switch (Config->get_afl_position ()) { - case AFLFromBeforeProcessors: - new_processors.insert (after_amp, _monitor_send); - break; - case AFLFromAfterProcessors: - new_processors.insert (new_processors.end(), _monitor_send); - break; - } - break; - } - } else { - new_processors.insert (new_processors.end(), _monitor_send); - } + if (Config->get_solo_control_is_listen_control()) { + switch (Config->get_listen_position ()) { + case PreFaderListen: + switch (Config->get_pfl_position ()) { + case PFLFromBeforeProcessors: + new_processors.push_front (_monitor_send); + break; + case PFLFromAfterProcessors: + new_processors.insert (amp, _monitor_send); + break; + } + break; + case AfterFaderListen: + switch (Config->get_afl_position ()) { + case AFLFromBeforeProcessors: + new_processors.insert (after_amp, _monitor_send); + break; + case AFLFromAfterProcessors: + new_processors.insert (new_processors.end(), _monitor_send); + break; + } + break; + } + } else { + new_processors.insert (new_processors.end(), _monitor_send); + } } /* MONITOR CONTROL */ @@ -3860,12 +3865,12 @@ Route::should_monitor () const switch (Config->get_monitoring_model()) { case HardwareMonitoring: case ExternalMonitoring: - return !record_enabled() || (_session.config.get_auto_input() && !_session.actively_recording()); + return !record_enabled() || (_session.config.get_auto_input() && !_session.actively_recording()); break; default: - break; + break; } - return true; + return true; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index a56627648d..f08f0589d3 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -132,11 +132,11 @@ static void clean_up_session_event (SessionEvent* ev) { delete ev; } const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event); Session::Session (AudioEngine &eng, - const string& fullpath, - const string& snapshot_name, + const string& fullpath, + const string& snapshot_name, BusProfile* bus_profile, - string mix_template) - : _engine (eng) + string mix_template) + : _engine (eng) , _target_transport_speed (0.0) , _requested_return_frame (-1) , _session_dir (new SessionDirectory(fullpath)) @@ -207,7 +207,7 @@ Session::Session (AudioEngine &eng, StartTimeChanged.connect_same_thread (*this, boost::bind (&Session::start_time_changed, this, _1)); EndTimeChanged.connect_same_thread (*this, boost::bind (&Session::end_time_changed, this, _1)); - _is_new = false; + _is_new = false; } Session::~Session () @@ -245,7 +245,7 @@ Session::destroy () _butler->drop_references (); delete _butler; delete midi_control_ui; - delete _all_route_group; + delete _all_route_group; if (click_data != default_click) { delete [] click_data; @@ -438,7 +438,7 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); - boost::shared_ptr c (new Bundle (buf, true)); + boost::shared_ptr c (new Bundle (buf, true)); c->add_channel (_("mono"), DataType::AUDIO); c->set_port (0, outputs[DataType::AUDIO][np]); @@ -467,7 +467,7 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); - boost::shared_ptr c (new Bundle (buf, false)); + boost::shared_ptr c (new Bundle (buf, false)); c->add_channel (_("mono"), DataType::AUDIO); c->set_port (0, inputs[DataType::AUDIO][np]); @@ -481,7 +481,7 @@ Session::when_engine_running () char buf[32]; snprintf (buf, sizeof(buf), _("in %" PRIu32 "+%" PRIu32), np + 1, np + 2); - boost::shared_ptr c (new Bundle (buf, false)); + boost::shared_ptr c (new Bundle (buf, false)); c->add_channel (_("L"), DataType::AUDIO); c->set_port (0, inputs[DataType::AUDIO][np]); c->add_channel (_("R"), DataType::AUDIO); @@ -497,7 +497,7 @@ Session::when_engine_running () string n = inputs[DataType::MIDI][np]; boost::erase_first (n, X_("alsa_pcm:")); - boost::shared_ptr c (new Bundle (n, false)); + boost::shared_ptr c (new Bundle (n, false)); c->add_channel ("", DataType::MIDI); c->set_port (0, inputs[DataType::MIDI][np]); add_bundle (c); @@ -509,7 +509,7 @@ Session::when_engine_running () string n = outputs[DataType::MIDI][np]; boost::erase_first (n, X_("alsa_pcm:")); - boost::shared_ptr c (new Bundle (n, true)); + boost::shared_ptr c (new Bundle (n, true)); c->add_channel ("", DataType::MIDI); c->set_port (0, outputs[DataType::MIDI][np]); add_bundle (c); @@ -521,9 +521,9 @@ Session::when_engine_running () if (_is_new && !no_auto_connect()) { - Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock()); + Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock()); - /* don't connect the master bus outputs if there is a monitor bus */ + /* don't connect the master bus outputs if there is a monitor bus */ if (_master_out && Config->get_auto_connect_standard_busses() && !_monitor_out) { @@ -595,7 +595,7 @@ Session::when_engine_running () } } else { - + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { uint32_t mod = n_physical_outputs.get (*t); uint32_t limit = _monitor_out->n_outputs().get(*t); @@ -631,7 +631,7 @@ Session::when_engine_running () BootMessage (_("Connect to engine")); _engine.set_session (this); - update_latency_compensation (true); + update_latency_compensation (true); } void @@ -678,11 +678,10 @@ Session::hookup_io () Delivery::reset_panners (); - /* 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. - */ + /* 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 (_monitor_out) { boost::shared_ptr r = routes.reader (); @@ -758,23 +757,23 @@ Session::record_enabling_legal () const void Session::set_track_monitor_input_status (bool yn) { - boost::shared_ptr rl = routes.reader (); - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); - if (tr && tr->record_enabled ()) { - //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; - tr->monitor_input (yn); - } - } + boost::shared_ptr rl = routes.reader (); + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); + if (tr && tr->record_enabled ()) { + //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; + tr->monitor_input (yn); + } + } } void Session::reset_input_monitor_state () { if (transport_rolling()) { - set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input()); + set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input()); } else { - set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring); + set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring); } } @@ -985,7 +984,7 @@ Session::enable_record () MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe)); if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) { - set_track_monitor_input_status (true); + set_track_monitor_input_status (true); } RecordStateChanged (); @@ -1011,7 +1010,7 @@ Session::disable_record (bool rt_context, bool force) } if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) { - set_track_monitor_input_status (false); + set_track_monitor_input_status (false); } RecordStateChanged (); /* emit signal */ @@ -1028,7 +1027,7 @@ Session::step_back_from_record () if (g_atomic_int_compare_and_exchange (&_record_status, Recording, Enabled)) { if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) { - set_track_monitor_input_status (false); + set_track_monitor_input_status (false); } } } @@ -1233,7 +1232,7 @@ struct RouteSorter { static void trace_terminal (boost::shared_ptr r1, boost::shared_ptr rbase) { - boost::shared_ptr r2; + boost::shared_ptr r2; if (r1->feeds (rbase) && rbase->feeds (r1)) { info << string_compose(_("feedback loop setup between %1 and %2"), r1->name(), rbase->name()) << endmsg; @@ -1293,7 +1292,7 @@ Session::resort_routes () { RCUWriter writer (routes); - boost::shared_ptr r = writer.get_copy (); + boost::shared_ptr r = writer.get_copy (); resort_routes_using (r); /* writer goes out of scope and forces update */ } @@ -1407,7 +1406,7 @@ Session::count_existing_route_channels (ChanCount& in, ChanCount& out) in = ChanCount::ZERO; out = ChanCount::ZERO; - boost::shared_ptr r = routes.reader (); + boost::shared_ptr r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_hidden()) { @@ -1440,7 +1439,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m goto failed; } - boost::shared_ptr track; + boost::shared_ptr track; try { track.reset (new MidiTrack (*this, track_name, Route::Flag (0), mode)); @@ -1511,15 +1510,15 @@ void Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount& existing_outputs, bool with_lock, bool connect_inputs, ChanCount input_start, ChanCount output_start) { - if (!IO::connecting_legal) { - return; - } + if (!IO::connecting_legal) { + return; + } - Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::NOT_LOCK); + Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::NOT_LOCK); - if (with_lock) { - lm.acquire (); - } + if (with_lock) { + lm.acquire (); + } /* If both inputs and outputs are auto-connected to physical ports, use the max of input and output offsets to ensure auto-connected @@ -1529,10 +1528,10 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount offset possible. */ - cerr << "ACR: existing in = " << existing_inputs << " out = " << existing_outputs << endl; + cerr << "ACR: existing in = " << existing_inputs << " out = " << existing_outputs << endl; const bool in_out_physical = - (Config->get_input_auto_connect() & AutoConnectPhysical) + (Config->get_input_auto_connect() & AutoConnectPhysical) && (Config->get_output_auto_connect() & AutoConnectPhysical) && connect_inputs; @@ -1552,22 +1551,22 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount if (!physinputs.empty() && connect_inputs) { uint32_t nphysical_in = physinputs.size(); - cerr << "There are " << nphysical_in << " physical inputs of type " << *t << endl; + cerr << "There are " << nphysical_in << " physical inputs of type " << *t << endl; for (uint32_t i = input_start.get(*t); i < route->n_inputs().get(*t) && i < nphysical_in; ++i) { string port; if (Config->get_input_auto_connect() & AutoConnectPhysical) { - cerr << "Get index " << in_offset.get(*t) << " + " << i << " % " << nphysical_in << " = " - << (in_offset.get(*t) + i) % nphysical_in - << endl; + cerr << "Get index " << in_offset.get(*t) << " + " << i << " % " << nphysical_in << " = " + << (in_offset.get(*t) + i) % nphysical_in + << endl; port = physinputs[(in_offset.get(*t) + i) % nphysical_in]; } - cerr << "Connect route " << route->name() << " IN to " << port << endl; + cerr << "Connect route " << route->name() << " IN to " << port << endl; if (!port.empty() && route->input()->connect ( - route->input()->ports().port(*t, i), port, this)) { + route->input()->ports().port(*t, i), port, this)) { break; } } @@ -1587,7 +1586,7 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount } } - cerr << "Connect route " << route->name() << " OUT to " << port << endl; + cerr << "Connect route " << route->name() << " OUT to " << port << endl; if (!port.empty() && route->output()->connect ( route->output()->ports().port(*t, i), port, this)) { @@ -1623,7 +1622,7 @@ Session::new_audio_track ( goto failed; } - boost::shared_ptr track; + boost::shared_ptr track; try { track.reset (new AudioTrack (*this, track_name, Route::Flag (0), mode)); @@ -1699,7 +1698,7 @@ Session::set_remote_control_ids () RemoteModel m = Config->get_remote_model(); bool emit_signal = false; - boost::shared_ptr r = routes.reader (); + boost::shared_ptr r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (MixerOrdered == m) { @@ -1845,7 +1844,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template Track::zero_diskstream_id_in_xml (node_copy); try { - boost::shared_ptr route (XMLRouteFactory (node_copy, 3000)); + boost::shared_ptr route (XMLRouteFactory (node_copy, 3000)); if (route == 0) { error << _("Session: cannot create track/bus from template description") << endmsg; @@ -1899,7 +1898,7 @@ Session::add_routes (RouteList& new_routes, bool auto_connect, bool save) { { RCUWriter writer (routes); - boost::shared_ptr r = writer.get_copy (); + boost::shared_ptr r = writer.get_copy (); r->insert (r->end(), new_routes.begin(), new_routes.end()); @@ -1947,16 +1946,16 @@ Session::add_routes (RouteList& new_routes, bool auto_connect, bool save) } } - if (auto_connect) { + if (auto_connect) { - ChanCount existing_inputs; - ChanCount existing_outputs; + ChanCount existing_inputs; + ChanCount existing_outputs; - count_existing_route_channels (existing_inputs, existing_outputs); + count_existing_route_channels (existing_inputs, existing_outputs); - auto_connect_route (r, existing_inputs, existing_outputs, true); - } - } + auto_connect_route (r, existing_inputs, existing_outputs, true); + } + } if (_monitor_out && IO::connecting_legal) { @@ -2072,7 +2071,7 @@ Session::remove_route (boost::shared_ptr route) { RCUWriter writer (routes); - boost::shared_ptr rs = writer.get_copy (); + boost::shared_ptr rs = writer.get_copy (); rs->remove (route); @@ -2204,23 +2203,23 @@ Session::route_solo_isolated_changed (void* /*src*/, boost::weak_ptr wpr) return; } - bool send_changed = false; - - if (route->solo_isolated()) { - if (_solo_isolated_cnt == 0) { - send_changed = true; - } - _solo_isolated_cnt++; - } else if (_solo_isolated_cnt > 0) { - _solo_isolated_cnt--; - if (_solo_isolated_cnt == 0) { - send_changed = true; - } - } - - if (send_changed) { - IsolatedChanged (); /* EMIT SIGNAL */ - } + bool send_changed = false; + + if (route->solo_isolated()) { + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + _solo_isolated_cnt++; + } else if (_solo_isolated_cnt > 0) { + _solo_isolated_cnt--; + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + } + + if (send_changed) { + IsolatedChanged (); /* EMIT SIGNAL */ + } } void @@ -2643,7 +2642,7 @@ Session::add_source (boost::shared_ptr source) } source->DropReferences.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr (source))); - } + } } void @@ -4115,7 +4114,7 @@ Session::ensure_search_path_includes (const string& path, DataType type) boost::shared_ptr Session::get_speakers() { - return _speakers; + return _speakers; } list @@ -4138,105 +4137,105 @@ Session::unknown_processors () const void Session::update_latency (bool playback) { - DEBUG_TRACE (DEBUG::Latency, string_compose ("JACK latency callback: %1\n", (playback ? "PLAYBACK" : "CAPTURE"))); + DEBUG_TRACE (DEBUG::Latency, string_compose ("JACK latency callback: %1\n", (playback ? "PLAYBACK" : "CAPTURE"))); - if (_state_of_the_state & (InitialConnecting|Deletion)) { - return; - } + if (_state_of_the_state & (InitialConnecting|Deletion)) { + return; + } boost::shared_ptr r = routes.reader (); - framecnt_t max_latency = 0; + framecnt_t max_latency = 0; - if (playback) { - /* reverse the list so that we work backwards from the last route to run to the first */ - reverse (r->begin(), r->end()); - } + if (playback) { + /* reverse the list so that we work backwards from the last route to run to the first */ + reverse (r->begin(), r->end()); + } - /* compute actual latency values for the given direction and store them all in per-port - structures. this will also publish the same values (to JACK) so that computation of latency - for routes can consistently use public latency values. - */ + /* compute actual latency values for the given direction and store them all in per-port + structures. this will also publish the same values (to JACK) so that computation of latency + for routes can consistently use public latency values. + */ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - max_latency = max (max_latency, (*i)->set_private_port_latencies (playback)); - } + max_latency = max (max_latency, (*i)->set_private_port_latencies (playback)); + } - if (playback) { + if (playback) { - post_playback_latency (); + post_playback_latency (); - /* because we latency compensate playback, our published playback latencies should - be the same for all output ports - all material played back by ardour has - the same latency, whether its caused by plugins or by latency compensation. since - these may differ from the values computed above, reset all playback port latencies - to the same value. - */ - - DEBUG_TRACE (DEBUG::Latency, string_compose ("Set public port latencies to %1\n", max_latency)); - - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->set_public_port_latencies (max_latency, playback); - } + /* because we latency compensate playback, our published playback latencies should + be the same for all output ports - all material played back by ardour has + the same latency, whether its caused by plugins or by latency compensation. since + these may differ from the values computed above, reset all playback port latencies + to the same value. + */ + + DEBUG_TRACE (DEBUG::Latency, string_compose ("Set public port latencies to %1\n", max_latency)); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + (*i)->set_public_port_latencies (max_latency, playback); + } - } else { + } else { - post_capture_latency (); - } + post_capture_latency (); + } - DEBUG_TRACE (DEBUG::Latency, "JACK latency callback: DONE\n"); + DEBUG_TRACE (DEBUG::Latency, "JACK latency callback: DONE\n"); } void Session::post_playback_latency () { - set_worst_playback_latency (); + set_worst_playback_latency (); - boost::shared_ptr r = routes.reader (); - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - if (!(*i)->is_hidden() && ((*i)->active())) { - _worst_track_latency = max (_worst_track_latency, (*i)->update_signal_latency ()); - } + boost::shared_ptr r = routes.reader (); + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (!(*i)->is_hidden() && ((*i)->active())) { + _worst_track_latency = max (_worst_track_latency, (*i)->update_signal_latency ()); + } - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->set_latency_compensation (_worst_track_latency); - } - } + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + (*i)->set_latency_compensation (_worst_track_latency); + } + } } void Session::post_capture_latency () { - set_worst_capture_latency (); + set_worst_capture_latency (); - /* reflect any changes in capture latencies into capture offsets - */ + /* reflect any changes in capture latencies into capture offsets + */ - boost::shared_ptr rl = routes.reader(); - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); - if (tr) { - tr->set_capture_offset (); - } - } + boost::shared_ptr rl = routes.reader(); + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); + if (tr) { + tr->set_capture_offset (); + } + } } void Session::set_worst_io_latencies () { - set_worst_playback_latency (); - set_worst_capture_latency (); + set_worst_playback_latency (); + set_worst_capture_latency (); } void Session::set_worst_playback_latency () { - if (_state_of_the_state & (InitialConnecting|Deletion)) { - return; - } + if (_state_of_the_state & (InitialConnecting|Deletion)) { + return; + } - _worst_output_latency = 0; + _worst_output_latency = 0; if (!_engine.connected()) { return; @@ -4245,20 +4244,20 @@ Session::set_worst_playback_latency () boost::shared_ptr r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - _worst_output_latency = max (_worst_output_latency, (*i)->output()->latency()); + _worst_output_latency = max (_worst_output_latency, (*i)->output()->latency()); } - DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst output latency: %1\n", _worst_output_latency)); + DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst output latency: %1\n", _worst_output_latency)); } void Session::set_worst_capture_latency () { - if (_state_of_the_state & (InitialConnecting|Deletion)) { - return; - } + if (_state_of_the_state & (InitialConnecting|Deletion)) { + return; + } - _worst_input_latency = 0; + _worst_input_latency = 0; if (!_engine.connected()) { return; @@ -4267,7 +4266,7 @@ Session::set_worst_capture_latency () boost::shared_ptr r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - _worst_input_latency = max (_worst_input_latency, (*i)->input()->latency()); + _worst_input_latency = max (_worst_input_latency, (*i)->input()->latency()); } DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst input latency: %1\n", _worst_input_latency)); @@ -4284,30 +4283,30 @@ Session::update_latency_compensation (bool force_whole_graph) DEBUG_TRACE(DEBUG::Latency, "---------------------------- update latency compensation\n\n"); - _worst_track_latency = 0; + _worst_track_latency = 0; boost::shared_ptr r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_hidden() && ((*i)->active())) { - framecnt_t tl; - if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) { - update_jack = true; - } - _worst_track_latency = max (tl, _worst_track_latency); - } - } + framecnt_t tl; + if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) { + update_jack = true; + } + _worst_track_latency = max (tl, _worst_track_latency); + } + } - DEBUG_TRACE (DEBUG::Latency, string_compose ("worst signal processing latency: %1 (changed ? %2)\n", _worst_track_latency, - (update_jack ? "yes" : "no"))); + DEBUG_TRACE (DEBUG::Latency, string_compose ("worst signal processing latency: %1 (changed ? %2)\n", _worst_track_latency, + (update_jack ? "yes" : "no"))); if (force_whole_graph || update_jack) { - /* trigger a full recompute of latency numbers for the graph. - everything else that we need to do will be done in the latency - callback. - */ + /* trigger a full recompute of latency numbers for the graph. + everything else that we need to do will be done in the latency + callback. + */ _engine.update_total_latencies (); - return; // everything else will be done in the latency callback + return; // everything else will be done in the latency callback } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 252262efcd..248172fcd9 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -222,14 +222,14 @@ Session::realtime_stop (bool abort, bool clear_state) past that point to pick up delayed input (and/or to delick) */ - if (worst_playback_latency() > current_block_size) { - /* we rolled past the stop point to pick up data that had - not yet arrived. move back to where the stop occured. - */ - decrement_transport_position (current_block_size + (worst_playback_latency() - current_block_size)); - } else { - decrement_transport_position (current_block_size); - } + if (worst_playback_latency() > current_block_size) { + /* we rolled past the stop point to pick up data that had + not yet arrived. move back to where the stop occured. + */ + decrement_transport_position (current_block_size + (worst_playback_latency() - current_block_size)); + } else { + decrement_transport_position (current_block_size); + } /* the duration change is not guaranteed to have happened, but is likely */ @@ -252,9 +252,9 @@ Session::realtime_stop (bool abort, bool clear_state) _clear_event_type (SessionEvent::RangeStop); _clear_event_type (SessionEvent::RangeLocate); - /* if we're going to clear loop state, then force disabling record BUT only if we're not doing latched rec-enable */ + /* if we're going to clear loop state, then force disabling record BUT only if we're not doing latched rec-enable */ disable_record (true, (!Config->get_latched_record_enable() && clear_state)); - + reset_slave_state (); _transport_speed = 0; @@ -284,26 +284,26 @@ Session::butler_transport_work () DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler transport work, todo = %1\n", enum_2_string (ptw))); - if (ptw & PostTransportAdjustPlaybackBuffering) { + if (ptw & PostTransportAdjustPlaybackBuffering) { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); if (tr) { tr->adjust_playback_buffering (); - /* and refill those buffers ... */ - tr->non_realtime_locate (_transport_frame); + /* and refill those buffers ... */ + tr->non_realtime_locate (_transport_frame); } } - - } - if (ptw & PostTransportAdjustCaptureBuffering) { + } + + if (ptw & PostTransportAdjustCaptureBuffering) { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); if (tr) { tr->adjust_capture_buffering (); } } - } + } if (ptw & PostTransportCurveRealloc) { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -460,11 +460,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: DS stop\n")); - if (abort && did_record) { - /* no reason to save the session file when we remove sources - */ - _state_of_the_state = StateOfTheState (_state_of_the_state|InCleanup); - } + if (abort && did_record) { + /* no reason to save the session file when we remove sources + */ + _state_of_the_state = StateOfTheState (_state_of_the_state|InCleanup); + } for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); @@ -473,9 +473,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) } } - if (abort && did_record) { - _state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup); - } + if (abort && did_record) { + _state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup); + } boost::shared_ptr r = routes.reader (); @@ -490,8 +490,8 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) } if (_engine.running()) { - PostTransportWork ptw = post_transport_work (); - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + PostTransportWork ptw = post_transport_work (); + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->nonrealtime_handle_transport_stopped (abort, (ptw & PostTransportLocate), (!(ptw & PostTransportLocate) || pending_locate_flush)); } update_latency_compensation (); @@ -512,7 +512,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) if ((auto_return_enabled || synced_to_jack() || _requested_return_frame >= 0) && !(ptw & PostTransportLocate)) { - /* no explicit locate queued */ + /* no explicit locate queued */ bool do_locate = false; @@ -601,10 +601,10 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) send_full_time_code (_transport_frame); - if (!dynamic_cast(_slave)) { - MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop)); - send_mmc_locate (_transport_frame); - } + if (!dynamic_cast(_slave)) { + MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop)); + send_mmc_locate (_transport_frame); + } if ((ptw & PostTransportLocate) && get_record_enabled()) { /* capture start has been changed, so save pending state */ @@ -612,9 +612,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) saved = true; } - /* always try to get rid of this */ + /* always try to get rid of this */ - remove_pending_capture_state (); + remove_pending_capture_state (); /* save the current state of things if appropriate */ @@ -691,8 +691,9 @@ Session::set_play_loop (bool yn) } if (yn && Config->get_seamless_loop() && synced_to_jack()) { - warning << string_compose (_("Seamless looping cannot be supported while %1 is using JACK transport.\n" - "Recommend changing the configured options"), PROGRAM_NAME) + warning << string_compose ( + _("Seamless looping cannot be supported while %1 is using JACK transport.\n" + "Recommend changing the configured options"), PROGRAM_NAME) << endmsg; return; } @@ -876,12 +877,12 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool if (with_roll) { /* switch from input if we're going to roll */ if (Config->get_monitoring_model() == HardwareMonitoring) { - set_track_monitor_input_status (!config.get_auto_input()); + set_track_monitor_input_status (!config.get_auto_input()); } } else { /* otherwise we're going to stop, so do the opposite */ if (Config->get_monitoring_model() == HardwareMonitoring) { - set_track_monitor_input_status (true); + set_track_monitor_input_status (true); } } @@ -952,7 +953,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state) /* we are rolling and we want to stop */ if (Config->get_monitoring_model() == HardwareMonitoring) { - set_track_monitor_input_status (true); + set_track_monitor_input_status (true); } if (synced_to_jack ()) { @@ -975,7 +976,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state) /* we are stopped and we want to start rolling at speed 1 */ if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) { - set_track_monitor_input_status (false); + set_track_monitor_input_status (false); } if (synced_to_jack()) { @@ -987,8 +988,9 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state) } else { if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) { - warning << string_compose (_("Global varispeed cannot be supported while %1 is connected to JACK transport control"), - PROGRAM_NAME) + warning << string_compose ( + _("Global varispeed cannot be supported while %1 is connected to JACK transport control"), + PROGRAM_NAME) << endmsg; return; } @@ -1053,7 +1055,7 @@ Session::stop_transport (bool abort, bool clear_state) if (tr) { tr->prepare_to_stop (_transport_frame); } - } + } /* we need to capture the audio that has still not yet been received by the system at the time the stop is requested, so we have to roll past that time. @@ -1064,8 +1066,8 @@ Session::stop_transport (bool abort, bool clear_state) */ SessionEvent *ev = new SessionEvent (SessionEvent::StopOnce, SessionEvent::Replace, - _transport_frame + _worst_input_latency - current_block_size, - 0, 0, abort); + _transport_frame + _worst_input_latency - current_block_size, + 0, 0, abort); merge_event (ev); transport_sub_state |= StopPendingCapture; @@ -1076,16 +1078,16 @@ Session::stop_transport (bool abort, bool clear_state) if ((transport_sub_state & PendingDeclickOut) == 0) { - if (!(transport_sub_state & StopPendingCapture)) { + if (!(transport_sub_state & StopPendingCapture)) { boost::shared_ptr rl = routes.reader(); for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); if (tr) { tr->prepare_to_stop (_transport_frame); } - } - } - + } + } + transport_sub_state |= PendingDeclickOut; /* we'll be called again after the declick */ pending_abort = abort; @@ -1136,14 +1138,14 @@ Session::start_transport () if (tr) { tr->realtime_set_speed (tr->speed(), true); } - (*i)->automation_snapshot (_transport_frame, true); + (*i)->automation_snapshot (_transport_frame, true); } - Timecode::Time time; - timecode_time_subframes (_transport_frame, time); - if (!dynamic_cast(_slave)) { - MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay)); - } + Timecode::Time time; + timecode_time_subframes (_transport_frame, time); + if (!dynamic_cast(_slave)) { + MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay)); + } TransportStateChange (); /* EMIT SIGNAL */ } @@ -1284,9 +1286,9 @@ Session::switch_to_sync_source (SyncSource src) return; } - if (config.get_video_pullup() != 0.0f) { - return; - } + if (config.get_video_pullup() != 0.0f) { + return; + } new_slave = new JACK_Slave (_engine.jack()); break; @@ -1488,15 +1490,15 @@ Session::reset_jack_connection (jack_client_t* jack) bool Session::maybe_stop (framepos_t limit) { - if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) { - if (synced_to_jack () && config.get_jack_time_master ()) { - _engine.transport_stop (); - } else if (!synced_to_jack ()) { - stop_transport (); - } - return true; - } - return false; + if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) { + if (synced_to_jack () && config.get_jack_time_master ()) { + _engine.transport_stop (); + } else if (!synced_to_jack ()) { + stop_transport (); + } + return true; + } + return false; } void -- cgit v1.2.3