2016-07-10 12:38:55 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2016-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2016-2018 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.
|
|
|
|
*/
|
2016-07-10 12:38:55 -04:00
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
#include <cairomm/region.h>
|
2016-07-10 12:38:55 -04:00
|
|
|
#include <pangomm/layout.h>
|
|
|
|
|
|
|
|
#include "pbd/compose.h"
|
|
|
|
#include "pbd/convert.h"
|
|
|
|
#include "pbd/debug.h"
|
|
|
|
#include "pbd/failed_constructor.h"
|
|
|
|
#include "pbd/file_utils.h"
|
|
|
|
#include "pbd/search_path.h"
|
|
|
|
#include "pbd/enumwriter.h"
|
|
|
|
|
|
|
|
#include "midi++/parser.h"
|
2017-09-24 12:57:27 -04:00
|
|
|
|
2017-09-24 12:03:54 -04:00
|
|
|
#include "temporal/time.h"
|
|
|
|
#include "temporal/bbt_time.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
|
|
|
|
#include "ardour/async_midi_port.h"
|
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
#include "ardour/debug.h"
|
2016-09-23 19:18:27 -04:00
|
|
|
#include "ardour/dsp_filter.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
#include "ardour/filesystem_paths.h"
|
|
|
|
#include "ardour/midiport_manager.h"
|
|
|
|
#include "ardour/midi_track.h"
|
|
|
|
#include "ardour/midi_port.h"
|
2016-09-22 15:24:02 -04:00
|
|
|
#include "ardour/monitor_control.h"
|
2016-09-23 19:18:27 -04:00
|
|
|
#include "ardour/meter.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
#include "ardour/session.h"
|
2016-09-22 15:24:02 -04:00
|
|
|
#include "ardour/solo_isolate_control.h"
|
|
|
|
#include "ardour/solo_safe_control.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
#include "ardour/tempo.h"
|
|
|
|
|
2016-07-12 07:46:30 -04:00
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
2016-07-11 09:07:52 -04:00
|
|
|
#include "gtkmm2ext/rgb_macros.h"
|
|
|
|
|
2016-09-25 16:02:47 -04:00
|
|
|
#include "canvas/box.h"
|
2016-09-22 15:24:02 -04:00
|
|
|
#include "canvas/line.h"
|
2016-09-25 16:02:47 -04:00
|
|
|
#include "canvas/meter.h"
|
2016-09-23 16:24:14 -04:00
|
|
|
#include "canvas/rectangle.h"
|
|
|
|
#include "canvas/text.h"
|
2016-09-28 17:24:14 -04:00
|
|
|
#include "canvas/types.h"
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
#include "canvas.h"
|
2016-07-11 09:07:52 -04:00
|
|
|
#include "knob.h"
|
2016-09-25 16:02:47 -04:00
|
|
|
#include "level_meter.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
#include "push2.h"
|
|
|
|
#include "track_mix.h"
|
2016-07-11 09:07:52 -04:00
|
|
|
#include "utils.h"
|
2016-07-10 12:38:55 -04:00
|
|
|
|
2018-09-21 13:05:39 -04:00
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
2016-09-28 17:24:14 -04:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#define Rect ArdourCanvas::Rect
|
|
|
|
#endif
|
|
|
|
|
2016-07-10 12:38:55 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Glib;
|
|
|
|
using namespace ArdourSurface;
|
2016-09-16 09:39:28 -04:00
|
|
|
using namespace ArdourCanvas;
|
2016-07-10 12:38:55 -04:00
|
|
|
|
2016-09-27 15:31:17 -04:00
|
|
|
TrackMixLayout::TrackMixLayout (Push2& p, Session & s, std::string const & name)
|
|
|
|
: Push2Layout (p, s, name)
|
2016-07-10 12:38:55 -04:00
|
|
|
{
|
2016-09-22 15:24:02 -04:00
|
|
|
Pango::FontDescription fd ("Sans 10");
|
2016-07-11 18:17:04 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_bg = new ArdourCanvas::Rectangle (this);
|
|
|
|
_bg->set (Rect (0, 0, display_width(), display_height()));
|
|
|
|
_bg->set_fill_color (_p2.get_color (Push2::DarkBackground));
|
2016-09-16 09:39:28 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_line = new Line (this);
|
|
|
|
_upper_line->set (Duple (0, 22.5), Duple (display_width(), 22.5));
|
|
|
|
_upper_line->set_outline_color (_p2.get_color (Push2::LightBackground));
|
2016-09-22 15:24:02 -04:00
|
|
|
|
|
|
|
for (int n = 0; n < 8; ++n) {
|
|
|
|
Text* t;
|
|
|
|
|
|
|
|
if (n < 4) {
|
|
|
|
t = new Text (this);
|
|
|
|
t->set_font_description (fd);
|
2021-06-18 16:33:32 -04:00
|
|
|
t->set_color (_p2.get_color (Push2::ParameterName));
|
2016-09-22 15:24:02 -04:00
|
|
|
t->set_position ( Duple (10 + (n*Push2Canvas::inter_button_spacing()), 2));
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text.push_back (t);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
2016-07-11 18:17:04 -04:00
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
t = new Text (this);
|
2016-09-22 15:24:02 -04:00
|
|
|
t->set_font_description (fd);
|
2021-06-18 16:33:32 -04:00
|
|
|
t->set_color (_p2.get_color (Push2::ParameterName));
|
2016-09-16 09:39:28 -04:00
|
|
|
t->set_position (Duple (10 + (n*Push2Canvas::inter_button_spacing()), 140));
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text.push_back (t);
|
2016-07-12 07:46:30 -04:00
|
|
|
|
2016-07-11 18:17:04 -04:00
|
|
|
switch (n) {
|
|
|
|
case 0:
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text[n]->set (_("Track Volume"));
|
|
|
|
_lower_text[n]->set (_("Mute"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text[n]->set (_("Track Pan"));
|
|
|
|
_lower_text[n]->set (_("Solo"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text[n]->set (_("Track Width"));
|
|
|
|
_lower_text[n]->set (_("Rec-enable"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text[n]->set (_("Track Trim"));
|
|
|
|
_lower_text[n]->set (_("In"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text[n]->set (_("Disk"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text[n]->set (_("Solo Iso"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text[n]->set (_("Solo Lock"));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
case 7:
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text[n]->set (_(""));
|
2016-07-11 18:17:04 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_knobs[n] = new Push2Knob (_p2, this);
|
|
|
|
_knobs[n]->set_position (Duple (60 + (Push2Canvas::inter_button_spacing()*n), 95));
|
|
|
|
_knobs[n]->set_radius (25);
|
2016-07-11 18:17:04 -04:00
|
|
|
}
|
2016-07-11 09:07:52 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_name_text = new Text (this);
|
|
|
|
_name_text->set_font_description (fd);
|
|
|
|
_name_text->set_position (Duple (10 + (4*Push2Canvas::inter_button_spacing()), 2));
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_meter = new LevelMeter (_p2, this, 300, ArdourCanvas::Meter::Horizontal);
|
|
|
|
_meter->set_position (Duple (10 + (4 * Push2Canvas::inter_button_spacing()), 30));
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
Pango::FontDescription fd2 ("Sans 18");
|
2021-06-18 16:33:32 -04:00
|
|
|
_bbt_text = new Text (this);
|
|
|
|
_bbt_text->set_font_description (fd2);
|
|
|
|
_bbt_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_bbt_text->set_position (Duple (10 + (4 * Push2Canvas::inter_button_spacing()), 60));
|
|
|
|
|
|
|
|
_minsec_text = new Text (this);
|
|
|
|
_minsec_text->set_font_description (fd2);
|
|
|
|
_minsec_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_minsec_text->set_position (Duple (10 + (4 * Push2Canvas::inter_button_spacing()), 90));
|
2016-07-10 12:38:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
TrackMixLayout::~TrackMixLayout ()
|
|
|
|
{
|
2016-07-11 18:17:04 -04:00
|
|
|
for (int n = 0; n < 8; ++n) {
|
2021-06-18 16:33:32 -04:00
|
|
|
delete _knobs[n];
|
2016-07-11 18:17:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-16 09:39:28 -04:00
|
|
|
TrackMixLayout::show ()
|
2016-07-11 18:17:04 -04:00
|
|
|
{
|
2016-09-22 15:24:02 -04:00
|
|
|
Push2::ButtonID lower_buttons[] = { Push2::Lower1, Push2::Lower2, Push2::Lower3, Push2::Lower4,
|
|
|
|
Push2::Lower5, Push2::Lower6, Push2::Lower7, Push2::Lower8 };
|
|
|
|
|
|
|
|
for (size_t n = 0; n < sizeof (lower_buttons) / sizeof (lower_buttons[0]); ++n) {
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (lower_buttons[n]);
|
2016-09-22 15:24:02 -04:00
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
2016-09-27 15:31:17 -04:00
|
|
|
show_state ();
|
2016-09-25 20:10:26 -04:00
|
|
|
|
2016-09-22 15:24:02 -04:00
|
|
|
Container::show ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::hide ()
|
|
|
|
{
|
2016-09-27 15:31:17 -04:00
|
|
|
|
2016-07-11 18:17:04 -04:00
|
|
|
}
|
2016-07-10 12:38:55 -04:00
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
void
|
2016-09-28 17:24:14 -04:00
|
|
|
TrackMixLayout::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
2016-07-10 12:38:55 -04:00
|
|
|
{
|
2016-09-22 15:24:02 -04:00
|
|
|
Container::render (area, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::button_upper (uint32_t n)
|
|
|
|
{
|
|
|
|
}
|
2016-09-16 14:17:24 -04:00
|
|
|
|
2016-09-22 15:24:02 -04:00
|
|
|
void
|
|
|
|
TrackMixLayout::button_lower (uint32_t n)
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
2016-07-10 12:38:55 -04:00
|
|
|
|
2016-09-22 15:24:02 -04:00
|
|
|
MonitorChoice mc;
|
|
|
|
|
|
|
|
switch (n) {
|
|
|
|
case 0:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->mute_control()) {
|
|
|
|
_stripable->mute_control()->set_value (!_stripable->mute_control()->get_value(), PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->solo_control()) {
|
|
|
|
_session.set_control (_stripable->solo_control(), !_stripable->solo_control()->self_soloed(), PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->rec_enable_control()) {
|
|
|
|
_stripable->rec_enable_control()->set_value (!_stripable->rec_enable_control()->get_value(), PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->monitor_control()) {
|
|
|
|
mc = _stripable->monitoring_control()->monitoring_choice();
|
2016-09-27 15:31:17 -04:00
|
|
|
switch (mc) {
|
|
|
|
case MonitorInput:
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
break;
|
|
|
|
default:
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->monitoring_control()->set_value (MonitorInput, PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
break;
|
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2021-06-18 16:33:32 -04:00
|
|
|
mc = _stripable->monitoring_control()->monitoring_choice();
|
2016-09-22 15:24:02 -04:00
|
|
|
switch (mc) {
|
|
|
|
case MonitorDisk:
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
default:
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->monitoring_control()->set_value (MonitorDisk, PBD::Controllable::UseGroup);
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->solo_isolate_control()) {
|
|
|
|
_stripable->solo_isolate_control()->set_value (!_stripable->solo_isolate_control()->get_value(), PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->solo_safe_control()) {
|
|
|
|
_stripable->solo_safe_control()->set_value (!_stripable->solo_safe_control()->get_value(), PBD::Controllable::UseGroup);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
/* nothing here */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-07-11 18:17:04 -04:00
|
|
|
|
2016-09-22 15:24:02 -04:00
|
|
|
void
|
|
|
|
TrackMixLayout::button_left ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.access_action ("Editor/select-prev-route");
|
2016-07-10 12:38:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-22 15:24:02 -04:00
|
|
|
TrackMixLayout::button_right ()
|
2016-07-10 12:38:55 -04:00
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.access_action ("Editor/select-next-route");
|
2016-07-10 12:38:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-22 15:24:02 -04:00
|
|
|
TrackMixLayout::simple_control_change (boost::shared_ptr<AutomationControl> ac, Push2::ButtonID bid)
|
2016-07-10 12:38:55 -04:00
|
|
|
{
|
2016-09-25 19:29:30 -04:00
|
|
|
if (!ac || !parent()) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (bid);
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2016-09-25 19:29:30 -04:00
|
|
|
if (!b) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ac->get_value()) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b->set_color (_selection_color);
|
2016-09-22 15:24:02 -04:00
|
|
|
} else {
|
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
}
|
2021-06-18 16:33:32 -04:00
|
|
|
|
2016-09-22 15:24:02 -04:00
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-25 19:29:30 -04:00
|
|
|
TrackMixLayout::solo_mute_change ()
|
2016-09-22 15:24:02 -04:00
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (Push2::Lower2);
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
if (b) {
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<SoloControl> sc = _stripable->solo_control();
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
if (sc) {
|
|
|
|
if (sc->soloed_by_self_or_masters()) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b->set_color (_selection_color);
|
2016-09-25 19:29:30 -04:00
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
} else if (sc->soloed_by_others_upstream() || sc->soloed_by_others_downstream()) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b->set_color (_selection_color);
|
2016-09-25 19:29:30 -04:00
|
|
|
b->set_state (Push2::LED::Blinking8th);
|
|
|
|
} else {
|
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
}
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-25 19:29:30 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Lower1);
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
if (b) {
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<MuteControl> mc = _stripable->mute_control();
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
if (mc) {
|
|
|
|
if (mc->muted_by_self_or_masters()) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b->set_color (_selection_color);
|
2016-09-25 19:29:30 -04:00
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
} else if (mc->muted_by_others_soloing()) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b->set_color (_selection_color);
|
2016-09-25 19:29:30 -04:00
|
|
|
b->set_state (Push2::LED::Blinking8th);
|
|
|
|
} else {
|
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
b->set_color (Push2::LED::DarkGray);
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::rec_enable_change ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
simple_control_change (_stripable->rec_enable_control(), Push2::Lower3);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::solo_iso_change ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
simple_control_change (_stripable->solo_isolate_control(), Push2::Lower6);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
void
|
|
|
|
TrackMixLayout::solo_safe_change ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
simple_control_change (_stripable->solo_safe_control(), Push2::Lower7);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::monitoring_change ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable->monitoring_control()) {
|
2016-09-22 15:24:02 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<Push2::Button> b1 = _p2.button_by_id (Push2::Lower4);
|
|
|
|
boost::shared_ptr<Push2::Button> b2 = _p2.button_by_id (Push2::Lower5);
|
2016-09-22 15:24:02 -04:00
|
|
|
uint8_t b1_color;
|
|
|
|
uint8_t b2_color;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
MonitorChoice mc = _stripable->monitoring_control()->monitoring_choice ();
|
2016-09-22 15:24:02 -04:00
|
|
|
|
|
|
|
switch (mc) {
|
|
|
|
case MonitorAuto:
|
|
|
|
b1_color = Push2::LED::DarkGray;
|
|
|
|
b2_color = Push2::LED::DarkGray;
|
|
|
|
break;
|
|
|
|
case MonitorInput:
|
2021-06-18 16:33:32 -04:00
|
|
|
b1_color = _selection_color;
|
2016-09-22 15:24:02 -04:00
|
|
|
b2_color = Push2::LED::DarkGray;
|
|
|
|
break;
|
|
|
|
case MonitorDisk:
|
|
|
|
b1_color = Push2::LED::DarkGray;
|
2021-06-18 16:33:32 -04:00
|
|
|
b2_color = _selection_color;
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
|
|
|
case MonitorCue:
|
2021-06-18 16:33:32 -04:00
|
|
|
b1_color = _selection_color;
|
|
|
|
b2_color = _selection_color;
|
2016-09-22 15:24:02 -04:00
|
|
|
break;
|
2022-06-21 20:43:35 -04:00
|
|
|
default:
|
|
|
|
return; /* stupid compilers */
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
b1->set_color (b1_color);
|
|
|
|
b1->set_state (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b1->state_msg());
|
2016-09-22 15:24:02 -04:00
|
|
|
|
|
|
|
b2->set_color (b2_color);
|
|
|
|
b2->set_state (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b2->state_msg());
|
2016-07-10 12:38:55 -04:00
|
|
|
}
|
|
|
|
|
2016-09-27 15:31:17 -04:00
|
|
|
void
|
|
|
|
TrackMixLayout::show_state ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable) {
|
2016-09-27 15:31:17 -04:00
|
|
|
name_changed ();
|
|
|
|
color_changed ();
|
|
|
|
solo_mute_change ();
|
|
|
|
rec_enable_change ();
|
|
|
|
solo_iso_change ();
|
|
|
|
solo_safe_change ();
|
|
|
|
monitoring_change ();
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_meter->set_meter (_stripable->peak_meter ().get());
|
2016-09-27 15:31:17 -04:00
|
|
|
} else {
|
2021-06-18 16:33:32 -04:00
|
|
|
_meter->set_meter (0);
|
2016-09-27 15:31:17 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-10 12:38:55 -04:00
|
|
|
void
|
|
|
|
TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable_connections.drop_connections ();
|
2016-07-11 18:17:04 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable = s;
|
2016-07-10 13:02:42 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable) {
|
2016-07-11 18:17:04 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->DropReferences.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::drop_stripable, this), &_p2);
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->PropertyChanged.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &_p2);
|
|
|
|
_stripable->presentation_info().PropertyChanged.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::stripable_property_change, this, _1), &_p2);
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable->solo_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_mute_change, this), &_p2);
|
|
|
|
_stripable->mute_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_mute_change, this), &_p2);
|
|
|
|
_stripable->solo_isolate_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_iso_change, this), &_p2);
|
|
|
|
_stripable->solo_safe_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::solo_safe_change, this), &_p2);
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->rec_enable_control()) {
|
|
|
|
_stripable->rec_enable_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::rec_enable_change, this), &_p2);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable->monitoring_control()) {
|
|
|
|
_stripable->monitoring_control()->Changed.connect (_stripable_connections, invalidator (*this), boost::bind (&TrackMixLayout::monitoring_change, this), &_p2);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_knobs[0]->set_controllable (_stripable->gain_control());
|
|
|
|
_knobs[1]->set_controllable (_stripable->pan_azimuth_control());
|
|
|
|
_knobs[1]->add_flag (Push2Knob::ArcToZero);
|
|
|
|
_knobs[2]->set_controllable (_stripable->pan_width_control());
|
|
|
|
_knobs[3]->set_controllable (_stripable->trim_control());
|
|
|
|
_knobs[3]->add_flag (Push2Knob::ArcToZero);
|
|
|
|
_knobs[4]->set_controllable (boost::shared_ptr<AutomationControl>());
|
|
|
|
_knobs[5]->set_controllable (boost::shared_ptr<AutomationControl>());
|
|
|
|
_knobs[6]->set_controllable (boost::shared_ptr<AutomationControl>());
|
|
|
|
_knobs[7]->set_controllable (boost::shared_ptr<AutomationControl>());
|
2016-07-10 13:02:42 -04:00
|
|
|
}
|
2016-09-27 15:31:17 -04:00
|
|
|
|
|
|
|
show_state ();
|
2016-07-10 13:02:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::drop_stripable ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_stripable_connections.drop_connections ();
|
|
|
|
_stripable.reset ();
|
2016-07-10 13:02:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::name_changed ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_stripable) {
|
2016-09-27 15:31:17 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_name_text->set (_stripable->name());
|
2016-09-27 15:31:17 -04:00
|
|
|
|
|
|
|
/* right justify */
|
|
|
|
|
|
|
|
Duple pos;
|
2021-06-18 16:33:32 -04:00
|
|
|
pos.y = _name_text->position().y;
|
|
|
|
pos.x = display_width() - 10 - _name_text->width();
|
2016-09-27 15:31:17 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_name_text->set_position (pos);
|
2016-09-22 15:24:02 -04:00
|
|
|
}
|
2016-07-10 12:38:55 -04:00
|
|
|
}
|
2016-07-10 15:22:16 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::color_changed ()
|
|
|
|
{
|
2016-09-22 15:24:02 -04:00
|
|
|
if (!parent()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
Gtkmm2ext::Color rgba = _stripable->presentation_info().color();
|
|
|
|
_selection_color = _p2.get_color_index (rgba);
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_name_text->set_color (rgba);
|
2016-07-10 15:22:16 -04:00
|
|
|
|
2016-07-11 18:17:04 -04:00
|
|
|
for (int n = 0; n < 8; ++n) {
|
2021-06-18 16:33:32 -04:00
|
|
|
_knobs[n]->set_text_color (rgba);
|
|
|
|
_knobs[n]->set_arc_start_color (rgba);
|
|
|
|
_knobs[n]->set_arc_end_color (rgba);
|
2016-07-11 18:17:04 -04:00
|
|
|
}
|
2016-07-10 15:22:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::stripable_property_change (PropertyChange const& what_changed)
|
|
|
|
{
|
|
|
|
if (what_changed.contains (Properties::color)) {
|
|
|
|
color_changed ();
|
|
|
|
}
|
|
|
|
if (what_changed.contains (Properties::name)) {
|
|
|
|
name_changed ();
|
|
|
|
}
|
|
|
|
}
|
2016-07-11 18:17:04 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::strip_vpot (int n, int delta)
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<Controllable> ac = _knobs[n]->controllable();
|
2016-07-11 18:17:04 -04:00
|
|
|
|
|
|
|
if (ac) {
|
|
|
|
ac->set_value (ac->get_value() + ((2.0/64.0) * delta), PBD::Controllable::UseGroup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::strip_vpot_touch (int n, bool touching)
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
boost::shared_ptr<AutomationControl> ac = _knobs[n]->controllable();
|
2016-07-11 18:17:04 -04:00
|
|
|
if (ac) {
|
2021-06-18 16:33:32 -04:00
|
|
|
const timepos_t now (_session.audible_sample());
|
2016-07-11 18:17:04 -04:00
|
|
|
if (touching) {
|
2020-09-21 16:28:23 -04:00
|
|
|
ac->start_touch (now);
|
2016-07-11 18:17:04 -04:00
|
|
|
} else {
|
2020-09-21 16:28:23 -04:00
|
|
|
ac->stop_touch (now);
|
2016-07-11 18:17:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-23 19:18:27 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::update_meters ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (!_stripable) {
|
2016-09-23 19:18:27 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_meter->update_meters ();
|
2016-09-23 19:18:27 -04:00
|
|
|
}
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
TrackMixLayout::update_clocks ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
samplepos_t pos = _session.audible_sample();
|
2016-09-25 19:29:30 -04:00
|
|
|
bool negative = false;
|
|
|
|
|
|
|
|
if (pos < 0) {
|
|
|
|
pos = -pos;
|
|
|
|
negative = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
char buf[16];
|
2021-10-09 13:47:13 -04:00
|
|
|
Temporal::BBT_Time BBT = Temporal::TempoMap::fetch()->bbt_at (timepos_t (pos));
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
#define BBT_BAR_CHAR "|"
|
|
|
|
|
|
|
|
if (negative) {
|
|
|
|
snprintf (buf, sizeof (buf), "-%03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32,
|
|
|
|
BBT.bars, BBT.beats, BBT.ticks);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof (buf), " %03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32,
|
|
|
|
BBT.bars, BBT.beats, BBT.ticks);
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_bbt_text->set (buf);
|
2016-09-25 19:29:30 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplecnt_t left;
|
2016-09-25 19:29:30 -04:00
|
|
|
int hrs;
|
|
|
|
int mins;
|
|
|
|
int secs;
|
|
|
|
int millisecs;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
const double sample_rate = _session.sample_rate ();
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
left = pos;
|
2017-09-18 12:39:17 -04:00
|
|
|
hrs = (int) floor (left / (sample_rate * 60.0f * 60.0f));
|
|
|
|
left -= (samplecnt_t) floor (hrs * sample_rate * 60.0f * 60.0f);
|
|
|
|
mins = (int) floor (left / (sample_rate * 60.0f));
|
|
|
|
left -= (samplecnt_t) floor (mins * sample_rate * 60.0f);
|
|
|
|
secs = (int) floor (left / (float) sample_rate);
|
|
|
|
left -= (samplecnt_t) floor ((double)(secs * sample_rate));
|
|
|
|
millisecs = floor (left * 1000.0 / (float) sample_rate);
|
2016-09-25 19:29:30 -04:00
|
|
|
|
|
|
|
if (negative) {
|
|
|
|
snprintf (buf, sizeof (buf), "-%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
|
|
|
|
} else {
|
|
|
|
snprintf (buf, sizeof (buf), " %02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_minsec_text->set (buf);
|
2016-09-25 19:29:30 -04:00
|
|
|
}
|