Allow ListenBus to be added by GUI
authorLen Ovens <len@ovenwerks.net>
Thu, 1 Nov 2018 20:13:06 +0000 (13:13 -0700)
committerLen Ovens <len@ovenwerks.net>
Thu, 1 Nov 2018 20:13:48 +0000 (13:13 -0700)
gtk2_ardour/add_route_dialog.cc
gtk2_ardour/add_route_dialog.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h

index 1c578676017b3ac6c01a615f1762b46936f8c96f..57c9cc2719a4b00c0a2e72f24d5c51a024192d92 100644 (file)
@@ -134,15 +134,15 @@ The track will be added in the location specified by \"Position\".\n \
                ));
                builtin_types.push_back (
                        std::pair<string,string>(_("Audio Busses"),  _(" \
-Use the settings, below, to create new Audio Tracks.\n \
+Use the settings, below, to create new Audio Busses.\n \
 \n\n \
 You may select:\n \
-* The number of buses to add.\n \
-* A Name for the track(s).\n \
-* A Group which will be assigned to the track(s).\n \
+* The number of busses to add.\n \
+* A Name for the busses.\n \
+* A Group which will be assigned to the Busses.\n \
 * Pin Connections mode. (see tooltip for details).\n \
 \n \
-The track will be added in the location specified by \"Position\".\n \
+The Busses will be added in the location specified by \"Position\".\n \
 ")
                ));
                builtin_types.push_back (
@@ -150,16 +150,16 @@ The track will be added in the location specified by \"Position\".\n \
 Use the settings, below, to create new MIDI Busses.\n \
 \n \
 MIDI Busses can combine the output of multiple tracks. \n \
-MIDI Buses are sometimes used to host a single \"heavy\" instrument plugin which is fed from multiple MIDI tracks.  \
+MIDI Busses are sometimes used to host a single \"heavy\" instrument plugin which is fed from multiple MIDI tracks.  \
 \n\n \
 You may select:\n \
-* The number of buses to add.\n \
-* A Name for the track(s).\n \
+* The number of busses to add.\n \
+* A Name for the busses.\n \
 * An Instrument plugin (or select \"None\" to drive an external device)\n \
-* A Group which will be assigned to the track(s).\n \
+* A Group which will be assigned to the busses.\n \
 * Pin Connections mode. (see tooltip for details).\n \
 \n \
-The track will be added in the location specified by \"Position\".\n \
+The busses will be added in the location specified by \"Position\".\n \
 ")
                ));
                builtin_types.push_back (
@@ -169,6 +169,17 @@ Use the settings, below, to create 1 or more VCA Master(s).\n \
 You may select:\n \
 * The number of VCAs to add.\n \
 * A name for the new VCAs.  \"%n\" will be replaced by an index number for each VCA.\n \
+")
+               ));
+               builtin_types.push_back (
+                       std::pair<string,string>(_("Listen Busses"),   _(" \
+Use the settings, below, to create new Listen Busses.\n \
+Listen Busses are used as master outputs for monitor channels which are fed by\n \
+hidden monitor sends.\n \
+\n\n \
+You may select:\n \
+* The number of Listen Busses to add.\n \
+* A name for the new Listen Busses.\n \
 ")
                ));
        }
@@ -569,6 +580,8 @@ AddRouteDialog::type_wanted()
                return AudioTrack;
        } else if (str == _("VCA Masters")) {
                return VCAMaster;
+       } else if (str == _("Listen Busses")) {
+               return ListenBus;
        } else {
                assert (0);
                return AudioTrack;
@@ -596,6 +609,9 @@ AddRouteDialog::maybe_update_name_template_entry ()
        case MidiBus:
                name_template_entry.set_text (_("Bus"));
                break;
+       case ListenBus:
+               name_template_entry.set_text (_("Listener"));
+               break;
        case VCAMaster:
                name_template_entry.set_text (VCA::default_name_template());
                break;
@@ -740,6 +756,27 @@ AddRouteDialog::track_type_chosen ()
                insert_label.set_sensitive (true);
                insert_at_combo.set_sensitive (true);
 
+               break;
+       case ListenBus:
+
+               configuration_label.set_sensitive (false);
+               channel_combo.set_sensitive (false);
+
+               mode_label.set_sensitive (false);
+               mode_combo.set_sensitive (false);
+
+               instrument_label.set_sensitive (false);
+               instrument_combo.set_sensitive (false);
+
+               group_label.set_sensitive (false);
+               route_group_combo.set_sensitive (false);
+
+               strict_io_label.set_sensitive (false);
+               strict_io_combo.set_sensitive (false);
+
+               insert_label.set_sensitive (false);
+               insert_at_combo.set_sensitive (false);
+
                break;
        }
 
@@ -840,6 +877,12 @@ AddRouteDialog::channels ()
                ret.set (DataType::AUDIO, channel_count ());
                ret.set (DataType::MIDI, 1);
                break;
+
+       case ListenBus:
+               ret.set (DataType::AUDIO, 2);
+               ret.set (DataType::MIDI, 0);
+               break;
+
        default:
                break;
        }
index e5622db3bae2b9f712f638d336c2176db5eaf6d3..381bebee4457bdfb7fd6967ae12cef4a8a3a9d1b 100644 (file)
@@ -67,6 +67,7 @@ public:
                AudioBus,
                MidiBus,
                VCAMaster,
+               ListenBus,
        };
        TypeWanted type_wanted();
 
index 52bccd44d4ddbb3e4f865428df5d453e68615283..32e4e4f473686e59ca327c131a74bbfcd27ae260 100644 (file)
@@ -2119,6 +2119,32 @@ ARDOUR_UI::session_add_audio_route (
        }
 }
 
+void
+ARDOUR_UI::session_add_listen_bus (uint32_t how_many, string const & name_template)
+{
+       RouteList routes;
+
+       assert (_session);
+
+       try {
+               routes = _session->new_audio_route (2, 2, 0, how_many, name_template, PresentationInfo::ListenBus, -1);
+
+               if (routes.size() != how_many) {
+                       error << string_compose (P_("could not create %1 new listen bus", "could not create %1 new listen busses", how_many), how_many)
+                             << endmsg;
+               }
+       }
+
+       catch (...) {
+               display_insufficient_ports_message ();
+               return;
+       }
+
+       for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+               (*i)->set_strict_io (true);
+       }
+}
+
 void
 ARDOUR_UI::display_insufficient_ports_message ()
 {
@@ -4398,6 +4424,9 @@ ARDOUR_UI::add_route_dialog_response (int r)
        case AddRouteDialog::VCAMaster:
                _session->vca_manager().create_vca (count, name_template);
                break;
+       case AddRouteDialog::ListenBus:
+               session_add_listen_bus (count, name_template);
+               break;
        }
 }
 
index 6c5f09cc0f8f3f159e9d6b3c5e21bbd3318d9ced..1f0e1145e98e3bf99f089ce45efe69695e78a9b5 100644 (file)
@@ -300,7 +300,8 @@ public:
        void flush_videotimeline_cache (bool localcacheonly=false);
        void export_video (bool range = false);
 
-       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_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *,
+                                     uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order);
 
        void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*,
                                      uint32_t, std::string const &, bool strict_io,
@@ -315,6 +316,8 @@ public:
                                     ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*,
                                     ARDOUR::PresentationInfo::order_t order);
 
+       void session_add_listen_bus (uint32_t, std::string const &);
+
        void display_insufficient_ports_message ();
 
        void attach_to_engine ();