diff options
author | Carl Hetherington <carl@carlh.net> | 2010-11-25 23:46:24 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-11-25 23:46:24 +0000 |
commit | 54cbc45a5a40f4eefd64fa41ad9029f5f8f6a84f (patch) | |
tree | 558e7cb27683030787fcb4d5654bd4b58ebd8e21 /libs/ardour/session.cc | |
parent | 28c004f4fb0750b6a4236552bcc8de4946b9b164 (diff) |
Prevent removal of route inputs when the plugins cannot be configured with the new number. Rework locking so that the process lock is held from the point that a route input is removed until after the processors are reconfigured; fixes #3548.
git-svn-id: svn://localhost/ardour2/branches/3.0@8089 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 89 |
1 files changed, 51 insertions, 38 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index f5df3a0e6b..64c5a173c4 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1504,6 +1504,7 @@ Session::count_existing_route_channels (ChanCount& in, ChanCount& out) } } +/** Caller must not hold process lock */ list<boost::shared_ptr<MidiTrack> > Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_many) { @@ -1541,15 +1542,17 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m boost_debug_shared_ptr_mark_interesting (mt, "Track"); track = boost::shared_ptr<MidiTrack>(mt); - if (track->input()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) { - error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg; - goto failed; - } - + { + Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); + if (track->input()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) { + error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg; + goto failed; + } - if (track->output()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) { - error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg; - goto failed; + if (track->output()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) { + error << "cannot configure 1 in/1 out configuration for new midi track" << endmsg; + goto failed; + } } auto_connect_route (track.get(), existing_inputs, existing_outputs); @@ -1590,7 +1593,8 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m return ret; } -/** @param connect_inputs true to connect inputs as well as outputs, false to connect just outputs. +/** Caller must hold process lock. + * @param connect_inputs true to connect inputs as well as outputs, false to connect just outputs. * @param input_start Where to start from when auto-connecting inputs; e.g. if this is 0, auto-connect starting from input 0. * @param output_start As \a input_start, but for outputs. */ @@ -1669,6 +1673,7 @@ Session::auto_connect_route ( existing_outputs += route->n_outputs(); } +/** Caller must not hold process lock */ list< boost::shared_ptr<AudioTrack> > Session::new_audio_track (int input_channels, int output_channels, TrackMode mode, RouteGroup* route_group, uint32_t how_many) { @@ -1706,23 +1711,27 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod boost_debug_shared_ptr_mark_interesting (at, "Track"); track = boost::shared_ptr<AudioTrack>(at); - if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { - error << string_compose ( - _("cannot configure %1 in/%2 out configuration for new audio track"), - input_channels, output_channels) - << endmsg; - goto failed; - } + { + Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); - if (track->output()->ensure_io (ChanCount(DataType::AUDIO, output_channels), false, this)) { - error << string_compose ( - _("cannot configure %1 in/%2 out configuration for new audio track"), - input_channels, output_channels) - << endmsg; - goto failed; - } + if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { + error << string_compose ( + _("cannot configure %1 in/%2 out configuration for new audio track"), + input_channels, output_channels) + << endmsg; + goto failed; + } + + if (track->output()->ensure_io (ChanCount(DataType::AUDIO, output_channels), false, this)) { + error << string_compose ( + _("cannot configure %1 in/%2 out configuration for new audio track"), + input_channels, output_channels) + << endmsg; + goto failed; + } - auto_connect_route (track.get(), existing_inputs, existing_outputs); + auto_connect_route (track.get(), existing_inputs, existing_outputs); + } if (route_group) { route_group->add (track); @@ -1787,7 +1796,7 @@ Session::set_remote_control_ids () } } - +/** Caller must not hold process lock */ RouteList Session::new_audio_route (bool aux, int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many) { @@ -1820,23 +1829,27 @@ Session::new_audio_route (bool aux, int input_channels, int output_channels, Rou boost_debug_shared_ptr_mark_interesting (rt, "Route"); shared_ptr<Route> bus (rt); - if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { - error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), - input_channels, output_channels) - << endmsg; - goto failure; - } + { + Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); + if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) { + error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), + input_channels, output_channels) + << endmsg; + goto failure; + } + + + if (bus->output()->ensure_io (ChanCount(DataType::AUDIO, output_channels), false, this)) { + error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), + input_channels, output_channels) + << endmsg; + goto failure; + } - if (bus->output()->ensure_io (ChanCount(DataType::AUDIO, output_channels), false, this)) { - error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), - input_channels, output_channels) - << endmsg; - goto failure; + auto_connect_route (bus.get(), existing_inputs, existing_outputs, false); } - auto_connect_route (bus.get(), existing_inputs, existing_outputs, false); - if (route_group) { route_group->add (bus); } |