summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-21 17:02:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-21 17:02:30 +0000
commit814f2fbd8f88299110a7b2bbc49d85d1e121f1e1 (patch)
treea823a82b41e48fe3b3045a3ac26c9beea77005c7
parent692987ee2e4adf52722bbe47db616af7d9959065 (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
-rw-r--r--gtk2_ardour/ardour_ui.cc14
-rw-r--r--gtk2_ardour/ardour_ui.h2
-rw-r--r--gtk2_ardour/startup.cc28
-rw-r--r--gtk2_ardour/startup.h3
-rw-r--r--libs/ardour/ardour/io.h1
-rw-r--r--libs/ardour/ardour/session.h22
-rw-r--r--libs/ardour/io.cc24
-rw-r--r--libs/ardour/session.cc23
8 files changed, 46 insertions, 71 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index b216acae29..716a6820b8 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2273,7 +2273,6 @@ int
ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib::ustring& session_name)
{
- uint32_t cchns;
uint32_t mchns;
AutoConnectOption iconnect;
AutoConnectOption oconnect;
@@ -2282,7 +2281,6 @@ ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib
if (Profile->get_sae()) {
- cchns = 0;
mchns = 2;
iconnect = AutoConnectPhysical;
oconnect = AutoConnectMaster;
@@ -2293,12 +2291,6 @@ ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib
/* get settings from advanced section of NSD */
- if (_startup->create_control_bus()) {
- cchns = (uint32_t) _startup->control_channel_count();
- } else {
- cchns = 0;
- }
-
if (_startup->create_master_bus()) {
mchns = (uint32_t) _startup->master_channel_count();
} else {
@@ -2329,7 +2321,7 @@ ARDOUR_UI::build_session_from_nsd (const Glib::ustring& session_path, const Glib
if (build_session (session_path,
session_name,
- cchns,
+ _startup->create_control_bus(),
mchns,
iconnect,
oconnect,
@@ -2642,7 +2634,7 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
int
ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_name,
- uint32_t control_channels,
+ bool with_monitor,
uint32_t master_channels,
AutoConnectOption input_connect,
AutoConnectOption output_connect,
@@ -2671,7 +2663,7 @@ ARDOUR_UI::build_session (const Glib::ustring& path, const Glib::ustring& snap_n
try {
new_session = new Session (*engine, path, snap_name, input_connect, output_connect,
- control_channels, master_channels, nphysin, nphysout, initial_length);
+ with_monitor, master_channels, nphysin, nphysout, initial_length);
}
catch (...) {
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index a851e03981..0ae904678d 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -125,7 +125,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
int load_session (const Glib::ustring& path, const Glib::ustring& snapshot, Glib::ustring mix_template = Glib::ustring());
bool session_loaded;
int build_session (const Glib::ustring& path, const Glib::ustring& snapshot,
- uint32_t ctl_chns,
+ bool with_monitor,
uint32_t master_chns,
ARDOUR::AutoConnectOption input_connect,
ARDOUR::AutoConnectOption output_connect,
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc
index f6ec9e0490..456cb4922e 100644
--- a/gtk2_ardour/startup.cc
+++ b/gtk2_ardour/startup.cc
@@ -812,11 +812,9 @@ ArdourStartup::setup_more_options_page ()
_output_limit_count.set_adjustment (_output_limit_count_adj);
_input_limit_count.set_adjustment (_input_limit_count_adj);
- _control_bus_channel_count.set_adjustment (_control_bus_channel_count_adj);
_master_bus_channel_count.set_adjustment (_master_bus_channel_count_adj);
chan_count_label_1.set_text (_("channels"));
- chan_count_label_2.set_text (_("channels"));
chan_count_label_3.set_text (_("channels"));
chan_count_label_4.set_text (_("channels"));
@@ -824,10 +822,6 @@ ArdourStartup::setup_more_options_page ()
chan_count_label_1.set_padding(0,0);
chan_count_label_1.set_line_wrap(false);
- chan_count_label_2.set_alignment(0,0.5);
- chan_count_label_2.set_padding(0,0);
- chan_count_label_2.set_line_wrap(false);
-
chan_count_label_3.set_alignment(0,0.5);
chan_count_label_3.set_padding(0,0);
chan_count_label_3.set_line_wrap(false);
@@ -847,13 +841,6 @@ ArdourStartup::setup_more_options_page ()
_create_control_bus.set_active(false);
_create_control_bus.set_border_width(0);
- _control_bus_channel_count.set_flags(Gtk::CAN_FOCUS);
- _control_bus_channel_count.set_update_policy(Gtk::UPDATE_ALWAYS);
- _control_bus_channel_count.set_numeric(true);
- _control_bus_channel_count.set_digits(0);
- _control_bus_channel_count.set_wrap(false);
- _control_bus_channel_count.set_sensitive(false);
-
_master_bus_channel_count.set_flags(Gtk::CAN_FOCUS);
_master_bus_channel_count.set_update_policy(Gtk::UPDATE_ALWAYS);
_master_bus_channel_count.set_numeric(true);
@@ -909,8 +896,6 @@ ArdourStartup::setup_more_options_page ()
bus_table.attach (_master_bus_channel_count, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
bus_table.attach (chan_count_label_1, 2, 3, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
bus_table.attach (_create_control_bus, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- bus_table.attach (_control_bus_channel_count, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- bus_table.attach (chan_count_label_2, 2, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 6, 0);
input_port_limit_hbox.pack_start(_limit_input_ports, Gtk::PACK_SHRINK, 6);
input_port_limit_hbox.pack_start(_input_limit_count, Gtk::PACK_SHRINK, 0);
@@ -1037,12 +1022,6 @@ ArdourStartup::create_control_bus() const
return _create_control_bus.get_active();
}
-int
-ArdourStartup::control_channel_count() const
-{
- return _control_bus_channel_count.get_value_as_int();
-}
-
bool
ArdourStartup::connect_inputs() const
{
@@ -1130,13 +1109,16 @@ ArdourStartup::limit_outputs_clicked ()
void
ArdourStartup::master_bus_button_clicked ()
{
- _master_bus_channel_count.set_sensitive(_create_master_bus.get_active());
+ bool yn = _create_master_bus.get_active();
+
+ _master_bus_channel_count.set_sensitive(yn);
+ _create_control_bus.set_sensitive (yn);
}
void
ArdourStartup::monitor_bus_button_clicked ()
{
- _control_bus_channel_count.set_sensitive(_create_control_bus.get_active());
+ /* relax */
}
void
diff --git a/gtk2_ardour/startup.h b/gtk2_ardour/startup.h
index f0146e2a5e..01fdd853f2 100644
--- a/gtk2_ardour/startup.h
+++ b/gtk2_ardour/startup.h
@@ -45,7 +45,6 @@ class ArdourStartup : public Gtk::Assistant {
int master_channel_count() const;
bool create_control_bus() const;
- int control_channel_count() const;
bool connect_inputs() const;
bool limit_inputs_used_for_connection() const;
@@ -180,7 +179,6 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::VBox more_options_vbox;
Gtk::Label chan_count_label_1;
- Gtk::Label chan_count_label_2;
Gtk::Label chan_count_label_3;
Gtk::Label chan_count_label_4;
Gtk::Table advanced_table;
@@ -211,7 +209,6 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::SpinButton _master_bus_channel_count;
Gtk::CheckButton _create_control_bus;
- Gtk::SpinButton _control_bus_channel_count;
Gtk::CheckButton _connect_inputs;
Gtk::CheckButton _limit_input_ports;
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)) {