summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-22 21:35:35 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-22 21:35:35 +0000
commit4d33dcd5d767738aea509a6077c92dba175a5b0c (patch)
tree28b0b0b048c33b481d99ce075a94446d22af3dd8 /libs
parent9bdb9836b52cbbef47a1076f0d84ceb41100b58d (diff)
remove near-duplicate session constructor; change names from control_outs to monitor_out and control_out to monitor_send; may havebroken creation of new sessions in a wierd way (will fix later)
git-svn-id: svn://localhost/ardour2/branches/3.0@6783 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/route.h10
-rw-r--r--libs/ardour/ardour/session.h38
-rw-r--r--libs/ardour/ardour/types.h8
-rw-r--r--libs/ardour/delivery.cc2
-rw-r--r--libs/ardour/enums.cc2
-rw-r--r--libs/ardour/route.cc66
-rw-r--r--libs/ardour/session.cc218
-rw-r--r--libs/ardour/session_state.cc74
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc2
9 files changed, 165 insertions, 255 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 9f7d9d5d5a..60e79a3a66 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -65,7 +65,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
enum Flag {
Hidden = 0x1,
MasterOut = 0x2,
- ControlOut = 0x4
+ MonitorOut = 0x4
};
Route (Session&, std::string name, Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
@@ -93,7 +93,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
bool is_hidden() const { return _flags & Hidden; }
bool is_master() const { return _flags & MasterOut; }
- bool is_control() const { return _flags & ControlOut; }
+ bool is_monitor() const { return _flags & MonitorOut; }
/* these are the core of the API of a Route. see the protected sections as well */
@@ -190,7 +190,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
/* special processors */
- boost::shared_ptr<Delivery> control_outs() const { return _control_outs; }
+ boost::shared_ptr<Delivery> monitor_send() const { return _monitor_send; }
boost::shared_ptr<Delivery> main_outs() const { return _main_outs; }
boost::shared_ptr<InternalReturn> internal_return() const { return _intreturn; }
boost::shared_ptr<MonitorProcessor> monitor_control() const { return _monitor_control; }
@@ -198,7 +198,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
void add_internal_return ();
BufferSet* get_return_buffer () const;
void release_return_buffer () const;
- void put_control_outs_at (Placement);
+ void put_monitor_send_at (Placement);
/** A record of the stream configuration at some point in the processor list.
* Used to return where and why an processor list configuration request failed.
@@ -363,7 +363,7 @@ class Route : public SessionObject, public AutomatableControls, public RouteGrou
ProcessorList _processors;
mutable Glib::RWLock _processor_lock;
boost::shared_ptr<Delivery> _main_outs;
- boost::shared_ptr<Delivery> _control_outs;
+ boost::shared_ptr<Delivery> _monitor_send;
boost::shared_ptr<InternalReturn> _intreturn;
boost::shared_ptr<MonitorProcessor> _monitor_control;
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 57332babf3..10ffe903f1 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -122,31 +122,22 @@ extern void setup_enum_writer ();
class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager
{
public:
- enum RecordState {
+ enum RecordState {
Disabled = 0,
Enabled = 1,
Recording = 2
};
- /* creating from an XML file */
+ /* a new session might have non-empty mix_template, an existing session should always have an empty one.
+ the bus profile can be null if no master out bus is required.
+ */
Session (AudioEngine&,
- const std::string& fullpath,
- const std::string& snapshot_name,
- std::string mix_template = "");
+ const std::string& fullpath,
+ const std::string& snapshot_name,
+ BusProfile* bus_profile = 0,
+ std::string mix_template = "");
- /* creating a new Session */
-
- Session (AudioEngine&,
- std::string fullpath,
- std::string snapshot_name,
- AutoConnectOption input_auto_connect,
- AutoConnectOption output_auto_connect,
- 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; }
@@ -619,7 +610,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* control/master out */
- boost::shared_ptr<Route> control_out() const { return _control_out; }
+ boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
boost::shared_ptr<Route> master_out() const { return _master_out; }
void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p);
@@ -825,7 +816,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void update_latency_compensation (bool, bool);
private:
- int create (bool& new_session, const std::string& mix_template, nframes_t initial_length);
+ int create (const std::string& mix_template, nframes_t initial_length, BusProfile*);
void destroy ();
nframes_t compute_initial_length ();
@@ -983,6 +974,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
MIDI::Port* _midi_clock_port;
std::string _path;
std::string _name;
+ bool _is_new;
bool session_send_mmc;
bool session_send_mtc;
bool session_midi_feedback;
@@ -992,8 +984,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
boost::scoped_ptr<SessionDirectory> _session_dir;
- void hookup_io (bool new_session);
- void when_engine_running (bool new_session);
+ void hookup_io ();
+ void when_engine_running ();
void graph_reordered ();
std::string _current_snapshot_name;
@@ -1074,7 +1066,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void auto_loop_changed (Location *);
void first_stage_init (std::string path, std::string snapshot_name);
- int second_stage_init (bool new_tracks);
+ int second_stage_init ();
void find_current_end ();
void remove_empty_sounds ();
@@ -1409,7 +1401,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
uint32_t main_outs;
boost::shared_ptr<Route> _master_out;
- boost::shared_ptr<Route> _control_out;
+ boost::shared_ptr<Route> _monitor_out;
gain_t* _gain_automation_buffer;
pan_t** _pan_automation_buffer;
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 54c965ce67..25a6ea4c98 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -453,6 +453,14 @@ namespace ARDOUR {
bool meter_visibly_changed;
};
+ struct BusProfile {
+ AutoConnectOption input_ac; /* override the RC config for input auto-connection */
+ AutoConnectOption output_ac; /* override the RC config for output auto-connection */
+ uint32_t master_out_channels; /* how many channels for the master bus */
+ uint32_t requested_physical_in; /* now many of the available physical inputs to consider usable */
+ uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
+ };
+
} // namespace ARDOUR
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 238b7c3fa9..7d6a4d9d79 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -546,7 +546,7 @@ Delivery::target_gain ()
} else {
- if (_role == Listen && _session.control_out() && !_session.soloing()) {
+ if (_role == Listen && _session.monitor_out() && !_session.soloing()) {
/* nobody is soloed, so control/monitor/listen bus gets its
signal from master out, we should be silent
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index baf8f7326d..df6eb360d1 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -370,7 +370,7 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Route, Hidden);
REGISTER_CLASS_ENUM (Route, MasterOut);
- REGISTER_CLASS_ENUM (Route, ControlOut);
+ REGISTER_CLASS_ENUM (Route, MonitorOut);
REGISTER_BITS (_Route_Flag);
REGISTER_CLASS_ENUM (Source, Writable);
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 448e295c1a..31fc966278 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -92,7 +92,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
add_processor (_main_outs, PostFader);
- if (is_control()) {
+ if (is_monitor()) {
/* where we listen to tracks */
_intreturn.reset (new InternalReturn (_session));
add_processor (_intreturn, PreFader);
@@ -500,7 +500,7 @@ Route::passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes,
bufs.set_count (_input->n_ports());
- if (is_control() && _session.listening()) {
+ if (is_monitor() && _session.listening()) {
/* control/monitor bus ignores input ports when something is
feeding the listen "stream". data will "arrive" into the
@@ -537,14 +537,14 @@ Route::passthru_silence (sframes_t start_frame, sframes_t end_frame, nframes_t n
void
Route::set_listen (bool yn, void* src)
{
- if (_control_outs) {
- if (yn != _control_outs->active()) {
+ if (_monitor_send) {
+ if (yn != _monitor_send->active()) {
if (yn) {
- _control_outs->set_solo_level (1);
- _control_outs->activate ();
+ _monitor_send->set_solo_level (1);
+ _monitor_send->activate ();
} else {
- _control_outs->set_solo_level (0);
- _control_outs->deactivate ();
+ _monitor_send->set_solo_level (0);
+ _monitor_send->deactivate ();
}
listen_changed (src); /* EMIT SIGNAL */
@@ -555,8 +555,8 @@ Route::set_listen (bool yn, void* src)
bool
Route::listening () const
{
- if (_control_outs) {
- return _control_outs->active ();
+ if (_monitor_send) {
+ return _monitor_send->active ();
} else {
return false;
}
@@ -641,7 +641,7 @@ Route::set_delivery_solo ()
void
Route::set_solo_isolated (bool yn, void *src)
{
- if (is_master() || is_control() || is_hidden()) {
+ if (is_master() || is_monitor() || is_hidden()) {
return;
}
@@ -823,7 +823,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
}
- if (activation_allowed && (processor != _control_outs)) {
+ if (activation_allowed && (processor != _monitor_send)) {
processor->activate ();
}
@@ -910,12 +910,12 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
InternalSend* isend = new InternalSend (_session, _mute_master, node);
- if (_session.control_out() && (isend->target_id() == _session.control_out()->id())) {
- _control_outs.reset (isend);
- if (_control_outs->active()) {
- _control_outs->set_solo_level (1);
+ if (_session.monitor_out() && (isend->target_id() == _session.monitor_out()->id())) {
+ _monitor_send.reset (isend);
+ if (_monitor_send->active()) {
+ _monitor_send->set_solo_level (1);
} else {
- _control_outs->set_solo_level (0);
+ _monitor_send->set_solo_level (0);
}
}
@@ -2027,7 +2027,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
_meter.reset (new PeakMeter (_session));
add_processor (_meter, PreFader);
- if (is_control()) {
+ if (is_monitor()) {
/* where we listen to tracks */
_intreturn.reset (new InternalReturn (_session));
add_processor (_intreturn, PreFader);
@@ -2400,12 +2400,12 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a
we take note of which i-send is doing that.
*/
- if (route == _session.control_out()) {
- _control_outs = boost::dynamic_pointer_cast<Delivery>(d);
- if (_control_outs->active()) {
- _control_outs->set_solo_level (1);
+ if (route == _session.monitor_out()) {
+ _monitor_send = boost::dynamic_pointer_cast<Delivery>(d);
+ if (_monitor_send->active()) {
+ _monitor_send->set_solo_level (1);
} else {
- _control_outs->set_solo_level (0);
+ _monitor_send->set_solo_level (0);
}
}
@@ -2422,7 +2422,7 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a
if (is_master()) {
- if (route == _session.control_out()) {
+ if (route == _session.monitor_out()) {
/* master never sends to control outs */
return 0;
} else {
@@ -2431,7 +2431,7 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a
} else {
listener.reset (new InternalSend (_session, _mute_master, route, (aux ? Delivery::Aux : Delivery::Listen)));
- if (route == _session.control_out()) {
+ if (route == _session.monitor_out()) {
}
}
@@ -2439,8 +2439,8 @@ Route::listen_via (boost::shared_ptr<Route> route, Placement placement, bool /*a
return -1;
}
- if (route == _session.control_out()) {
- _control_outs = listener;
+ if (route == _session.monitor_out()) {
+ _monitor_send = listener;
}
if (placement == PostFader) {
@@ -2483,8 +2483,8 @@ Route::drop_listen (boost::shared_ptr<Route> route)
rl.release ();
- if (route == _session.control_out()) {
- _control_outs.reset ();
+ if (route == _session.monitor_out()) {
+ _monitor_send.reset ();
}
}
@@ -2816,16 +2816,16 @@ Route::set_meter_point (MeterPoint p, void *src)
}
void
-Route::put_control_outs_at (Placement p)
+Route::put_monitor_send_at (Placement p)
{
- if (!_control_outs) {
+ if (!_monitor_send) {
return;
}
{
Glib::RWLock::WriterLock lm (_processor_lock);
ProcessorList as_it_was (_processors);
- ProcessorList::iterator loc = find(_processors.begin(), _processors.end(), _control_outs);
+ ProcessorList::iterator loc = find(_processors.begin(), _processors.end(), _monitor_send);
_processors.erase(loc);
switch (p) {
@@ -2840,7 +2840,7 @@ Route::put_control_outs_at (Placement p)
break;
}
- _processors.insert (loc, _control_outs);
+ _processors.insert (loc, _monitor_send);
if (configure_processors_unlocked (0)) {
_processors = as_it_was;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index b2f6f7412f..e071cf06e9 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -125,6 +125,7 @@ const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event)
Session::Session (AudioEngine &eng,
const string& fullpath,
const string& snapshot_name,
+ BusProfile* bus_profile,
string mix_template)
: _engine (eng),
@@ -158,31 +159,27 @@ Session::Session (AudioEngine &eng,
{
playlists.reset (new SessionPlaylists);
- bool new_session;
-
interpolation.add_channel_to (0, 0);
if (!eng.connected()) {
throw failed_constructor();
}
- info << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (1)" << endl;
-
n_physical_outputs = _engine.n_physical_outputs(DataType::AUDIO);
n_physical_inputs = _engine.n_physical_inputs(DataType::AUDIO);
first_stage_init (fullpath, snapshot_name);
- new_session = !Glib::file_test (_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
+ _is_new = !Glib::file_test (_path, Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
- if (new_session) {
- if (create (new_session, mix_template, compute_initial_length())) {
+ if (_is_new) {
+ if (create (mix_template, compute_initial_length(), bus_profile)) {
destroy ();
throw failed_constructor ();
}
- }
+ }
- if (second_stage_init (new_session)) {
+ if (second_stage_init ()) {
destroy ();
throw failed_constructor ();
}
@@ -201,137 +198,6 @@ Session::Session (AudioEngine &eng,
}
}
-Session::Session (AudioEngine &eng,
- string fullpath,
- string snapshot_name,
- AutoConnectOption input_ac,
- AutoConnectOption output_ac,
- uint32_t master_out_channels,
- uint32_t requested_physical_in,
- uint32_t requested_physical_out,
- nframes_t initial_length)
-
- : _engine (eng),
- _target_transport_speed (0.0),
- _requested_return_frame (-1),
- _scratch_buffers(new BufferSet()),
- _silent_buffers(new BufferSet()),
- _mix_buffers(new BufferSet()),
- mmc (0),
- _mmc_port (default_mmc_port),
- _mtc_port (default_mtc_port),
- _midi_port (default_midi_port),
- _midi_clock_port (default_midi_clock_port),
- _session_dir ( new SessionDirectory(fullpath)),
- state_tree (0),
- _butler (new Butler (*this)),
- _post_transport_work (0),
- _send_timecode_update (false),
- diskstreams (new DiskstreamList),
- routes (new RouteList),
- _total_free_4k_blocks (0),
- _bundles (new BundleList),
- _bundle_xml_node (0),
- _click_io ((IO *) 0),
- click_data (0),
- click_emphasis_data (0),
- main_outs (0),
- _metadata (new SessionMetadata()),
- _have_rec_enabled_diskstream (false)
-{
- playlists.reset (new SessionPlaylists);
-
- bool new_session;
-
- interpolation.add_channel_to (0, 0);
-
- if (!eng.connected()) {
- throw failed_constructor();
- }
-
- info << "Loading session " << fullpath << " using snapshot " << snapshot_name << " (2)" << endl;
-
- n_physical_outputs = _engine.n_physical_outputs (DataType::AUDIO);
- n_physical_inputs = _engine.n_physical_inputs (DataType::AUDIO);
-
- if (n_physical_inputs) {
- n_physical_inputs = max (requested_physical_in, n_physical_inputs);
- }
-
- if (n_physical_outputs) {
- n_physical_outputs = max (requested_physical_out, n_physical_outputs);
- }
-
- first_stage_init (fullpath, snapshot_name);
-
- new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
-
- if (new_session) {
- if (create (new_session, string(), initial_length)) {
- destroy ();
- throw failed_constructor ();
- }
- }
-
- {
- /* set up Master Out and Control Out if necessary */
-
- RouteList rl;
- int control_id = 1;
-
- if (master_out_channels) {
- ChanCount count(DataType::AUDIO, master_out_channels);
- Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO);
- boost_debug_shared_ptr_mark_interesting (rt, "Route");
- boost::shared_ptr<Route> r (rt);
- r->input()->ensure_io (count, false, this);
- r->output()->ensure_io (count, false, this);
- r->set_remote_control_id (control_id);
-
- rl.push_back (r);
- } else {
- /* prohibit auto-connect to master, because there isn't one */
- output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
- }
-
- if (Config->get_use_monitor_bus()) {
- 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);
- r->input()->ensure_io (count, false, this);
- r->output()->ensure_io (count, false, this);
- r->set_remote_control_id (control_id++);
-
- rl.push_back (r);
- }
-
- if (!rl.empty()) {
- add_routes (rl, false);
- }
-
- }
-
- if (no_auto_connect()) {
- input_ac = AutoConnectOption (0);
- output_ac = AutoConnectOption (0);
- }
-
- Config->set_input_auto_connect (input_ac);
- Config->set_output_auto_connect (output_ac);
-
- if (second_stage_init (new_session)) {
- destroy ();
- throw failed_constructor ();
- }
-
- store_recent_sessions (_name, _path);
-
- _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
-
- Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, false));
-}
-
Session::~Session ()
{
destroy ();
@@ -406,7 +272,7 @@ Session::destroy ()
auditioner.reset ();
_master_out.reset ();
- _control_out.reset ();
+ _monitor_out.reset ();
{
RCUWriter<RouteList> writer (routes);
@@ -482,7 +348,7 @@ Session::set_worst_io_latencies ()
}
void
-Session::when_engine_running (bool new_session)
+Session::when_engine_running ()
{
string first_physical_output;
@@ -643,13 +509,13 @@ Session::when_engine_running (bool new_session)
BootMessage (_("Setup signal flow and plugins"));
- hookup_io (new_session);
+ hookup_io ();
- if (new_session && !no_auto_connect()) {
+ if (_is_new && !no_auto_connect()) {
/* 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 (_master_out && Config->get_auto_connect_standard_busses() && !_monitor_out) {
/* if requested auto-connect the outputs to the first N physical ports.
*/
@@ -670,7 +536,7 @@ Session::when_engine_running (bool new_session)
}
}
- if (_control_out) {
+ if (_monitor_out) {
/* AUDIO ONLY as of june 29th 2009, because listen semantics for anything else
are undefined, at best.
@@ -680,16 +546,16 @@ Session::when_engine_running (bool new_session)
under some conditions)
*/
- uint32_t limit = _control_out->n_inputs().n_audio();
+ uint32_t limit = _monitor_out->n_inputs().n_audio();
if (_master_out) {
for (uint32_t n = 0; n < limit; ++n) {
- AudioPort* p = _control_out->input()->ports().nth_audio_port (n);
+ AudioPort* p = _monitor_out->input()->ports().nth_audio_port (n);
AudioPort* o = _master_out->output()->ports().nth_audio_port (n);
if (o) {
string connect_to = o->name();
- if (_control_out->input()->connect (p, connect_to, this)) {
+ if (_monitor_out->input()->connect (p, connect_to, this)) {
error << string_compose (_("cannot connect control input %1 to %2"), n, connect_to)
<< endmsg;
break;
@@ -701,14 +567,14 @@ Session::when_engine_running (bool new_session)
/* if control out is not connected, connect control out to physical outs
*/
- if (!_control_out->output()->connected ()) {
+ if (!_monitor_out->output()->connected ()) {
if (!Config->get_monitor_bus_preferred_bundle().empty()) {
boost::shared_ptr<Bundle> b = bundle_by_name (Config->get_monitor_bus_preferred_bundle());
if (b) {
- _control_out->output()->connect_ports_to_bundle (b, this);
+ _monitor_out->output()->connect_ports_to_bundle (b, this);
} else {
warning << string_compose (_("The preferred I/O for the monitor bus (%1) cannot be found"),
Config->get_monitor_bus_preferred_bundle())
@@ -719,15 +585,15 @@ Session::when_engine_running (bool new_session)
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
uint32_t mod = _engine.n_physical_outputs (*t);
- uint32_t limit = _control_out->n_outputs().get(*t);
+ uint32_t limit = _monitor_out->n_outputs().get(*t);
for (uint32_t n = 0; n < limit; ++n) {
- Port* p = _control_out->output()->ports().port(*t, n);
+ Port* p = _monitor_out->output()->ports().port(*t, n);
string connect_to = _engine.get_nth_physical_output (*t, (n % mod));
if (!connect_to.empty()) {
- if (_control_out->output()->connect (p, connect_to, this)) {
+ if (_monitor_out->output()->connect (p, connect_to, this)) {
error << string_compose (
_("cannot connect control output %1 to %2"),
n, connect_to)
@@ -754,7 +620,7 @@ Session::when_engine_running (bool new_session)
}
void
-Session::hookup_io (bool new_session)
+Session::hookup_io ()
{
/* stop graph reordering notifications from
causing resorts, etc.
@@ -799,11 +665,11 @@ Session::hookup_io (bool new_session)
they connect to the control out specifically.
*/
- if (_control_out) {
+ if (_monitor_out) {
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator x = r->begin(); x != r->end(); ++x) {
- if ((*x)->is_control()) {
+ if ((*x)->is_monitor()) {
/* relax */
@@ -813,7 +679,7 @@ Session::hookup_io (bool new_session)
} else {
- (*x)->listen_via (_control_out,
+ (*x)->listen_via (_monitor_out,
(Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader),
false, false);
}
@@ -2043,7 +1909,7 @@ Session::add_routes (RouteList& new_routes, bool save)
we will resort when done.
*/
- if (!_control_out && IO::connecting_legal) {
+ if (!_monitor_out && IO::connecting_legal) {
resort_routes_using (r);
}
}
@@ -2064,20 +1930,20 @@ Session::add_routes (RouteList& new_routes, bool save)
_master_out = r;
}
- if (r->is_control()) {
- _control_out = r;
+ if (r->is_monitor()) {
+ _monitor_out = r;
}
}
- if (_control_out && IO::connecting_legal) {
+ if (_monitor_out && IO::connecting_legal) {
for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) {
- if ((*x)->is_control()) {
+ if ((*x)->is_monitor()) {
/* relax */
} else if ((*x)->is_master()) {
/* relax */
} else {
- (*x)->listen_via (_control_out,
+ (*x)->listen_via (_monitor_out,
(Config->get_listen_position() == AfterFaderListen ? PostFader : PreFader),
false, false);
}
@@ -2167,7 +2033,7 @@ Session::globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p
void
Session::add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::shared_ptr<RouteList> senders)
{
- if (dest->is_control() || dest->is_master()) {
+ if (dest->is_monitor() || dest->is_master()) {
return;
}
@@ -2177,7 +2043,7 @@ Session::add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::
for (RouteList::iterator i = senders->begin(); i != senders->end(); ++i) {
- if ((*i)->is_control() || (*i)->is_master() || (*i) == dest) {
+ if ((*i)->is_monitor() || (*i)->is_master() || (*i) == dest) {
continue;
}
@@ -2230,15 +2096,15 @@ Session::remove_route (shared_ptr<Route> route)
_master_out = shared_ptr<Route> ();
}
- if (route == _control_out) {
+ if (route == _monitor_out) {
/* cancel control outs for all routes */
for (RouteList::iterator r = rs->begin(); r != rs->end(); ++r) {
- (*r)->drop_listen (_control_out);
+ (*r)->drop_listen (_monitor_out);
}
- _control_out.reset ();
+ _monitor_out.reset ();
}
update_route_solo_state ();
@@ -2361,7 +2227,7 @@ Session::route_solo_changed (void* /*src*/, boost::weak_ptr<Route> wpr)
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
bool via_sends_only;
- if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_control() || (*i)->is_hidden()) {
+ if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_hidden()) {
continue;
} else if ((*i)->feeds (route, &via_sends_only)) {
if (!via_sends_only) {
@@ -2378,8 +2244,8 @@ Session::route_solo_changed (void* /*src*/, boost::weak_ptr<Route> wpr)
/* ditto for control outs make sure master is never muted by solo */
- if (_control_out && route != _control_out && _control_out && _control_out->soloed_by_others() == 0) {
- _control_out->mod_solo_by_others (1);
+ if (_monitor_out && route != _monitor_out && _monitor_out && _monitor_out->soloed_by_others() == 0) {
+ _monitor_out->mod_solo_by_others (1);
}
solo_update_disabled = false;
@@ -2401,7 +2267,7 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r)
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->is_master() && !(*i)->is_control() && !(*i)->is_hidden() && (*i)->self_soloed()) {
+ if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden() && (*i)->self_soloed()) {
something_soloed = true;
break;
}
@@ -3295,10 +3161,10 @@ Session::cancel_audition ()
bool
Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b)
{
- if (a->is_control()) {
+ if (a->is_monitor()) {
return true;
}
- if (b->is_control()) {
+ if (b->is_monitor()) {
return false;
}
return a->order_key(N_("signal")) < b->order_key(N_("signal"));
@@ -4089,7 +3955,7 @@ Session::listen_position_changed ()
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->put_control_outs_at (p);
+ (*i)->put_monitor_send_at (p);
}
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 1d785c52f3..9e7a652f51 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -285,11 +285,11 @@ Session::first_stage_init (string fullpath, string snapshot_name)
}
int
-Session::second_stage_init (bool new_session)
+Session::second_stage_init ()
{
AudioFileSource::set_peak_dir (_session_dir->peak_path().to_string());
- if (!new_session) {
+ if (!_is_new) {
if (load_state (_current_snapshot_name)) {
return -1;
}
@@ -339,7 +339,7 @@ Session::second_stage_init (bool new_session)
_engine.Xrun.connect_same_thread (*this, boost::bind (&Session::xrun_recovery, this));
try {
- when_engine_running (new_session);
+ when_engine_running ();
}
/* handle this one in a different way than all others, so that its clear what happened */
@@ -369,7 +369,7 @@ Session::second_stage_init (bool new_session)
ControlProtocolManager::instance().set_session (this);
- config.set_end_marker_is_free (new_session);
+ config.set_end_marker_is_free (_is_new);
_state_of_the_state = Clean;
@@ -495,7 +495,7 @@ Session::ensure_subdirs ()
}
int
-Session::create (bool& new_session, const string& mix_template, nframes_t initial_length)
+Session::create (const string& mix_template, nframes_t initial_length, BusProfile* bus_profile)
{
if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
@@ -507,8 +507,6 @@ Session::create (bool& new_session, const string& mix_template, nframes_t initia
return -1;
}
- /* check new_session so we don't overwrite an existing one */
-
if (!mix_template.empty()) {
std::string in_path = mix_template;
@@ -523,11 +521,6 @@ Session::create (bool& new_session, const string& mix_template, nframes_t initia
if (out){
out << in.rdbuf();
-
- // okay, session is set up. Treat like normal saved
- // session from now on.
-
- new_session = false;
return 0;
} else {
@@ -557,6 +550,56 @@ Session::create (bool& new_session, const string& mix_template, nframes_t initia
_locations.add (end_location);
_state_of_the_state = Clean;
+
+ /* set up Master Out and Control Out if necessary */
+
+ if (bus_profile) {
+
+ RouteList rl;
+ int control_id = 1;
+ ChanCount count(DataType::AUDIO, bus_profile->master_out_channels);
+
+ if (bus_profile->master_out_channels) {
+ Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO);
+ boost_debug_shared_ptr_mark_interesting (rt, "Route");
+ boost::shared_ptr<Route> r (rt);
+ r->input()->ensure_io (count, false, this);
+ r->output()->ensure_io (count, false, this);
+ r->set_remote_control_id (control_id++);
+
+ rl.push_back (r);
+
+ if (Config->get_use_monitor_bus()) {
+ Route* rt = new Route (*this, _("monitor"), Route::MonitorOut, DataType::AUDIO);
+ boost_debug_shared_ptr_mark_interesting (rt, "Route");
+ boost::shared_ptr<Route> r (rt);
+ r->input()->ensure_io (count, false, this);
+ r->output()->ensure_io (count, false, this);
+ r->set_remote_control_id (control_id);
+
+ rl.push_back (r);
+ }
+
+ } else {
+ /* prohibit auto-connect to master, because there isn't one */
+ bus_profile->output_ac = AutoConnectOption (bus_profile->output_ac & ~AutoConnectMaster);
+ }
+
+ if (!rl.empty()) {
+ add_routes (rl, false);
+ }
+
+ /* this allows the user to override settings with an environment variable.
+ */
+
+ if (no_auto_connect()) {
+ bus_profile->input_ac = AutoConnectOption (0);
+ bus_profile->output_ac = AutoConnectOption (0);
+ }
+
+ Config->set_input_auto_connect (bus_profile->input_ac);
+ Config->set_output_auto_connect (bus_profile->output_ac);
+ }
save_state ("");
@@ -751,6 +794,7 @@ Session::save_state (string snapshot_name, bool pending)
bool was_dirty = dirty();
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
+ _is_new = false;
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
@@ -1049,8 +1093,8 @@ Session::state(bool full_state)
/* the sort should have put control outs first */
- if (_control_out) {
- assert (_control_out == public_order.front());
+ if (_monitor_out) {
+ assert (_monitor_out == public_order.front());
}
for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) {
@@ -2698,7 +2742,7 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
if (str == "master") {
r = _master_out;
} else if (str == "control" || str == "listen") {
- r = _control_out;
+ r = _monitor_out;
} else {
r = route_by_name (desc.top_level_name());
}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 1a16902c80..98d903c2e9 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -222,7 +222,7 @@ MackieControlProtocol::get_sorted_routes()
route.active()
&& !route.is_master()
&& !route.is_hidden()
- && !route.is_control()
+ && !route.is_monitor()
&& remote_ids.find (route.remote_control_id()) == remote_ids.end()
)
{