2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2007-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/doi.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/io.h"
|
2014-01-13 09:13:37 -05:00
|
|
|
#include "ardour/panner_manager.h"
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/rc_configuration.h"
|
2019-09-29 15:22:30 -04:00
|
|
|
#include "ardour/send.h"
|
2022-10-11 00:10:14 -04:00
|
|
|
#include "ardour/session.h"
|
2009-01-30 15:18:31 -05:00
|
|
|
|
2019-09-29 15:22:30 -04:00
|
|
|
#include "gui_thread.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "io_selector.h"
|
2019-09-29 15:22:30 -04:00
|
|
|
#include "send_ui.h"
|
2014-12-25 10:02:00 -05:00
|
|
|
#include "timers.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2010-05-07 21:20:33 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
SendUI::SendUI (Gtk::Window* parent, Session* session, std::shared_ptr<Send> s)
|
2008-12-08 11:07:28 -05:00
|
|
|
: _send (s)
|
2022-10-11 00:10:14 -04:00
|
|
|
, _invert_button (X_("Ø"))
|
2009-12-17 13:24:23 -05:00
|
|
|
, _gpm (session, 250)
|
|
|
|
, _panners (session)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2011-01-10 14:36:00 -05:00
|
|
|
assert (_send);
|
|
|
|
|
2019-09-29 15:03:27 -04:00
|
|
|
uint32_t const in = _send->pans_required ();
|
|
|
|
uint32_t const out = _send->pan_outs ();
|
2022-10-11 00:10:14 -04:00
|
|
|
|
2019-09-29 15:03:27 -04:00
|
|
|
_panners.set_width (Wide);
|
|
|
|
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
|
|
|
_panners.set_panner (s->panner_shell (), s->panner ());
|
|
|
|
|
|
|
|
_send->set_metering (true);
|
2022-10-11 00:10:14 -04:00
|
|
|
_send->output ()->changed.connect (_send_connection, invalidator (*this), boost::bind (&SendUI::outs_changed, this, _1, _2), gui_context ());
|
2019-09-29 15:03:27 -04:00
|
|
|
|
|
|
|
_gpm.setup_meters ();
|
|
|
|
_gpm.set_fader_name (X_("SendUIFader"));
|
2023-02-16 18:33:28 -05:00
|
|
|
_gpm.set_controls (std::shared_ptr<Route> (), s->meter (), s->amp (), s->gain_control ());
|
2019-09-29 15:03:27 -04:00
|
|
|
|
|
|
|
_io = Gtk::manage (new IOSelector (parent, session, s->output ()));
|
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
_invert_button.set_controllable (_send->polarity_control ());
|
|
|
|
_invert_button.watch ();
|
|
|
|
_invert_button.set_name (X_("invert button"));
|
|
|
|
_invert_button.signal_button_press_event ().connect (sigc::mem_fun (*this, &SendUI::invert_press), false);
|
|
|
|
_invert_button.signal_button_release_event ().connect (sigc::mem_fun (*this, &SendUI::invert_release), false);
|
|
|
|
Gtkmm2ext::UI::instance ()->set_tip (_invert_button, _("Click to invert polarity of all send channels"));
|
2019-09-29 15:03:27 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
set_name (X_("SendUIFrame"));
|
2019-09-29 15:03:27 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
_vbox.set_spacing (4);
|
|
|
|
_vbox.set_border_width (4);
|
|
|
|
_vbox.pack_start (_gpm, false, false, false);
|
|
|
|
_vbox.pack_start (_invert_button, false, false);
|
2014-01-13 04:50:49 -05:00
|
|
|
_vbox.pack_start (_panners, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-07 13:31:18 -04:00
|
|
|
pack_start (_vbox, false, false);
|
2019-09-29 15:03:27 -04:00
|
|
|
pack_start (*_io, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2019-09-29 15:03:27 -04:00
|
|
|
_io->show ();
|
2022-10-11 00:10:14 -04:00
|
|
|
_vbox.show_all ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
_fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun (*this, &SendUI::fast_update));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SendUI::~SendUI ()
|
|
|
|
{
|
2006-07-27 12:52:14 -04:00
|
|
|
_send->set_metering (false);
|
2022-10-11 00:10:14 -04:00
|
|
|
_fast_screen_update_connection.disconnect ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-02 13:01:36 -04:00
|
|
|
SendUI::outs_changed (IOChange change, void* /*ignored*/)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &SendUI::outs_changed, change, ignored)
|
2010-08-30 18:34:21 -04:00
|
|
|
if (change.type & IOChange::ConfigurationChanged) {
|
2019-09-29 15:22:30 -04:00
|
|
|
uint32_t const in = _send->pans_required ();
|
|
|
|
uint32_t const out = _send->pan_outs ();
|
2014-01-13 09:13:37 -05:00
|
|
|
if (_panners._panner == 0) {
|
2019-09-29 15:22:30 -04:00
|
|
|
_panners.set_panner (_send->panner_shell (), _send->panner ());
|
2014-01-13 09:13:37 -05:00
|
|
|
}
|
2019-09-29 15:22:30 -04:00
|
|
|
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
2009-05-07 13:31:18 -04:00
|
|
|
_panners.setup_pan ();
|
2014-01-13 09:13:37 -05:00
|
|
|
_panners.show_all ();
|
2009-05-07 13:31:18 -04:00
|
|
|
_gpm.setup_meters ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SendUI::fast_update ()
|
|
|
|
{
|
2022-01-26 15:17:53 -05:00
|
|
|
if (!get_mapped ()) {
|
2013-08-23 15:26:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-09-29 15:22:30 -04:00
|
|
|
if (Config->get_meter_falloff () > 0.0f) {
|
2009-05-07 13:31:18 -04:00
|
|
|
_gpm.update_meters ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
bool
|
|
|
|
SendUI::invert_press (GdkEventButton* ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2022-10-11 00:10:14 -04:00
|
|
|
if (ArdourWidgets::BindingProxy::is_bind_action (ev)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
if (ev->button != 1 || ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
|
|
|
|
return true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = _send->polarity_control ();
|
2022-10-11 00:10:14 -04:00
|
|
|
ac->start_touch (timepos_t (ac->session ().audible_sample ()));
|
|
|
|
return true;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2022-10-11 00:10:14 -04:00
|
|
|
bool
|
|
|
|
SendUI::invert_release (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (ev->button != 1 || ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
|
|
|
|
return true;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AutomationControl> ac = _send->polarity_control ();
|
2022-10-11 00:10:14 -04:00
|
|
|
ac->set_value (_invert_button.get_active () ? 0 : 1, PBD::Controllable::NoGroup);
|
|
|
|
ac->stop_touch (timepos_t (ac->session ().audible_sample ()));
|
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
SendUIWindow::SendUIWindow (Gtk::Window& parent, ARDOUR::Session* session, std::shared_ptr<Send> send)
|
2022-10-11 00:10:14 -04:00
|
|
|
: ArdourWindow (parent, string_compose (_("Send: %1"), send->name ()))
|
|
|
|
, _ui (this, session, send)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2022-10-11 00:10:14 -04:00
|
|
|
set_name ("SendUIWindow");
|
|
|
|
add (_ui);
|
|
|
|
_ui.show ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2023-05-15 16:47:12 -04:00
|
|
|
|
|
|
|
SendUIWindow::SendUIWindow (ARDOUR::Session* session, std::shared_ptr<Send> send)
|
|
|
|
: ArdourWindow (string_compose (_("Send: %1"), send->name ()))
|
|
|
|
, _ui (this, session, send)
|
|
|
|
{
|
|
|
|
set_name ("SendUIWindow");
|
|
|
|
add (_ui);
|
|
|
|
_ui.show ();
|
|
|
|
}
|