diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index bbdb4d7599..bd11d128c3 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2016,16 +2016,6 @@ ARDOUR_UI::open_session () } } -void -ARDOUR_UI::session_add_vca (const string& name_template, uint32_t n) -{ - if (!_session) { - return; - } - - _session->vca_manager().create_vca (n, name_template); -} - void ARDOUR_UI::session_add_mixed_track ( const ChanCount& input, @@ -2038,10 +2028,7 @@ ARDOUR_UI::session_add_mixed_track ( Plugin::PresetRecord* pset, ARDOUR::PresentationInfo::order_t order) { - if (_session == 0) { - warning << _("You cannot add a track without a session already loaded.") << endmsg; - return; - } + assert (_session); if (Profile->get_mixbus ()) { strict_io = true; @@ -2131,10 +2118,7 @@ ARDOUR_UI::session_add_audio_route ( list > tracks; RouteList routes; - if (_session == 0) { - warning << _("You cannot add a track or bus without a session already loaded.") << endmsg; - return; - } + assert (_session); try { if (track) { @@ -4375,6 +4359,11 @@ ARDOUR_UI::add_route () void ARDOUR_UI::add_route_dialog_response (int r) { + if (!_session) { + warning << _("You cannot add tracks or busses without a session already loaded.") << endmsg; + return; + } + int count; switch (r) { @@ -4389,18 +4378,8 @@ ARDOUR_UI::add_route_dialog_response (int r) } std::string template_name = add_route_dialog->get_template_path(); - if ( !template_name.empty() ) { - - if (!template_name.empty() && template_name.substr (0, 11) == "urn:ardour:") { - - //ret = build_session_from_dialog (session_dialog, session_path, session_name); - meta_session_setup (template_name.substr (11)); - - } else { - - //could be a user's track template (from file). ToDo - } - + if (!template_name.empty() && template_name.substr (0, 11) == "urn:ardour:") { + meta_session_setup (template_name.substr (11)); return; } @@ -4442,22 +4421,22 @@ ARDOUR_UI::add_route_dialog_response (int r) switch (add_route_dialog->type_wanted()) { case AddRouteDialog::AudioTrack: - session_add_audio_track (input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io, order); + session_add_audio_route (true, input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io, order); break; case AddRouteDialog::MidiTrack: - session_add_midi_track (route_group, count, name_template, strict_io, instrument, 0, order); + session_add_midi_route (true, route_group, count, name_template, strict_io, instrument, 0, order); break; case AddRouteDialog::MixedTrack: session_add_mixed_track (input_chan, output_chan, route_group, count, name_template, strict_io, instrument, 0, order); break; case AddRouteDialog::AudioBus: - session_add_audio_bus (input_chan.n_audio(), output_chan.n_audio(), route_group, count, name_template, strict_io, order); + session_add_audio_route (false, input_chan.n_audio(), output_chan.n_audio(), ARDOUR::Normal, route_group, count, name_template, strict_io, order); break; case AddRouteDialog::MidiBus: session_add_midi_bus (route_group, count, name_template, strict_io, instrument, 0, order); break; case AddRouteDialog::VCAMaster: - session_add_vca (name_template, count); + _session->vca_manager().create_vca (count, name_template); break; } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index bc63d79d80..ae1cd9c132 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -282,54 +282,21 @@ public: void flush_videotimeline_cache (bool localcacheonly=false); void export_video (bool range = false); - void session_add_vca (std::string const &, uint32_t); - void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order); - void session_add_audio_track ( - int input_channels, - int32_t output_channels, - ARDOUR::TrackMode mode, - ARDOUR::RouteGroup* route_group, - uint32_t how_many, - std::string const & name_template, - bool strict_io, - ARDOUR::PresentationInfo::order_t order - ) { - session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template, strict_io, order); - } - void session_add_audio_bus ( - int input_channels, - int32_t output_channels, - ARDOUR::RouteGroup* route_group, - uint32_t how_many, - std::string const & name_template, - bool strict_io, - ARDOUR::PresentationInfo::order_t order - ) { - session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template, strict_io, order); - } - - void session_add_midi_track ( - ARDOUR::RouteGroup* route_group, - uint32_t how_many, - std::string const & name_template, - bool strict_io, - ARDOUR::PluginInfoPtr instrument, - ARDOUR::Plugin::PresetRecord* preset, - ARDOUR::PresentationInfo::order_t order - ) { - session_add_midi_route (true, route_group, how_many, name_template, strict_io, instrument, preset, order); - } - - void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, + void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, + uint32_t, std::string const &, bool strict_io, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset, ARDOUR::PresentationInfo::order_t order); - void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset, + + void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool strict_io, + ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord* pset, ARDOUR::PresentationInfo::order_t order); + void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*, ARDOUR::PresentationInfo::order_t order); + void display_insufficient_ports_message (); void attach_to_engine (); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 047104ac71..13269bb1c7 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -2055,7 +2055,7 @@ Mixer_UI::scroller_drag_data_received (const Glib::RefPtr& con if (!pip->is_instrument ()) { continue; } - ARDOUR_UI::instance()->session_add_midi_track ((RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order); + ARDOUR_UI::instance()->session_add_midi_route (true, (RouteGroup*) 0, 1, _("MIDI"), Config->get_strict_io (), pip, ppp->_preset.valid ? &ppp->_preset : 0, PresentationInfo::max_order); ok = true; }