2 * Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2007-2012 David Robillard <d@drobilla.net>
5 * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
6 * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <gtkmm2ext/doi.h>
25 #include "ardour/io.h"
26 #include "ardour/panner_manager.h"
27 #include "ardour/rc_configuration.h"
28 #include "ardour/send.h"
30 #include "gui_thread.h"
31 #include "io_selector.h"
38 using namespace ARDOUR;
41 SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
48 uint32_t const in = _send->pans_required ();
49 uint32_t const out = _send->pan_outs ();
50 _panners.set_width (Wide);
51 _panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
52 _panners.set_panner (s->panner_shell (), s->panner ());
54 _send->set_metering (true);
55 _send->output ()->changed.connect (connections, invalidator (*this), boost::bind (&SendUI::outs_changed, this, _1, _2), gui_context ());
58 _gpm.set_fader_name (X_("SendUIFader"));
59 _gpm.set_controls (boost::shared_ptr<Route> (), s->meter (), s->amp (), s->gain_control ());
61 _io = Gtk::manage (new IOSelector (parent, session, s->output ()));
63 set_name (X_("SendUIFrame"));
65 _hbox.pack_start (_gpm, true, true);
67 _vbox.set_spacing (5);
68 _vbox.set_border_width (5);
69 _vbox.pack_start (_hbox, false, false, false);
70 _vbox.pack_start (_panners, false, false);
72 pack_start (_vbox, false, false);
73 pack_start (*_io, true, true);
81 fast_screen_update_connection = Timers::super_rapid_connect (
82 sigc::mem_fun (*this, &SendUI::fast_update));
87 _send->set_metering (false);
89 screen_update_connection.disconnect ();
90 fast_screen_update_connection.disconnect ();
94 SendUI::outs_changed (IOChange change, void* /*ignored*/)
96 ENSURE_GUI_THREAD (*this, &SendUI::outs_changed, change, ignored)
97 if (change.type & IOChange::ConfigurationChanged) {
98 uint32_t const in = _send->pans_required ();
99 uint32_t const out = _send->pan_outs ();
100 if (_panners._panner == 0) {
101 _panners.set_panner (_send->panner_shell (), _send->panner ());
103 _panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
104 _panners.setup_pan ();
105 _panners.show_all ();
106 _gpm.setup_meters ();
116 SendUI::fast_update ()
122 if (Config->get_meter_falloff () > 0.0f) {
123 _gpm.update_meters ();
127 SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
128 : ArdourWindow (string (_("Send ")) + s->name ())
130 ui = new SendUI (this, s, session);
132 hpacker.pack_start (*ui, true, true);
136 set_name ("SendUIWindow");
142 SendUIWindow::~SendUIWindow ()