2019-01-18 13:22:54 -05:00
|
|
|
/*
|
2020-05-07 21:19:17 -04:00
|
|
|
* Copyright (C) 2018-2020 Len Ovens
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
#include "ardour/audioengine.h"
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "ardour/logmeter.h"
|
|
|
|
#include "ardour/meter.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "ardour/pannable.h"
|
|
|
|
#include "ardour/panner_manager.h"
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "ardour/panner_shell.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "ardour/profile.h"
|
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/send.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/user_bundle.h"
|
2019-08-21 23:55:51 -04:00
|
|
|
#include "ardour/value_as_string.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "gtkmm2ext/doi.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "gtkmm2ext/gtk_ui.h"
|
|
|
|
#include "gtkmm2ext/menu_elems.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
2020-05-07 20:12:36 -04:00
|
|
|
#include "pbd/fastlog.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
#include "widgets/tooltips.h"
|
|
|
|
|
|
|
|
#include "ardour_window.h"
|
|
|
|
#include "enums_convert.h"
|
|
|
|
#include "foldback_strip.h"
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "io_selector.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "keyboard.h"
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "mixer_ui.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "public_editor.h"
|
|
|
|
#include "send_ui.h"
|
2019-09-07 17:51:01 -04:00
|
|
|
#include "timers.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
#include "ui_config.h"
|
2021-03-25 21:48:04 -04:00
|
|
|
#include "utils.h"
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace ArdourWidgets;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace std;
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
#define PX_SCALE(px) std::max ((float)px, rintf ((float)px* UIConfiguration::instance ().get_ui_scale ()))
|
2019-08-21 23:55:51 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackSend::FoldbackSend (boost::shared_ptr<Send> snd, boost::shared_ptr<ARDOUR::Route> sr, boost::shared_ptr<ARDOUR::Route> fr, uint32_t wd)
|
2019-08-21 23:55:51 -04:00
|
|
|
: _button (ArdourButton::led_default_elements)
|
|
|
|
, _send (snd)
|
|
|
|
, _send_route (sr)
|
|
|
|
, _foldback_route (fr)
|
|
|
|
, _send_proc (snd)
|
|
|
|
, _send_del (snd)
|
2019-09-14 13:19:01 -04:00
|
|
|
, _width (wd)
|
2021-03-25 21:48:04 -04:00
|
|
|
, _pan_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero))
|
|
|
|
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain ()), 0, 1, 0.01, 0.1)
|
|
|
|
, _slider (&_adjustment, boost::shared_ptr<PBD::Controllable> (), 0, max (13.f, rintf (13.f * UIConfiguration::instance ().get_ui_scale ())))
|
2019-08-21 23:55:51 -04:00
|
|
|
, _ignore_ui_adjustment (true)
|
|
|
|
, _slider_persistant_tooltip (&_slider)
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
HBox* snd_but_pan = new HBox ();
|
2019-08-21 23:55:51 -04:00
|
|
|
|
|
|
|
_button.set_distinct_led_click (true);
|
2021-03-25 21:48:04 -04:00
|
|
|
_button.set_fallthrough_to_parent (true);
|
2019-08-21 23:55:51 -04:00
|
|
|
_button.set_led_left (true);
|
|
|
|
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &FoldbackSend::led_clicked));
|
2020-08-08 21:43:06 -04:00
|
|
|
if (_send_proc->get_pre_fader ()) {
|
|
|
|
_button.set_name ("processor prefader");
|
|
|
|
} else {
|
|
|
|
_button.set_name ("processor postfader");
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
|
2019-09-10 19:08:24 -04:00
|
|
|
_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
|
2019-09-14 13:19:01 -04:00
|
|
|
name_changed ();
|
2019-08-21 23:55:51 -04:00
|
|
|
snd_but_pan->pack_start (_button, true, true);
|
|
|
|
_button.set_active (_send_proc->enabled ());
|
|
|
|
_button.show ();
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
if (_foldback_route->input ()->n_ports ().n_audio () == 2) {
|
|
|
|
_button.set_layout_ellipsize_width (PX_SCALE (_width - 19) * PANGO_SCALE);
|
|
|
|
boost::shared_ptr<Pannable> pannable = _send_del->panner ()->pannable ();
|
2019-08-21 23:55:51 -04:00
|
|
|
boost::shared_ptr<AutomationControl> ac;
|
|
|
|
ac = pannable->pan_azimuth_control;
|
2021-03-25 21:48:04 -04:00
|
|
|
_pan_control.set_size_request (PX_SCALE (19), PX_SCALE (19));
|
|
|
|
_pan_control.set_tooltip_prefix (_("Pan: "));
|
|
|
|
_pan_control.set_name ("trim knob");
|
|
|
|
_pan_control.set_no_show_all (true);
|
|
|
|
snd_but_pan->pack_start (_pan_control, false, false);
|
|
|
|
_pan_control.show ();
|
|
|
|
_pan_control.set_controllable (ac);
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
boost::shared_ptr<AutomationControl> lc;
|
2021-03-25 21:48:04 -04:00
|
|
|
lc = _send->gain_control ();
|
2019-08-21 23:55:51 -04:00
|
|
|
_slider.set_controllable (lc);
|
|
|
|
_slider.set_name ("ProcessorControlSlider");
|
|
|
|
_slider.set_text (_("Level"));
|
|
|
|
|
|
|
|
pack_start (*snd_but_pan, Gtk::PACK_SHRINK);
|
2021-03-25 21:48:04 -04:00
|
|
|
snd_but_pan->show ();
|
2019-08-21 23:55:51 -04:00
|
|
|
pack_start (_slider, true, true);
|
|
|
|
_slider.show ();
|
|
|
|
level_changed ();
|
2019-09-08 13:04:14 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &FoldbackSend::level_adjusted));
|
2019-08-21 23:55:51 -04:00
|
|
|
lc->Changed.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::level_changed, this), gui_context ());
|
|
|
|
_send_proc->ActiveChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::send_state_changed, this), gui_context ());
|
2021-03-25 21:48:04 -04:00
|
|
|
_button.signal_button_press_event ().connect (sigc::mem_fun (*this, &FoldbackSend::button_press));
|
|
|
|
_button.signal_button_release_event ().connect (sigc::mem_fun (*this, &FoldbackSend::button_release));
|
|
|
|
_send_route->PropertyChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::route_property_changed, this, _1), gui_context ());
|
2019-08-21 23:55:51 -04:00
|
|
|
|
|
|
|
show ();
|
|
|
|
}
|
|
|
|
|
|
|
|
FoldbackSend::~FoldbackSend ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
_connections.drop_connections ();
|
2019-09-07 17:51:01 -04:00
|
|
|
_slider.set_controllable (boost::shared_ptr<AutomationControl> ());
|
2021-03-25 21:48:04 -04:00
|
|
|
_pan_control.set_controllable (boost::shared_ptr<AutomationControl> ());
|
|
|
|
_send = boost::shared_ptr<Send> ();
|
|
|
|
_send_route = boost::shared_ptr<Route> ();
|
2019-08-21 23:55:51 -04:00
|
|
|
_foldback_route = boost::shared_ptr<Route> ();
|
2021-03-25 21:48:04 -04:00
|
|
|
_send_proc = boost::shared_ptr<Processor> ();
|
|
|
|
_send_del = boost::shared_ptr<Delivery> ();
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
|
2019-09-10 22:26:00 -04:00
|
|
|
void
|
|
|
|
FoldbackSend::route_property_changed (const PropertyChange& what_changed)
|
|
|
|
{
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
name_changed ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackSend::name_changed ()
|
|
|
|
{
|
2019-09-14 13:19:01 -04:00
|
|
|
_button.set_text (_send_route->name ());
|
2019-09-10 22:26:00 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
ArdourWidgets::set_tooltip (_button, Gtkmm2ext::markup_escape_text (_send_route->name ()));
|
2019-09-10 22:26:00 -04:00
|
|
|
}
|
|
|
|
|
2019-08-21 23:55:51 -04:00
|
|
|
void
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackSend::led_clicked (GdkEventButton* ev)
|
2019-08-21 23:55:51 -04:00
|
|
|
{
|
2021-03-25 21:17:09 -04:00
|
|
|
if (!_send_proc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_button.get_active ()) {
|
|
|
|
_send_proc->enable (false);
|
|
|
|
} else {
|
|
|
|
_send_proc->enable (true);
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:17:09 -04:00
|
|
|
bool
|
2019-09-07 17:51:01 -04:00
|
|
|
FoldbackSend::button_press (GdkEventButton* ev)
|
|
|
|
{
|
2021-03-27 14:33:46 -04:00
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
2019-09-07 17:51:01 -04:00
|
|
|
Menu* menu = build_send_menu ();
|
2021-03-25 21:48:04 -04:00
|
|
|
Gtkmm2ext::anchored_menu_popup (menu, &_button, "", ev->button, ev->time);
|
2019-09-07 17:51:01 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:17:09 -04:00
|
|
|
bool
|
|
|
|
FoldbackSend::button_release (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (!_send_proc) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Keyboard::is_delete_event (ev)) {
|
|
|
|
remove_me ();
|
2021-03-27 10:52:14 -04:00
|
|
|
return true;
|
2021-03-25 21:17:09 -04:00
|
|
|
} else if (Keyboard::is_button2_event (ev)
|
|
|
|
#ifndef __APPLE__
|
2021-03-25 21:48:04 -04:00
|
|
|
&& (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
|
2021-03-25 21:17:09 -04:00
|
|
|
#endif
|
2021-03-25 21:48:04 -04:00
|
|
|
) {
|
2021-03-25 21:17:09 -04:00
|
|
|
_send_proc->enable (!_send_proc->enabled ());
|
2021-03-27 10:52:14 -04:00
|
|
|
return true;
|
2021-03-25 21:17:09 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-08-21 23:55:51 -04:00
|
|
|
void
|
|
|
|
FoldbackSend::send_state_changed ()
|
|
|
|
{
|
|
|
|
_button.set_active (_send_proc->enabled ());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackSend::level_adjusted ()
|
|
|
|
{
|
|
|
|
if (_ignore_ui_adjustment) {
|
|
|
|
return;
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<AutomationControl> lc = _send->gain_control ();
|
2019-08-21 23:55:51 -04:00
|
|
|
|
|
|
|
if (!lc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
lc->set_value (lc->interface_to_internal (_adjustment.get_value ()), Controllable::NoGroup);
|
2019-08-21 23:55:51 -04:00
|
|
|
set_tooltip ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackSend::level_changed ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<AutomationControl> lc = _send->gain_control ();
|
2019-08-21 23:55:51 -04:00
|
|
|
if (!lc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_ignore_ui_adjustment = true;
|
|
|
|
|
|
|
|
const double nval = lc->internal_to_interface (lc->get_value ());
|
2021-03-25 21:48:04 -04:00
|
|
|
if (_adjustment.get_value () != nval) {
|
2019-08-21 23:55:51 -04:00
|
|
|
_adjustment.set_value (nval);
|
|
|
|
set_tooltip ();
|
|
|
|
}
|
|
|
|
|
|
|
|
_ignore_ui_adjustment = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackSend::set_tooltip ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<AutomationControl> lc = _send->gain_control ();
|
2019-08-21 23:55:51 -04:00
|
|
|
|
|
|
|
if (!lc) {
|
|
|
|
return;
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
std::string tt = ARDOUR::value_as_string (lc->desc (), lc->get_value ());
|
|
|
|
string sm = Gtkmm2ext::markup_escape_text (tt);
|
2019-08-21 23:55:51 -04:00
|
|
|
_slider_persistant_tooltip.set_tip (sm);
|
|
|
|
}
|
|
|
|
|
2019-09-07 17:51:01 -04:00
|
|
|
Menu*
|
|
|
|
FoldbackSend::build_send_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
|
|
|
if (!_send) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Menu* menu = manage (new Menu);
|
2019-09-07 17:51:01 -04:00
|
|
|
MenuList& items = menu->items ();
|
|
|
|
menu->set_name ("ArdourContextMenu");
|
|
|
|
|
|
|
|
items.push_back (
|
2021-03-25 21:48:04 -04:00
|
|
|
MenuElem (_("Copy track/bus gain to send"), sigc::bind (sigc::mem_fun (*this, &FoldbackSend::set_gain), -0.1)));
|
2019-09-07 17:51:01 -04:00
|
|
|
items.push_back (
|
2021-03-25 21:48:04 -04:00
|
|
|
MenuElem (_("Set send gain to -inf"), sigc::bind (sigc::mem_fun (*this, &FoldbackSend::set_gain), 0.0)));
|
2019-09-07 17:51:01 -04:00
|
|
|
items.push_back (
|
2021-03-25 21:48:04 -04:00
|
|
|
MenuElem (_("Set send gain to 0dB"), sigc::bind (sigc::mem_fun (*this, &FoldbackSend::set_gain), 1.0)));
|
2021-03-27 14:33:46 -04:00
|
|
|
|
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
|
2020-08-09 12:10:24 -04:00
|
|
|
if (_send_proc->get_pre_fader ()) {
|
|
|
|
items.push_back (
|
2021-03-25 21:48:04 -04:00
|
|
|
MenuElem (_("Set send post fader"), sigc::bind (sigc::mem_fun (*this, &FoldbackSend::set_send_position), true)));
|
2020-08-09 12:10:24 -04:00
|
|
|
} else {
|
|
|
|
items.push_back (
|
2021-03-25 21:48:04 -04:00
|
|
|
MenuElem (_("Set send pre fader"), sigc::bind (sigc::mem_fun (*this, &FoldbackSend::set_send_position), false)));
|
2020-08-09 12:10:24 -04:00
|
|
|
}
|
2021-03-27 14:33:46 -04:00
|
|
|
|
|
|
|
items.push_back (SeparatorElem());
|
2021-03-25 21:48:04 -04:00
|
|
|
items.push_back (MenuElem (_("Remove This Send"), sigc::mem_fun (*this, &FoldbackSend::remove_me)));
|
2019-09-07 17:51:01 -04:00
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackSend::set_gain (float new_gain)
|
|
|
|
{
|
|
|
|
if (new_gain < 0) {
|
2021-03-27 13:26:09 -04:00
|
|
|
/* get level from sending route */
|
2019-09-07 17:51:01 -04:00
|
|
|
new_gain = _send_route->gain_control ()->get_value ();
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<AutomationControl> lc = _send->gain_control ();
|
2019-09-07 17:51:01 -04:00
|
|
|
|
|
|
|
if (!lc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lc->set_value (new_gain, Controllable::NoGroup);
|
|
|
|
}
|
|
|
|
|
2020-08-09 12:10:24 -04:00
|
|
|
void
|
|
|
|
FoldbackSend::set_send_position (bool post)
|
|
|
|
{
|
|
|
|
boost::shared_ptr<Route> new_snd_rt = _send_route;
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Route> new_fb_rt = _foldback_route;
|
|
|
|
float new_level = _send->gain_control ()->get_value ();
|
|
|
|
bool new_enable = _send_proc->enabled ();
|
|
|
|
bool is_pan = false;
|
|
|
|
float new_pan = 0.0;
|
|
|
|
if (_foldback_route->input ()->n_ports ().n_audio () == 2) {
|
|
|
|
is_pan = true;
|
|
|
|
boost::shared_ptr<Pannable> pannable = _send_del->panner ()->pannable ();
|
2020-08-09 12:10:24 -04:00
|
|
|
boost::shared_ptr<Controllable> ac;
|
2021-03-25 21:48:04 -04:00
|
|
|
ac = pannable->pan_azimuth_control;
|
|
|
|
new_pan = ac->get_value ();
|
2020-08-09 12:10:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
remove_me ();
|
|
|
|
new_snd_rt->add_foldback_send (new_fb_rt, post);
|
|
|
|
|
|
|
|
boost::shared_ptr<Send> snd = new_snd_rt->internal_send_for (new_fb_rt);
|
|
|
|
if (snd) {
|
2021-03-25 21:48:04 -04:00
|
|
|
snd->gain_control ()->set_value (new_level, Controllable::NoGroup);
|
2020-08-09 12:10:24 -04:00
|
|
|
boost::shared_ptr<Processor> snd_proc = boost::dynamic_pointer_cast<Processor> (snd);
|
|
|
|
snd_proc->enable (new_enable);
|
|
|
|
if (is_pan) {
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Delivery> new_del = boost::dynamic_pointer_cast<Delivery> (snd);
|
|
|
|
boost::shared_ptr<Pannable> pannable = new_del->panner ()->pannable ();
|
2020-08-09 12:10:24 -04:00
|
|
|
boost::shared_ptr<Controllable> ac;
|
|
|
|
ac = pannable->pan_azimuth_control;
|
2021-03-25 21:48:04 -04:00
|
|
|
ac->set_value (new_pan, Controllable::NoGroup);
|
2020-08-09 12:10:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-07 17:51:01 -04:00
|
|
|
void
|
|
|
|
FoldbackSend::remove_me ()
|
|
|
|
{
|
|
|
|
boost::shared_ptr<Processor> send_proc = boost::dynamic_pointer_cast<Processor> (_send);
|
2021-03-25 21:48:04 -04:00
|
|
|
_connections.drop_connections ();
|
2019-09-07 17:51:01 -04:00
|
|
|
_send_route->remove_processor (send_proc);
|
|
|
|
}
|
|
|
|
|
2021-03-26 18:01:38 -04:00
|
|
|
/* ****************************************************************************/
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
PBD::Signal1<void, FoldbackStrip*> FoldbackStrip::CatchDeletion;
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
FoldbackStrip::FoldbackStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt)
|
|
|
|
: SessionHandlePtr (sess)
|
|
|
|
, RouteUI (sess)
|
2021-03-25 21:48:04 -04:00
|
|
|
, _mixer (mx)
|
2020-04-19 18:48:54 -04:00
|
|
|
, _showing_sends (false)
|
2019-09-14 13:19:01 -04:00
|
|
|
, _width (80)
|
2021-03-27 13:26:09 -04:00
|
|
|
, _panners (sess)
|
|
|
|
, _output_button (false)
|
2019-01-18 13:22:54 -05:00
|
|
|
, _comment_button (_("Comments"))
|
2021-03-27 13:26:09 -04:00
|
|
|
, _level_control (ArdourKnob::default_elements, ArdourKnob::Detent)
|
2020-05-07 20:12:36 -04:00
|
|
|
, _meter (0)
|
2019-01-18 13:22:54 -05:00
|
|
|
{
|
|
|
|
init ();
|
|
|
|
set_route (rt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::init ()
|
|
|
|
{
|
2019-09-08 13:04:14 -04:00
|
|
|
_previous_button.set_name ("mixer strip button");
|
2019-09-12 17:35:57 -04:00
|
|
|
_previous_button.set_icon (ArdourIcon::ScrollLeft);
|
2019-09-08 13:04:14 -04:00
|
|
|
_previous_button.set_tweaks (ArdourButton::Square);
|
2021-03-25 21:48:04 -04:00
|
|
|
UI::instance ()->set_tip (&_previous_button, _("Previous foldback bus"), "");
|
2019-09-11 00:09:54 -04:00
|
|
|
_previous_button.set_sensitive (false);
|
|
|
|
|
2019-09-08 13:04:14 -04:00
|
|
|
_next_button.set_name ("mixer strip button");
|
2019-09-12 17:35:57 -04:00
|
|
|
_next_button.set_icon (ArdourIcon::ScrollRight);
|
2019-09-08 13:04:14 -04:00
|
|
|
_next_button.set_tweaks (ArdourButton::Square);
|
2021-03-25 21:48:04 -04:00
|
|
|
UI::instance ()->set_tip (&_next_button, _("Next foldback bus"), "");
|
2019-09-11 00:09:54 -04:00
|
|
|
_next_button.set_sensitive (false);
|
2019-09-08 13:04:14 -04:00
|
|
|
|
2019-09-11 19:36:05 -04:00
|
|
|
_hide_button.set_name ("mixer strip button");
|
2019-09-12 17:35:57 -04:00
|
|
|
_hide_button.set_icon (ArdourIcon::HideEye);
|
2019-09-11 19:36:05 -04:00
|
|
|
_hide_button.set_tweaks (ArdourButton::Square);
|
|
|
|
set_tooltip (&_hide_button, _("Hide Foldback strip"));
|
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
_number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
|
|
|
|
_number_label.set_no_show_all ();
|
|
|
|
_number_label.set_name ("generic button");
|
|
|
|
_number_label.set_alignment (.5, .5);
|
|
|
|
_number_label.set_fallthrough_to_parent (true);
|
|
|
|
|
|
|
|
_prev_next_box.set_spacing (2);
|
2021-03-27 13:26:09 -04:00
|
|
|
_prev_next_box.pack_start (_previous_button, false, true);
|
|
|
|
_prev_next_box.pack_start (_next_button, false, true);
|
2021-03-27 18:14:19 -04:00
|
|
|
_prev_next_box.pack_start (_number_label, true, true);
|
2021-03-27 13:26:09 -04:00
|
|
|
_prev_next_box.pack_end (_hide_button, false, true);
|
2019-09-08 13:04:14 -04:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_name_button.set_name ("mixer strip button");
|
|
|
|
_name_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
|
|
|
|
_name_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
|
2019-09-08 13:04:14 -04:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_send_display.set_flags (CAN_FOCUS);
|
|
|
|
_send_display.set_spacing (4);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_send_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
|
|
|
_send_scroller.add (_send_display);
|
|
|
|
_send_scroller.get_child ()->set_name ("FoldbackBusStripBase");
|
2019-09-08 13:04:14 -04:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.set_width (Wide);
|
2019-09-04 00:16:42 -04:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_insert_box = new ProcessorBox (0, boost::bind (&FoldbackStrip::plugin_selector, this), _pr_selection, 0);
|
|
|
|
_insert_box->set_no_show_all ();
|
|
|
|
_insert_box->show ();
|
|
|
|
_insert_box->set_session (_session);
|
|
|
|
_insert_box->set_width (Wide);
|
|
|
|
_insert_box->set_size_request (PX_SCALE (_width + 34), PX_SCALE (160));
|
2021-03-25 21:48:04 -04:00
|
|
|
|
|
|
|
_meter = new FastMeter ((uint32_t)floor (UIConfiguration::instance ().get_meter_hold ()),
|
|
|
|
8, FastMeter::Horizontal, PX_SCALE (100),
|
|
|
|
UIConfiguration::instance ().color ("meter color0"),
|
|
|
|
UIConfiguration::instance ().color ("meter color1"),
|
|
|
|
UIConfiguration::instance ().color ("meter color2"),
|
|
|
|
UIConfiguration::instance ().color ("meter color3"),
|
|
|
|
UIConfiguration::instance ().color ("meter color4"),
|
|
|
|
UIConfiguration::instance ().color ("meter color5"),
|
|
|
|
UIConfiguration::instance ().color ("meter color6"),
|
|
|
|
UIConfiguration::instance ().color ("meter color7"),
|
|
|
|
UIConfiguration::instance ().color ("meter color8"),
|
|
|
|
UIConfiguration::instance ().color ("meter color9"),
|
|
|
|
UIConfiguration::instance ().color ("meter background bottom"),
|
|
|
|
UIConfiguration::instance ().color ("meter background top"),
|
|
|
|
0x991122ff, 0x551111ff,
|
|
|
|
(115.0 * log_meter0dB (-15)),
|
|
|
|
89.125,
|
|
|
|
106.375,
|
|
|
|
115.0,
|
|
|
|
(UIConfiguration::instance ().get_meter_style_led () ? 3 : 1));
|
2020-05-07 20:12:36 -04:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_level_control.set_size_request (PX_SCALE (50), PX_SCALE (50));
|
|
|
|
_level_control.set_tooltip_prefix (_("Level: "));
|
|
|
|
_level_control.set_name ("foldback knob");
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
VBox* lcenter_box = manage (new VBox);
|
|
|
|
lcenter_box->pack_start (_level_control, true, false);
|
|
|
|
_level_box.pack_start (*lcenter_box, true, false);
|
|
|
|
_level_box.set_size_request (PX_SCALE (_width + 34), PX_SCALE (80));
|
|
|
|
_level_box.set_name ("FoldbackBusStripBase");
|
|
|
|
lcenter_box->show ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_output_button.set_text (_("Output"));
|
|
|
|
_output_button.set_name ("mixer strip button");
|
|
|
|
_output_button.set_text_ellipsize (Pango::ELLIPSIZE_MIDDLE);
|
|
|
|
_output_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2019-01-25 15:22:49 -05:00
|
|
|
_comment_button.set_name (X_("mixer strip button"));
|
2019-01-18 13:22:54 -05:00
|
|
|
_comment_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
|
2021-03-25 21:48:04 -04:00
|
|
|
_comment_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_global_vpacker.set_border_width (1);
|
|
|
|
_global_vpacker.set_spacing (2);
|
|
|
|
|
|
|
|
/* Packing is from top down to the send box. The send box
|
|
|
|
* needs the most room and takes all left over space
|
|
|
|
* Everything below the send box is packed from the bottom up
|
|
|
|
* the panner is the last thing to pack as it doesn't always show
|
|
|
|
* and packing it below the sendbox means nothing moves when it shows
|
|
|
|
* or hides.
|
|
|
|
*/
|
|
|
|
_global_vpacker.pack_start (_prev_next_box, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_start (_name_button, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_start (*show_sends_button, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_start (invert_button_box, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_start (_send_scroller, true, true);
|
2019-01-18 13:22:54 -05:00
|
|
|
#ifndef MIXBUS
|
2021-03-27 13:26:09 -04:00
|
|
|
/* Add a spacer underneath the foldback bus;
|
|
|
|
* this fills the area that is taken up by the scrollbar on the tracks;
|
|
|
|
* and therefore keeps the strip boxes "even" across the bottom
|
|
|
|
*/
|
2019-01-18 13:22:54 -05:00
|
|
|
int scrollbar_height = 0;
|
|
|
|
{
|
|
|
|
Gtk::Window window (WINDOW_TOPLEVEL);
|
2021-03-25 21:48:04 -04:00
|
|
|
HScrollbar scrollbar;
|
2019-01-18 13:22:54 -05:00
|
|
|
window.add (scrollbar);
|
|
|
|
scrollbar.set_name ("MixerWindow");
|
2021-03-25 21:48:04 -04:00
|
|
|
scrollbar.ensure_style ();
|
|
|
|
Gtk::Requisition requisition (scrollbar.size_request ());
|
2019-01-18 13:22:54 -05:00
|
|
|
scrollbar_height = requisition.height;
|
2021-04-03 16:19:33 -04:00
|
|
|
scrollbar_height += 3; // track_display_frame border/shadow
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
2021-03-27 13:26:09 -04:00
|
|
|
_spacer.set_size_request (-1, scrollbar_height);
|
|
|
|
_global_vpacker.pack_end (_spacer, false, false);
|
|
|
|
_spacer.show ();
|
2019-01-18 13:22:54 -05:00
|
|
|
#endif
|
2021-03-27 13:26:09 -04:00
|
|
|
_global_vpacker.pack_end (_comment_button, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_end (_output_button, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_end (_level_box, Gtk::PACK_SHRINK);
|
|
|
|
_global_vpacker.pack_end (*_meter, false, false);
|
|
|
|
_global_vpacker.pack_end (*solo_button, false, false);
|
|
|
|
_global_vpacker.pack_end (_panners, Gtk::PACK_SHRINK);
|
2021-03-27 14:33:46 -04:00
|
|
|
_global_vpacker.pack_end (*_insert_box, Gtk::PACK_SHRINK);
|
2021-03-27 13:26:09 -04:00
|
|
|
|
|
|
|
_global_frame.add (_global_vpacker);
|
|
|
|
_global_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
_global_frame.set_name ("MixerStripFrame");
|
|
|
|
add (_global_frame);
|
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
_number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &FoldbackStrip::number_button_press), false);
|
2021-03-27 13:26:09 -04:00
|
|
|
_name_button.signal_button_press_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::name_button_button_press), false);
|
2021-03-25 16:38:10 -04:00
|
|
|
_previous_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), false));
|
|
|
|
_next_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), true));
|
2021-03-25 21:48:04 -04:00
|
|
|
_hide_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::hide_clicked));
|
2021-03-27 13:47:01 -04:00
|
|
|
_send_scroller.signal_button_press_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::send_scroller_press));
|
2019-09-08 13:04:14 -04:00
|
|
|
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
add_events (Gdk::BUTTON_RELEASE_MASK |
|
|
|
|
Gdk::ENTER_NOTIFY_MASK |
|
|
|
|
Gdk::KEY_PRESS_MASK |
|
|
|
|
Gdk::KEY_RELEASE_MASK);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
set_flags (get_flags () | Gtk::CAN_FOCUS);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 10:52:14 -04:00
|
|
|
signal_enter_notify_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::fb_strip_enter_event));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Mixer_UI::instance ()->show_spill_change.connect (sigc::mem_fun (*this, &FoldbackStrip::spill_change));
|
2021-03-27 14:33:46 -04:00
|
|
|
PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&FoldbackStrip::presentation_info_changed, this, _1), gui_context ());
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
FoldbackStrip::~FoldbackStrip ()
|
|
|
|
{
|
|
|
|
CatchDeletion (this);
|
2019-08-21 23:55:51 -04:00
|
|
|
clear_send_box ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2021-03-27 10:52:14 -04:00
|
|
|
FoldbackStrip::fb_strip_enter_event (GdkEventCrossing* /*ev*/)
|
2019-01-18 13:22:54 -05:00
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
deselect_all_processors ();
|
2019-01-18 13:22:54 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackStrip::name () const
|
2019-01-18 13:22:54 -05:00
|
|
|
{
|
|
|
|
if (_route) {
|
2021-03-25 21:48:04 -04:00
|
|
|
return _route->name ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
return string ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
|
|
|
|
{
|
|
|
|
if (!rt) {
|
2019-08-21 23:55:51 -04:00
|
|
|
clear_send_box ();
|
2019-01-18 13:22:54 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-29 19:48:46 -04:00
|
|
|
RouteUI::set_route (rt);
|
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_output_button.set_route (_route, this);
|
2021-03-25 21:33:56 -04:00
|
|
|
|
2021-03-27 23:45:20 -04:00
|
|
|
int number = 0;
|
2021-03-27 18:14:19 -04:00
|
|
|
{
|
|
|
|
RouteList rl (_session->get_routelist (true, PresentationInfo::FoldbackBus));
|
|
|
|
RouteList::iterator i = find (rl.begin (), rl.end (), _route);
|
|
|
|
assert (i != rl.end ());
|
|
|
|
number = 1 + std::distance (rl.begin (), i);
|
|
|
|
}
|
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_insert_box->set_route (_route);
|
|
|
|
_level_control.set_controllable (_route->gain_control ());
|
|
|
|
_level_control.show ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
_number_label.set_inactive_color (_route->presentation_info().color ());
|
|
|
|
_number_label.set_text (PBD::to_string (number));
|
|
|
|
_number_label.show ();
|
|
|
|
|
2021-03-26 11:39:40 -04:00
|
|
|
/* setup panners */
|
|
|
|
panner_ui ().set_panner (_route->main_outs ()->panner_shell (), _route->main_outs ()->panner ());
|
|
|
|
panner_ui ().setup_pan ();
|
|
|
|
panner_ui ().set_send_drawing_mode (false);
|
|
|
|
|
|
|
|
if (has_audio_outputs ()) {
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.show_all ();
|
2021-03-26 11:39:40 -04:00
|
|
|
} else {
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.hide_all ();
|
2021-03-26 11:39:40 -04:00
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
if (_route->panner_shell ()) {
|
|
|
|
update_panner_choices ();
|
|
|
|
_route->panner_shell ()->Changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::connect_to_pan, this), gui_context ());
|
2019-09-08 13:04:14 -04:00
|
|
|
}
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-26 11:39:40 -04:00
|
|
|
/* set up metering */
|
2020-05-07 20:12:36 -04:00
|
|
|
_route->set_meter_point (MeterPostFader);
|
|
|
|
_route->set_meter_type (MeterPeak0dB);
|
|
|
|
|
2021-03-27 14:33:46 -04:00
|
|
|
_route->output ()->changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::update_output_display, this), gui_context ());
|
2019-01-18 13:22:54 -05:00
|
|
|
_route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::io_changed_proxy, this), gui_context ());
|
2021-03-25 21:48:04 -04:00
|
|
|
_route->comment_changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::setup_comment_button, this), gui_context ());
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-26 18:01:38 -04:00
|
|
|
_session->FBSendsChanged.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::update_send_box, this), gui_context ());
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 14:33:46 -04:00
|
|
|
/* now force an update of all the various elements */
|
2019-09-08 13:04:14 -04:00
|
|
|
name_changed ();
|
|
|
|
update_send_box ();
|
2019-01-18 13:22:54 -05:00
|
|
|
comment_changed ();
|
|
|
|
connect_to_pan ();
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.setup_pan ();
|
|
|
|
_panners.show_all ();
|
2019-01-18 13:22:54 -05:00
|
|
|
update_output_display ();
|
2021-03-26 11:39:40 -04:00
|
|
|
reset_strip_style ();
|
2021-03-27 10:52:14 -04:00
|
|
|
setup_comment_button ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
add_events (Gdk::BUTTON_RELEASE_MASK);
|
2021-03-25 16:38:10 -04:00
|
|
|
update_sensitivity ();
|
2021-03-25 21:48:04 -04:00
|
|
|
_previous_button.show ();
|
|
|
|
_next_button.show ();
|
|
|
|
_hide_button.show ();
|
2021-03-27 13:26:09 -04:00
|
|
|
_prev_next_box.show ();
|
|
|
|
_name_button.show ();
|
|
|
|
_send_display.show ();
|
|
|
|
_send_scroller.show ();
|
2021-03-27 10:52:14 -04:00
|
|
|
show_sends_button->show ();
|
2021-03-27 13:26:09 -04:00
|
|
|
_insert_box->show ();
|
2020-05-07 20:12:36 -04:00
|
|
|
_meter->show ();
|
2021-03-27 13:26:09 -04:00
|
|
|
_level_box.show ();
|
|
|
|
_output_button.show ();
|
2021-03-25 21:48:04 -04:00
|
|
|
_comment_button.show ();
|
2021-03-27 13:26:09 -04:00
|
|
|
_global_frame.show ();
|
|
|
|
_global_vpacker.show ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
show ();
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
struct StripableByPresentationOrder {
|
|
|
|
bool operator() (const boost::shared_ptr<Stripable>& a, const boost::shared_ptr<Stripable>& b) const
|
2019-09-10 22:26:00 -04:00
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
return a->presentation_info ().order () < b->presentation_info ().order ();
|
2019-09-10 22:26:00 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-21 23:55:51 -04:00
|
|
|
void
|
|
|
|
FoldbackStrip::update_send_box ()
|
|
|
|
{
|
|
|
|
clear_send_box ();
|
|
|
|
if (!_route) {
|
|
|
|
return;
|
|
|
|
}
|
2019-09-10 22:26:00 -04:00
|
|
|
StripableList stripables;
|
|
|
|
stripables.clear ();
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Route::FedBy fed_by = _route->fed_by ();
|
|
|
|
for (Route::FedBy::iterator i = fed_by.begin (); i != fed_by.end (); ++i) {
|
2019-08-21 23:55:51 -04:00
|
|
|
if (i->sends_only) {
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Route> rt (i->r.lock ());
|
2019-09-10 22:26:00 -04:00
|
|
|
boost::shared_ptr<Stripable> s = boost::dynamic_pointer_cast<Stripable> (rt);
|
|
|
|
stripables.push_back (s);
|
|
|
|
}
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
stripables.sort (StripableByPresentationOrder ());
|
|
|
|
for (StripableList::iterator it = stripables.begin (); it != stripables.end (); ++it) {
|
2019-09-10 22:26:00 -04:00
|
|
|
boost::shared_ptr<Stripable> s_sp = *it;
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Route> s_rt = boost::dynamic_pointer_cast<Route> (s_sp);
|
|
|
|
boost::shared_ptr<Send> snd = s_rt->internal_send_for (_route);
|
2019-09-10 22:26:00 -04:00
|
|
|
if (snd) {
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackSend* fb_s = new FoldbackSend (snd, s_rt, _route, _width);
|
2021-03-27 13:26:09 -04:00
|
|
|
_send_display.pack_start (*fb_s, Gtk::PACK_SHRINK);
|
2019-09-10 22:26:00 -04:00
|
|
|
fb_s->show ();
|
2021-03-27 14:33:46 -04:00
|
|
|
s_rt->processors_changed.connect (_send_connections, invalidator (*this), boost::bind (&FoldbackStrip::update_send_box, this), gui_context ());
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-28 14:11:34 -04:00
|
|
|
update_sensitivity ();
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::clear_send_box ()
|
|
|
|
{
|
2021-03-27 13:26:09 -04:00
|
|
|
std::vector<Widget*> snd_list = _send_display.get_children ();
|
2021-03-26 18:01:38 -04:00
|
|
|
_send_connections.drop_connections ();
|
2021-03-25 21:48:04 -04:00
|
|
|
for (uint32_t i = 0; i < snd_list.size (); i++) {
|
2021-03-27 13:26:09 -04:00
|
|
|
_send_display.remove (*(snd_list[i]));
|
2019-08-21 23:55:51 -04:00
|
|
|
delete snd_list[i];
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
snd_list.clear ();
|
2019-08-21 23:55:51 -04:00
|
|
|
}
|
|
|
|
|
2019-01-18 13:22:54 -05:00
|
|
|
void
|
|
|
|
FoldbackStrip::connect_to_pan ()
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (*this, &FoldbackStrip::connect_to_pan)
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
if (!_route->panner ()) {
|
2019-01-18 13:22:54 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
update_panner_choices ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::update_panner_choices ()
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (*this, &FoldbackStrip::update_panner_choices)
|
2021-03-25 21:48:04 -04:00
|
|
|
if (!_route->panner_shell ()) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
uint32_t in = _route->output ()->n_ports ().n_audio ();
|
2019-01-18 13:22:54 -05:00
|
|
|
uint32_t out = in;
|
2021-03-25 21:48:04 -04:00
|
|
|
if (_route->panner ()) {
|
|
|
|
in = _route->panner ()->in ().n_audio ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::update_output_display ()
|
|
|
|
{
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.setup_pan ();
|
2019-01-18 13:22:54 -05:00
|
|
|
if (has_audio_outputs ()) {
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.show_all ();
|
2019-01-18 13:22:54 -05:00
|
|
|
} else {
|
2021-03-27 13:26:09 -04:00
|
|
|
_panners.hide_all ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::io_changed_proxy ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
Glib::signal_idle ().connect_once (sigc::mem_fun (*this, &FoldbackStrip::update_panner_choices));
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::setup_comment_button ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
std::string comment = _route->comment ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
set_tooltip (_comment_button, comment.empty () ? _("Click to add/edit comments") : _route->comment ());
|
2019-01-18 13:22:54 -05:00
|
|
|
|
|
|
|
if (comment.empty ()) {
|
|
|
|
_comment_button.set_name ("generic button");
|
|
|
|
_comment_button.set_text (_("Comments"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_comment_button.set_name ("comment button");
|
|
|
|
|
|
|
|
string::size_type pos = comment.find_first_of (" \t\n");
|
|
|
|
if (pos != string::npos) {
|
|
|
|
comment = comment.substr (0, pos);
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
if (comment.empty ()) {
|
2019-01-18 13:22:54 -05:00
|
|
|
_comment_button.set_text (_("Comments"));
|
|
|
|
} else {
|
|
|
|
_comment_button.set_text (comment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-12 15:44:38 -04:00
|
|
|
Gtk::Menu*
|
2019-01-18 13:22:54 -05:00
|
|
|
FoldbackStrip::build_route_ops_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Menu* menu = manage (new Menu);
|
2019-09-12 15:44:38 -04:00
|
|
|
MenuList& items = menu->items ();
|
|
|
|
menu->set_name ("ArdourContextMenu");
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
bool active = _route->active ();
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
if (active) {
|
|
|
|
items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &RouteUI::choose_color)));
|
|
|
|
items.push_back (MenuElem (_("Comments..."), sigc::mem_fun (*this, &RouteUI::open_comment_editor)));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
items.push_back (MenuElem (_("Outputs..."), sigc::mem_fun (*this, &RouteUI::edit_output_configuration)));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
items.push_back (SeparatorElem ());
|
2019-01-25 15:22:49 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
items.push_back (MenuElem (_("Save As Template..."), sigc::mem_fun (*this, &RouteUI::save_as_template)));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
items.push_back (MenuElem (_("Rename..."), sigc::mem_fun (*this, &RouteUI::route_rename)));
|
|
|
|
|
|
|
|
items.push_back (SeparatorElem ());
|
|
|
|
}
|
2020-05-09 02:18:26 -04:00
|
|
|
|
2019-01-18 13:22:54 -05:00
|
|
|
items.push_back (CheckMenuElem (_("Active")));
|
2021-03-25 21:48:04 -04:00
|
|
|
Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
|
|
|
|
i->set_active (_route->active ());
|
|
|
|
i->set_sensitive (!_session->transport_rolling ());
|
|
|
|
i->signal_activate ().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active (), false));
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
if (active && !Profile->get_mixbus ()) {
|
|
|
|
items.push_back (SeparatorElem ());
|
|
|
|
items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
|
|
|
|
denormal_menu_item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
|
|
|
|
denormal_menu_item->set_active (_route->denormal_protection ());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (active) {
|
|
|
|
items.push_back (SeparatorElem ());
|
|
|
|
|
|
|
|
items.push_back (MenuElem (_("Duplicate Foldback Bus"), sigc::mem_fun (*this, &FoldbackStrip::duplicate_current_fb)));
|
|
|
|
|
|
|
|
}
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
items.push_back (SeparatorElem ());
|
2021-03-27 18:14:19 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
items.push_back (MenuElem (_("Remove"), sigc::mem_fun (*this, &FoldbackStrip::remove_current_fb)));
|
2019-09-12 15:44:38 -04:00
|
|
|
return menu;
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
2019-09-12 15:44:38 -04:00
|
|
|
Gtk::Menu*
|
2019-01-18 13:22:54 -05:00
|
|
|
FoldbackStrip::build_route_select_menu ()
|
|
|
|
{
|
|
|
|
using namespace Menu_Helpers;
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Menu* menu = manage (new Menu);
|
2019-09-12 15:44:38 -04:00
|
|
|
MenuList& items = menu->items ();
|
|
|
|
menu->set_name ("ArdourContextMenu");
|
|
|
|
|
2020-05-05 22:41:45 -04:00
|
|
|
RouteList fb_list;
|
|
|
|
fb_list = _session->get_routelist (true, PresentationInfo::FoldbackBus);
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
for (RouteList::iterator s = fb_list.begin (); s != fb_list.end (); ++s) {
|
2020-05-05 22:41:45 -04:00
|
|
|
boost::shared_ptr<Route> route = (*s);
|
2019-01-18 13:22:54 -05:00
|
|
|
if (route == _route) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
items.push_back (MenuElem (route->name (), sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::set_route), route)));
|
|
|
|
}
|
2019-09-12 15:44:38 -04:00
|
|
|
return menu;
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
bool
|
2019-01-18 13:22:54 -05:00
|
|
|
FoldbackStrip::name_button_button_press (GdkEventButton* ev)
|
|
|
|
{
|
2021-03-25 21:17:09 -04:00
|
|
|
if (ev->button == 1 && ev->type == GDK_BUTTON_PRESS) {
|
2021-03-25 21:48:04 -04:00
|
|
|
StripableList slist;
|
2020-05-05 14:42:45 -04:00
|
|
|
boost::shared_ptr<Route> previous = boost::shared_ptr<Route> ();
|
|
|
|
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
|
|
|
if (slist.size () > 1) {
|
|
|
|
Menu* menu = build_route_select_menu ();
|
2021-03-27 13:26:09 -04:00
|
|
|
Gtkmm2ext::anchored_menu_popup (menu, &_name_button, "", ev->button, ev->time);
|
2020-05-05 14:42:45 -04:00
|
|
|
}
|
2019-08-28 19:23:46 -04:00
|
|
|
return true;
|
2021-03-25 21:17:09 -04:00
|
|
|
} else if (Keyboard::is_context_menu_event (ev)) {
|
2019-09-12 15:44:38 -04:00
|
|
|
Menu* r_menu = build_route_ops_menu ();
|
2021-03-25 21:17:09 -04:00
|
|
|
r_menu->popup (ev->button, ev->time);
|
2019-08-28 19:23:46 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
bool
|
|
|
|
FoldbackStrip::number_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
return name_button_button_press (ev);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-03-27 13:47:01 -04:00
|
|
|
bool
|
|
|
|
FoldbackStrip::send_scroller_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
/* Show context menu, identical to send button right-click */
|
|
|
|
return RouteUI::show_sends_press (ev);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-09-12 12:39:38 -04:00
|
|
|
void
|
2021-03-25 16:38:10 -04:00
|
|
|
FoldbackStrip::cycle_foldbacks (bool next)
|
2019-08-28 19:23:46 -04:00
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
RouteList rl (_session->get_routelist (true, PresentationInfo::FoldbackBus));
|
2021-03-25 16:38:10 -04:00
|
|
|
if (rl.size () < 2) {
|
2019-09-12 12:39:38 -04:00
|
|
|
return;
|
|
|
|
}
|
2021-03-25 16:38:10 -04:00
|
|
|
RouteList::iterator i = find (rl.begin (), rl.end (), _route);
|
|
|
|
assert (i != rl.end ());
|
2020-05-05 22:41:45 -04:00
|
|
|
|
2021-03-25 16:38:10 -04:00
|
|
|
if (next) {
|
|
|
|
if (++i == rl.end ()) {
|
|
|
|
i = rl.begin ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
2019-09-12 12:39:38 -04:00
|
|
|
} else {
|
2021-03-25 16:38:10 -04:00
|
|
|
if (i == rl.begin ()) {
|
|
|
|
i = rl.end ();
|
2021-03-25 09:39:46 -04:00
|
|
|
}
|
2021-03-25 16:38:10 -04:00
|
|
|
--i;
|
|
|
|
}
|
|
|
|
set_route (*i);
|
2021-03-27 10:52:14 -04:00
|
|
|
|
2021-03-25 16:38:10 -04:00
|
|
|
if (_showing_sends) {
|
2021-03-27 10:52:14 -04:00
|
|
|
set_showing_sends_to (_route);
|
2021-03-25 21:48:04 -04:00
|
|
|
Mixer_UI::instance ()->show_spill (_route);
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-11 00:09:54 -04:00
|
|
|
void
|
2021-03-25 16:38:10 -04:00
|
|
|
FoldbackStrip::update_sensitivity ()
|
2019-09-11 00:09:54 -04:00
|
|
|
{
|
2021-03-28 14:11:34 -04:00
|
|
|
RouteList fb_list (_session->get_routelist (true, PresentationInfo::FoldbackBus));
|
2020-05-05 22:41:45 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
if ((fb_list.size () < 2) || (_route == *(fb_list.begin ()))) {
|
2019-09-11 00:09:54 -04:00
|
|
|
_previous_button.set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
_previous_button.set_sensitive (true);
|
|
|
|
}
|
2021-03-25 21:48:04 -04:00
|
|
|
if ((fb_list.size () < 2) || _route == *(--fb_list.end ())) {
|
2019-09-11 00:09:54 -04:00
|
|
|
_next_button.set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
_next_button.set_sensitive (true);
|
|
|
|
}
|
2021-03-28 14:11:34 -04:00
|
|
|
|
|
|
|
bool active = _route && _route->active ();
|
|
|
|
show_sends_button->set_sensitive (active && _send_display.get_children ().size () > 0);
|
|
|
|
solo_button->set_sensitive (active && Config->get_solo_control_is_listen_control ());
|
2019-09-11 00:09:54 -04:00
|
|
|
}
|
|
|
|
|
2019-09-11 19:36:05 -04:00
|
|
|
void
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackStrip::hide_clicked ()
|
2019-09-11 19:36:05 -04:00
|
|
|
{
|
|
|
|
ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleFoldbackStrip"))->set_active (false);
|
|
|
|
}
|
|
|
|
|
2021-03-27 14:33:46 -04:00
|
|
|
void
|
|
|
|
FoldbackStrip::presentation_info_changed (PropertyChange const& what_changed)
|
|
|
|
{
|
|
|
|
if (what_changed.contains (Properties::order)) {
|
|
|
|
update_send_box ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-12 12:39:38 -04:00
|
|
|
void
|
2021-03-25 16:38:10 -04:00
|
|
|
FoldbackStrip::spill_change (boost::shared_ptr<Stripable> s)
|
2019-09-07 17:51:01 -04:00
|
|
|
{
|
2021-03-25 16:38:10 -04:00
|
|
|
if (s == _route) {
|
|
|
|
_showing_sends = true;
|
|
|
|
} else {
|
2019-09-12 12:39:38 -04:00
|
|
|
_showing_sends = false;
|
2019-09-07 17:51:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 20:12:36 -04:00
|
|
|
void
|
|
|
|
FoldbackStrip::fast_update ()
|
|
|
|
{
|
2021-03-26 18:01:38 -04:00
|
|
|
/* As this is the output level to a DAC, peak level is what is important
|
2020-05-07 20:12:36 -04:00
|
|
|
* So, much like the mackie control, we just want the highest peak from
|
|
|
|
* all channels in the route.
|
|
|
|
*/
|
2021-03-27 13:26:09 -04:00
|
|
|
boost::shared_ptr<PeakMeter> peak_meter = _route->shared_peak_meter ();
|
|
|
|
const float meter_level = peak_meter->meter_level (0, MeterMCP);
|
2020-05-07 20:12:36 -04:00
|
|
|
_meter->set (log_meter0dB (meter_level));
|
|
|
|
}
|
|
|
|
|
2019-01-18 13:22:54 -05:00
|
|
|
void
|
|
|
|
FoldbackStrip::route_property_changed (const PropertyChange& what_changed)
|
|
|
|
{
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
name_changed ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
void
|
|
|
|
FoldbackStrip::route_color_changed ()
|
|
|
|
{
|
|
|
|
_number_label.set_inactive_color (_route->presentation_info().color ());
|
|
|
|
}
|
|
|
|
|
2019-01-18 13:22:54 -05:00
|
|
|
void
|
|
|
|
FoldbackStrip::name_changed ()
|
|
|
|
{
|
2021-03-27 13:26:09 -04:00
|
|
|
_name_button.set_text (_route->name ());
|
|
|
|
set_tooltip (_name_button, Gtkmm2ext::markup_escape_text (_route->name ()));
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::reset_strip_style ()
|
|
|
|
{
|
2021-03-27 18:14:19 -04:00
|
|
|
bool active = _route->active ();
|
|
|
|
if (active) {
|
2021-03-25 21:48:04 -04:00
|
|
|
set_name ("FoldbackBusStripBase");
|
|
|
|
} else {
|
|
|
|
set_name ("AudioBusStripBaseInactive");
|
|
|
|
}
|
2021-03-27 18:14:19 -04:00
|
|
|
|
|
|
|
set_invert_sensitive (active);
|
2021-03-28 14:11:34 -04:00
|
|
|
update_sensitivity ();
|
|
|
|
|
2021-03-27 18:14:19 -04:00
|
|
|
_comment_button.set_sensitive (active);
|
|
|
|
_output_button.set_sensitive (active);
|
|
|
|
_level_control.set_sensitive (active);
|
|
|
|
_insert_box->set_sensitive (active);
|
|
|
|
solo_button->set_sensitive (active && Config->get_solo_control_is_listen_control ());
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::set_button_names ()
|
|
|
|
{
|
2021-03-27 10:52:14 -04:00
|
|
|
show_sends_button->set_text (_("Show Sends"));
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
switch (Config->get_listen_position ()) {
|
2021-03-24 12:48:22 -04:00
|
|
|
case AfterFaderListen:
|
|
|
|
solo_button->set_text (_("AFL"));
|
2021-03-28 14:11:34 -04:00
|
|
|
update_sensitivity ();
|
2021-03-24 12:48:22 -04:00
|
|
|
break;
|
|
|
|
case PreFaderListen:
|
|
|
|
solo_button->set_text (_("PFL"));
|
2021-03-28 14:11:34 -04:00
|
|
|
update_sensitivity ();
|
2021-03-24 12:48:22 -04:00
|
|
|
break;
|
|
|
|
}
|
2019-01-25 15:22:49 -05:00
|
|
|
}
|
2019-01-18 13:22:54 -05:00
|
|
|
|
2019-01-25 15:22:49 -05:00
|
|
|
PluginSelector*
|
2021-03-25 21:48:04 -04:00
|
|
|
FoldbackStrip::plugin_selector ()
|
2019-01-25 15:22:49 -05:00
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
return _mixer.plugin_selector ();
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FoldbackStrip::route_active_changed ()
|
|
|
|
{
|
|
|
|
reset_strip_style ();
|
|
|
|
}
|
|
|
|
|
2019-01-25 15:22:49 -05:00
|
|
|
void
|
|
|
|
FoldbackStrip::deselect_all_processors ()
|
|
|
|
{
|
2021-03-27 13:26:09 -04:00
|
|
|
_insert_box->processor_operation (ProcessorBox::ProcessorsSelectNone);
|
2019-01-25 15:22:49 -05:00
|
|
|
}
|
|
|
|
|
2019-09-07 17:51:01 -04:00
|
|
|
void
|
2021-03-27 10:52:14 -04:00
|
|
|
FoldbackStrip::create_selected_sends (ARDOUR::Placement p, bool)
|
2019-09-07 17:51:01 -04:00
|
|
|
{
|
|
|
|
boost::shared_ptr<StripableList> slist (new StripableList);
|
2021-03-25 21:48:04 -04:00
|
|
|
PresentationInfo::Flag fl = PresentationInfo::MixerRoutes;
|
2019-09-07 17:51:01 -04:00
|
|
|
_session->get_stripables (*slist, fl);
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
for (StripableList::iterator i = (*slist).begin (); i != (*slist).end (); ++i) {
|
|
|
|
if ((*i)->is_selected () && !(*i)->is_master () && !(*i)->is_monitor ()) {
|
|
|
|
boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (*i);
|
2019-09-07 17:51:01 -04:00
|
|
|
if (rt) {
|
2021-03-27 10:52:14 -04:00
|
|
|
rt->add_foldback_send (_route, p == PostFader);
|
2019-09-07 17:51:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-28 14:11:34 -04:00
|
|
|
update_sensitivity ();
|
2019-09-07 17:51:01 -04:00
|
|
|
}
|
|
|
|
|
2020-05-09 02:18:26 -04:00
|
|
|
void
|
|
|
|
FoldbackStrip::duplicate_current_fb ()
|
|
|
|
{
|
2021-03-25 21:48:04 -04:00
|
|
|
RouteList new_rt_lst;
|
2020-05-09 02:18:26 -04:00
|
|
|
boost::shared_ptr<Route> new_fb;
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Route> old_fb = _route;
|
|
|
|
string new_name_tp = "Foldback";
|
2021-03-27 13:26:09 -04:00
|
|
|
|
|
|
|
/* get number of io so long as it is 1 or 2 */
|
2020-05-09 02:18:26 -04:00
|
|
|
uint32_t io = 1;
|
2021-03-25 21:48:04 -04:00
|
|
|
if (old_fb->n_outputs ().n_audio () && (old_fb->n_outputs ().n_audio () > 1)) {
|
2020-05-09 02:18:26 -04:00
|
|
|
io = 2;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
new_rt_lst = _session->new_audio_route (io, io, 0, 1, new_name_tp, PresentationInfo::FoldbackBus, (uint32_t)-1);
|
|
|
|
new_fb = *(new_rt_lst.begin ());
|
2021-03-27 13:26:09 -04:00
|
|
|
|
2020-05-09 02:18:26 -04:00
|
|
|
if (new_fb) {
|
2021-03-25 21:48:04 -04:00
|
|
|
double oldgain = old_fb->gain_control ()->get_value ();
|
|
|
|
new_fb->gain_control ()->set_value (oldgain * 0.25, PBD::Controllable::NoGroup);
|
2020-05-09 02:18:26 -04:00
|
|
|
|
2021-03-25 21:48:04 -04:00
|
|
|
Route::FedBy fed_by = old_fb->fed_by ();
|
|
|
|
for (Route::FedBy::iterator i = fed_by.begin (); i != fed_by.end (); ++i) {
|
2020-05-09 02:18:26 -04:00
|
|
|
if (i->sends_only) {
|
2021-03-25 21:48:04 -04:00
|
|
|
boost::shared_ptr<Route> rt (i->r.lock ());
|
|
|
|
boost::shared_ptr<Send> old_snd = rt->internal_send_for (old_fb);
|
2020-08-09 00:29:09 -04:00
|
|
|
boost::shared_ptr<Processor> old_proc = old_snd;
|
2021-03-25 21:48:04 -04:00
|
|
|
bool old_pre = old_proc->get_pre_fader ();
|
2020-08-09 00:29:09 -04:00
|
|
|
rt->add_foldback_send (new_fb, !old_pre);
|
2020-05-09 02:18:26 -04:00
|
|
|
if (old_snd) {
|
2021-03-25 21:48:04 -04:00
|
|
|
float old_gain = old_snd->gain_control ()->get_value ();
|
|
|
|
boost::shared_ptr<Send> new_snd = rt->internal_send_for (new_fb);
|
|
|
|
new_snd->gain_control ()->set_value (old_gain, PBD::Controllable::NoGroup);
|
2020-05-09 02:18:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_route (new_fb);
|
|
|
|
route_rename ();
|
|
|
|
} else {
|
|
|
|
PBD::error << "Unable to create new FoldbackBus." << endmsg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-18 13:22:54 -05:00
|
|
|
void
|
|
|
|
FoldbackStrip::remove_current_fb ()
|
|
|
|
{
|
2019-08-21 23:55:51 -04:00
|
|
|
clear_send_box ();
|
2021-03-25 21:48:04 -04:00
|
|
|
StripableList slist;
|
|
|
|
boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
|
2019-01-18 13:22:54 -05:00
|
|
|
boost::shared_ptr<Route> old_route = _route;
|
|
|
|
_session->get_stripables (slist, PresentationInfo::FoldbackBus);
|
|
|
|
if (slist.size ()) {
|
2021-03-25 21:48:04 -04:00
|
|
|
for (StripableList::iterator s = slist.begin (); s != slist.end (); ++s) {
|
2019-01-18 13:22:54 -05:00
|
|
|
if ((*s) != _route) {
|
|
|
|
next = boost::dynamic_pointer_cast<Route> (*s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-25 16:38:10 -04:00
|
|
|
|
|
|
|
set_route (next);
|
|
|
|
_session->remove_route (old_route);
|
2019-01-18 13:22:54 -05:00
|
|
|
}
|