diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-21 17:02:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-21 17:02:30 +0000 |
commit | 814f2fbd8f88299110a7b2bbc49d85d1e121f1e1 (patch) | |
tree | a823a82b41e48fe3b3045a3ac26c9beea77005c7 /libs | |
parent | 692987ee2e4adf52722bbe47db616af7d9959065 (diff) |
change session construction so that the the monitor bus config is derived (once) from the master bus config
git-svn-id: svn://localhost/ardour2/branches/3.0@6779 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/io.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 22 | ||||
-rw-r--r-- | libs/ardour/io.cc | 24 | ||||
-rw-r--r-- | libs/ardour/session.cc | 23 |
4 files changed, 37 insertions, 33 deletions
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index b718cfa5c9..a7ba3a23a9 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -107,6 +107,7 @@ class IO : public SessionObject, public Latent int disconnect (Port *our_port, std::string other_port, void *src); int disconnect (void *src); bool connected_to (boost::shared_ptr<const IO>) const; + bool connected () const; nframes_t signal_latency() const { return _own_latency; } nframes_t latency() const; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 5cb8cbd78f..cb62decafc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -138,18 +138,18 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* creating a new Session */ Session (AudioEngine&, - std::string fullpath, - std::string snapshot_name, - AutoConnectOption input_auto_connect, - AutoConnectOption output_auto_connect, - uint32_t control_out_channels, - uint32_t master_out_channels, - uint32_t n_physical_in, - uint32_t n_physical_out, - nframes_t initial_length); - + std::string fullpath, + std::string snapshot_name, + AutoConnectOption input_auto_connect, + AutoConnectOption output_auto_connect, + bool with_monitor, + uint32_t master_out_channels, + uint32_t n_physical_in, + uint32_t n_physical_out, + nframes_t initial_length); + virtual ~Session (); - + std::string path() const { return _path; } std::string name() const { return _name; } std::string snap_name() const { return _current_snapshot_name; } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index b34614e1dd..9da9bf2a28 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1444,18 +1444,24 @@ IO::set_name_in_state (XMLNode& node, const string& new_name) } bool +IO::connected () const +{ + /* do we have any connections at all? */ + + for (PortSet::const_iterator p = _ports.begin(); p != _ports.end(); ++p) { + if (p->connected()) { + return true; + } + } + + return false; +} + +bool IO::connected_to (boost::shared_ptr<const IO> other) const { if (!other) { - /* do we have any connections at all? */ - - for (PortSet::const_iterator p = _ports.begin(); p != _ports.end(); ++p) { - if (p->connected()) { - return true; - } - } - - return false; + return connected (); } assert (_direction != other->direction()); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 1fec3dbcc6..20e88756ea 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -206,7 +206,7 @@ Session::Session (AudioEngine &eng, string snapshot_name, AutoConnectOption input_ac, AutoConnectOption output_ac, - uint32_t control_out_channels, + bool with_monitor, uint32_t master_out_channels, uint32_t requested_physical_in, uint32_t requested_physical_out, @@ -295,8 +295,8 @@ Session::Session (AudioEngine &eng, output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster); } - if (control_out_channels) { - ChanCount count(DataType::AUDIO, control_out_channels); + if (with_monitor) { + ChanCount count(DataType::AUDIO, master_out_channels); Route* rt = new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO); boost_debug_shared_ptr_mark_interesting (rt, "Route"); shared_ptr<Route> r (rt); @@ -648,7 +648,9 @@ Session::when_engine_running (bool new_session) if (new_session && !no_auto_connect()) { - if (_master_out && Config->get_auto_connect_standard_busses()) { + /* don't connect the master bus outputs if there is a monitor bus */ + + if (_master_out && Config->get_auto_connect_standard_busses() && !_control_out) { /* if requested auto-connect the outputs to the first N physical ports. */ @@ -697,11 +699,10 @@ Session::when_engine_running (bool new_session) } } - /* if control out is not connected, - connect control out to physical outs, but use ones after the master if possible + /* if control out is not connected, connect control out to physical outs */ - if (!_control_out->output()->connected_to (boost::shared_ptr<IO>())) { + if (!_control_out->output()->connected ()) { if (!Config->get_monitor_bus_preferred_bundle().empty()) { @@ -716,19 +717,15 @@ Session::when_engine_running (bool new_session) } } else { - + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { - uint32_t shift = _master_out->n_outputs().get(*t); uint32_t mod = _engine.n_physical_outputs (*t); uint32_t limit = _control_out->n_outputs().get(*t); - cerr << "Connecting " << limit << " control out ports, shift is " << shift - << " mod is " << mod << endl; - for (uint32_t n = 0; n < limit; ++n) { Port* p = _control_out->output()->ports().port(*t, n); - string connect_to = _engine.get_nth_physical_output (*t, (n+shift) % mod); + string connect_to = _engine.get_nth_physical_output (*t, (n % mod)); if (!connect_to.empty()) { if (_control_out->output()->connect (p, connect_to, this)) { |