2016-07-10 10:49:39 -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-09-21 16:25:24 -04:00
|
|
|
#include "gtkmm2ext/gui_thread.h"
|
|
|
|
|
2017-07-17 12:34:35 -04:00
|
|
|
#include "gtkmm2ext/colors.h"
|
2016-09-21 16:25:24 -04:00
|
|
|
#include "canvas/rectangle.h"
|
|
|
|
#include "canvas/text.h"
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2016-09-21 16:25:24 -04:00
|
|
|
#include "canvas.h"
|
2016-07-10 10:49:39 -04:00
|
|
|
#include "menu.h"
|
2016-07-10 12:38:36 -04:00
|
|
|
#include "push2.h"
|
|
|
|
#include "scale.h"
|
2016-07-10 10:49:39 -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 10:49:39 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Glib;
|
|
|
|
using namespace ArdourSurface;
|
2017-07-17 12:34:35 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2016-09-16 09:39:28 -04:00
|
|
|
using namespace ArdourCanvas;
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2016-09-21 16:25:24 -04:00
|
|
|
static double unselected_root_alpha = 0.5;
|
|
|
|
|
2021-06-19 02:14:58 -04:00
|
|
|
static const char*
|
2021-06-19 16:34:19 -04:00
|
|
|
row_interval_string (const Push2::RowInterval row_interval, const bool inkey)
|
2021-06-19 02:14:58 -04:00
|
|
|
{
|
|
|
|
switch (row_interval) {
|
|
|
|
case Push2::Third:
|
2023-01-16 15:41:09 -05:00
|
|
|
return _(u8"3rd \u2191");
|
2021-06-19 02:14:58 -04:00
|
|
|
case Push2::Fourth:
|
2023-01-16 15:41:09 -05:00
|
|
|
return _(u8"4th \u2191");
|
2021-06-19 02:14:58 -04:00
|
|
|
case Push2::Fifth:
|
2023-01-16 15:41:09 -05:00
|
|
|
return _(u8"5th \u2191");
|
2021-06-19 02:14:58 -04:00
|
|
|
case Push2::Sequential:
|
2023-01-16 15:41:09 -05:00
|
|
|
return inkey ? _(u8"Octave \u2191") : _(u8"Sequential \u2191");
|
2021-06-19 02:14:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2021-06-19 15:59:55 -04:00
|
|
|
static const char*
|
|
|
|
column_interval_string (const bool inkey)
|
|
|
|
{
|
2023-01-16 15:41:09 -05:00
|
|
|
return inkey ? _(u8"Scale \u2192") : _(u8"Semitone \u2192");
|
2021-06-19 15:59:55 -04:00
|
|
|
}
|
|
|
|
|
2016-09-27 15:31:17 -04:00
|
|
|
ScaleLayout::ScaleLayout (Push2& p, Session & s, std::string const & name)
|
|
|
|
: Push2Layout (p, s, name)
|
2021-06-18 16:33:32 -04:00
|
|
|
, _last_vpot (-1)
|
|
|
|
, _vpot_delta_cnt (0)
|
2016-07-10 10:49:39 -04:00
|
|
|
{
|
2016-09-21 16:25:24 -04:00
|
|
|
Pango::FontDescription fd ("Sans 10");
|
|
|
|
|
|
|
|
/* background */
|
|
|
|
|
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-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_left_scroll_text = new Text (this);
|
|
|
|
_left_scroll_text->set_font_description (fd);
|
|
|
|
_left_scroll_text->set_position (Duple (10, 5));
|
|
|
|
_left_scroll_text->set_color (_p2.get_color (Push2::LightBackground));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_close_text = new Text (this);
|
|
|
|
_close_text->set_font_description (fd);
|
2021-06-19 02:14:58 -04:00
|
|
|
_close_text->set_position (Duple (10, 5));
|
2021-06-18 16:33:32 -04:00
|
|
|
_close_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_close_text->set (_("Close"));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_right_scroll_text = new Text (this);
|
|
|
|
_right_scroll_text->set_font_description (fd);
|
|
|
|
_right_scroll_text->set_position (Duple (10 + (7 * Push2Canvas::inter_button_spacing()), 5));
|
|
|
|
_right_scroll_text->set_color (_p2.get_color (Push2::LightBackground));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
Pango::FontDescription fd2 ("Sans 8");
|
2021-06-18 16:33:32 -04:00
|
|
|
_inkey_text = new Text (this);
|
|
|
|
_inkey_text->set_font_description (fd2);
|
|
|
|
_inkey_text->set_position (Duple (10, 140));
|
|
|
|
_inkey_text->set_color (_p2.get_color (Push2::LightBackground));
|
2021-06-19 15:59:55 -04:00
|
|
|
_inkey_text->set (_("Scale"));
|
2021-06-18 16:33:32 -04:00
|
|
|
|
|
|
|
_chromatic_text = new Text (this);
|
|
|
|
_chromatic_text->set_font_description (fd2);
|
|
|
|
_chromatic_text->set_position (Duple (45, 140));
|
|
|
|
_chromatic_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_chromatic_text->set (_("Chromatic"));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-19 15:12:12 -04:00
|
|
|
_fixed_text = new Text (this);
|
|
|
|
_fixed_text->set_font_description (fd2);
|
|
|
|
_fixed_text->set_position (Duple (10 + (7 * Push2Canvas::inter_button_spacing()), 140));
|
|
|
|
_fixed_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_fixed_text->set (_("Fixed"));
|
|
|
|
|
|
|
|
_rooted_text = new Text (this);
|
|
|
|
_rooted_text->set_font_description (fd2);
|
|
|
|
_rooted_text->set_position (Duple (45 + (7 * Push2Canvas::inter_button_spacing()), 140));
|
|
|
|
_rooted_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_rooted_text->set (_("Rooted"));
|
|
|
|
|
2021-06-19 02:14:58 -04:00
|
|
|
_row_interval_text = new Text (this);
|
|
|
|
_row_interval_text->set_font_description (fd);
|
2021-06-19 15:59:55 -04:00
|
|
|
_row_interval_text->set_position (Duple (10, 60));
|
2021-06-19 02:14:58 -04:00
|
|
|
_row_interval_text->set_color (_p2.get_color (Push2::LightBackground));
|
2021-06-19 16:34:19 -04:00
|
|
|
_row_interval_text->set (row_interval_string (_p2.row_interval (), _p2.in_key ()));
|
2021-06-19 02:14:58 -04:00
|
|
|
|
2021-06-19 15:59:55 -04:00
|
|
|
_column_interval_text = new Text (this);
|
|
|
|
_column_interval_text->set_font_description (fd);
|
|
|
|
_column_interval_text->set_position (Duple (10, 80));
|
|
|
|
_column_interval_text->set_color (_p2.get_color (Push2::LightBackground));
|
|
|
|
_column_interval_text->set (column_interval_string (false));
|
|
|
|
|
2016-09-21 16:25:24 -04:00
|
|
|
for (int n = 0; n < 8; ++n) {
|
|
|
|
|
|
|
|
/* text labels for root notes etc.*/
|
|
|
|
|
|
|
|
Text* t = new Text (this);
|
|
|
|
t->set_font_description (fd);
|
2021-06-18 16:33:32 -04:00
|
|
|
t->set_color (change_alpha (_p2.get_color (Push2::LightBackground), unselected_root_alpha));
|
2016-09-21 16:25:24 -04:00
|
|
|
t->set_position (Duple (10 + (n * Push2Canvas::inter_button_spacing()), 5));
|
|
|
|
|
|
|
|
switch (n) {
|
|
|
|
case 0:
|
|
|
|
/* zeroth element is a dummy */
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
t->set (S_("Note|C"));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
t->set (S_("Note|G"));
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
t->set (S_("Note|D"));
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
t->set (S_("Note|A"));
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
t->set (S_("Note|E"));
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
t->set (S_("Note|B"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_upper_text.push_back (t);
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
t = new Text (this);
|
|
|
|
t->set_font_description (fd);
|
2021-06-18 16:33:32 -04:00
|
|
|
t->set_color (change_alpha (_p2.get_color (Push2::LightBackground), unselected_root_alpha));
|
2016-09-21 16:25:24 -04:00
|
|
|
t->set_position (Duple (10 + (n*Push2Canvas::inter_button_spacing()), 140));
|
|
|
|
|
|
|
|
switch (n) {
|
|
|
|
case 0:
|
|
|
|
/* zeroth element is a dummy */
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
t->set (S_("Note|F"));
|
|
|
|
break;
|
|
|
|
case 2:
|
2023-01-16 15:41:09 -05:00
|
|
|
t->set (S_(u8"Note|B\u266D/A\u266F"));
|
2016-09-21 16:25:24 -04:00
|
|
|
break;
|
|
|
|
case 3:
|
2023-01-16 15:41:09 -05:00
|
|
|
t->set (S_(u8"Note|E\u266D/D\u266F"));
|
2016-09-21 16:25:24 -04:00
|
|
|
break;
|
|
|
|
case 4:
|
2023-01-16 15:41:09 -05:00
|
|
|
t->set (S_(u8"Note|A\u266D/G\u266F"));
|
2016-09-21 16:25:24 -04:00
|
|
|
break;
|
|
|
|
case 5:
|
2023-01-16 15:41:09 -05:00
|
|
|
t->set (S_(u8"Note|D\u266D/C\u266F"));
|
2016-09-21 16:25:24 -04:00
|
|
|
break;
|
|
|
|
case 6:
|
2023-01-16 15:41:09 -05:00
|
|
|
t->set (S_(u8"Note|G\u266D/F\u266F"));
|
2016-09-21 16:25:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_lower_text.push_back (t);
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
build_scale_menu ();
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.ScaleChange.connect (_p2_connections, invalidator (*this), boost::bind (&ScaleLayout::show_root_state, this), &_p2);
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ScaleLayout::~ScaleLayout ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-09-16 09:39:28 -04:00
|
|
|
void
|
|
|
|
ScaleLayout::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
2016-07-10 10:49:39 -04:00
|
|
|
{
|
2016-09-21 16:25:24 -04:00
|
|
|
render_children (area, context);
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::button_upper (uint32_t n)
|
|
|
|
{
|
2016-09-21 16:25:24 -04:00
|
|
|
if (n == 0) {
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->can_scroll_left()) {
|
|
|
|
_scale_menu->scroll (Push2Menu::DirectionLeft, true);
|
2016-09-21 16:25:24 -04:00
|
|
|
} else {
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.use_previous_layout ();
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n == 7) {
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->scroll (Push2Menu::DirectionRight, true);
|
2016-09-21 16:25:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-30 13:07:53 -04:00
|
|
|
int root = 0;
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
switch (n) {
|
|
|
|
case 1:
|
|
|
|
/* C */
|
|
|
|
root = 0;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
/* G */
|
|
|
|
root = 7;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
/* D */
|
|
|
|
root = 2;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
/* A */
|
|
|
|
root = 9;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
/* E */
|
|
|
|
root = 4;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
/* B */
|
|
|
|
root = 11;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
/* unused */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.set_pad_scale (root,
|
|
|
|
_p2.root_octave (),
|
|
|
|
_p2.mode (),
|
2021-06-19 15:12:12 -04:00
|
|
|
_p2.note_grid_origin (),
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.row_interval (),
|
|
|
|
_p2.in_key ());
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::button_lower (uint32_t n)
|
|
|
|
{
|
2016-09-21 16:25:24 -04:00
|
|
|
if (n == 0) {
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.set_pad_scale (_p2.scale_root (),
|
|
|
|
_p2.root_octave (),
|
|
|
|
_p2.mode (),
|
2021-06-19 15:12:12 -04:00
|
|
|
_p2.note_grid_origin (),
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.row_interval (),
|
|
|
|
!_p2.in_key ());
|
2016-09-21 16:25:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-19 15:12:12 -04:00
|
|
|
int root = _p2.scale_root();
|
|
|
|
Push2::NoteGridOrigin origin = _p2.note_grid_origin ();
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
switch (n) {
|
|
|
|
case 1:
|
|
|
|
/* F */
|
|
|
|
root = 5;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
/* B-flat */
|
|
|
|
root = 10;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
/* E flat */
|
|
|
|
root = 3;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
/* A flat */
|
|
|
|
root = 8;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
/* D flat */
|
|
|
|
root = 1;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
/* G flat */
|
|
|
|
root = 6;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
/* fixed mode */
|
2021-06-19 15:12:12 -04:00
|
|
|
origin = (origin == Push2::Fixed) ? Push2::Rooted : Push2::Fixed;
|
|
|
|
break;
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.set_pad_scale (root,
|
|
|
|
_p2.root_octave (),
|
|
|
|
_p2.mode (),
|
2021-06-19 15:12:12 -04:00
|
|
|
origin,
|
2021-06-19 02:14:58 -04:00
|
|
|
_p2.row_interval (),
|
|
|
|
_p2.in_key ());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::button_up ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->scroll (Push2Menu::DirectionUp);
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-21 16:25:24 -04:00
|
|
|
ScaleLayout::button_down ()
|
2016-07-10 10:49:39 -04:00
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->scroll (Push2Menu::DirectionDown);
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::button_left ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->scroll (Push2Menu::DirectionLeft);
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::button_right ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->scroll (Push2Menu::DirectionRight);
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::show ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Push2::Button> b;
|
2016-09-22 15:24:02 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_last_vpot = -1;
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Upper1);
|
2016-09-22 15:24:02 -04:00
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
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
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Upper8);
|
2016-09-22 15:24:02 -04:00
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
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
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Lower1);
|
2016-09-22 15:24:02 -04:00
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
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-21 16:25:24 -04:00
|
|
|
/* all root buttons should be dimly lit */
|
|
|
|
|
|
|
|
Push2::ButtonID root_buttons[] = { Push2::Upper2, Push2::Upper3, Push2::Upper4, Push2::Upper5, Push2::Upper6, Push2::Upper7,
|
|
|
|
Push2::Lower2, Push2::Lower3, Push2::Lower4, Push2::Lower5, Push2::Lower6, Push2::Lower7, };
|
|
|
|
|
|
|
|
for (size_t n = 0; n < sizeof (root_buttons) / sizeof (root_buttons[0]); ++n) {
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (root_buttons[n]);
|
2016-09-21 16:25:24 -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-07-10 10:49:39 -04:00
|
|
|
}
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
show_root_state ();
|
2021-06-19 15:12:12 -04:00
|
|
|
show_fixed_state ();
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
Container::show ();
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-21 16:25:24 -04:00
|
|
|
ScaleLayout::strip_vpot (int n, int delta)
|
2016-07-10 10:49:39 -04:00
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_last_vpot != n) {
|
2021-06-19 02:14:58 -04:00
|
|
|
if (n > 0) {
|
|
|
|
uint32_t effective_column = n - 1;
|
|
|
|
uint32_t active = _scale_menu->active ();
|
|
|
|
|
|
|
|
if (active / _scale_menu->rows() != effective_column) {
|
|
|
|
/* knob turned is different than the current active column.
|
|
|
|
Just change that.
|
|
|
|
*/
|
|
|
|
_scale_menu->set_active (effective_column * _scale_menu->rows()); /* top entry of that column */
|
|
|
|
return;
|
|
|
|
}
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* new vpot, reset delta cnt */
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_vpot_delta_cnt = 0;
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if ((delta < 0 && _vpot_delta_cnt > 0) || (delta > 0 && _vpot_delta_cnt < 0)) {
|
2016-09-21 16:25:24 -04:00
|
|
|
/* direction changed, reset */
|
2021-06-18 16:33:32 -04:00
|
|
|
_vpot_delta_cnt = 0;
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_vpot_delta_cnt += delta;
|
|
|
|
_last_vpot = n;
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
/* this thins out vpot delta events so that we don't scroll so fast
|
|
|
|
through the menu.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const int vpot_slowdown_factor = 4;
|
|
|
|
|
2021-06-19 02:14:58 -04:00
|
|
|
const bool moved_enough = _vpot_delta_cnt % vpot_slowdown_factor == 0;
|
|
|
|
if (moved_enough) {
|
|
|
|
if (n == 0) {
|
|
|
|
Push2::RowInterval row_interval = _p2.row_interval();
|
|
|
|
if (_vpot_delta_cnt < 0 && row_interval > Push2::Third) {
|
|
|
|
row_interval = (Push2::RowInterval)(row_interval - 1);
|
|
|
|
} else if (_vpot_delta_cnt > 0 && row_interval < Push2::Sequential) {
|
|
|
|
row_interval = (Push2::RowInterval)(row_interval + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
_p2.set_pad_scale (_p2.scale_root (),
|
|
|
|
_p2.root_octave (),
|
|
|
|
_p2.mode (),
|
2021-06-19 15:12:12 -04:00
|
|
|
_p2.note_grid_origin (),
|
2021-06-19 02:14:58 -04:00
|
|
|
row_interval,
|
|
|
|
_p2.in_key ());
|
|
|
|
|
2021-06-19 16:34:19 -04:00
|
|
|
_row_interval_text->set(row_interval_string(row_interval, _p2.in_key ()));
|
2021-06-19 02:14:58 -04:00
|
|
|
} else {
|
|
|
|
if (_vpot_delta_cnt < 0) {
|
|
|
|
_scale_menu->scroll (Push2Menu::DirectionUp);
|
|
|
|
} else {
|
|
|
|
_scale_menu->scroll (Push2Menu::DirectionDown);
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-09-16 09:39:28 -04:00
|
|
|
ScaleLayout::build_scale_menu ()
|
2016-07-10 10:49:39 -04:00
|
|
|
{
|
2021-06-18 20:31:35 -04:00
|
|
|
std::vector<std::string> v;
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2016-09-21 16:25:24 -04:00
|
|
|
/* must match in which enums are declared in push2.h
|
|
|
|
*/
|
2016-07-10 10:49:39 -04:00
|
|
|
|
|
|
|
v.push_back ("Dorian");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Ionian (Major)");
|
2016-09-28 11:47:10 -04:00
|
|
|
v.push_back ("Aeolian (Minor)");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Harmonic Minor");
|
|
|
|
v.push_back ("MelodicMinor Asc.");
|
|
|
|
v.push_back ("MelodicMinor Desc.");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Phrygian");
|
|
|
|
v.push_back ("Lydian");
|
|
|
|
v.push_back ("Mixolydian");
|
|
|
|
v.push_back ("Locrian");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Pentatonic Major");
|
|
|
|
v.push_back ("Pentatonic Minor");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Chromatic");
|
2016-09-28 11:47:10 -04:00
|
|
|
v.push_back ("Blues Scale");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Neapolitan Minor");
|
|
|
|
v.push_back ("Neapolitan Major");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Oriental");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Double Harmonic");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Enigmatic");
|
|
|
|
v.push_back ("Hirajoshi");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Hungarian Minor");
|
|
|
|
v.push_back ("Hungarian Major");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Kumoi");
|
|
|
|
v.push_back ("Iwato");
|
|
|
|
v.push_back ("Hindu");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Spanish 8 Tone");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Pelog");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Hungarian Gypsy");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Overtone");
|
2016-09-21 16:25:24 -04:00
|
|
|
v.push_back ("Leading Whole Tone");
|
2016-07-10 10:49:39 -04:00
|
|
|
v.push_back ("Arabian");
|
|
|
|
v.push_back ("Balinese");
|
|
|
|
v.push_back ("Gypsy");
|
|
|
|
v.push_back ("Mohammedan");
|
|
|
|
v.push_back ("Javanese");
|
|
|
|
v.push_back ("Persian");
|
|
|
|
v.push_back ("Algeria");
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu = new Push2Menu (this, v);
|
|
|
|
_scale_menu->Rearranged.connect (_menu_connections, invalidator (*this), boost::bind (&ScaleLayout::menu_rearranged, this), &_p2);
|
2016-07-10 10:49:39 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->set_layout (6, 6);
|
|
|
|
_scale_menu->set_text_color (_p2.get_color (Push2::ParameterName));
|
|
|
|
_scale_menu->set_active_color (_p2.get_color (Push2::LightBackground));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-19 16:35:55 -04:00
|
|
|
Pango::FontDescription fd ("Sans Bold Condensed 8");
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->set_font_description (fd);
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 20:32:09 -04:00
|
|
|
/* Move menu horizontally so that the leftmost column is in the
|
|
|
|
2nd-from-left column of the display/button layout. The Y position is
|
|
|
|
just what appears centered to me. */
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 20:32:09 -04:00
|
|
|
_scale_menu->set_position (Duple (10 + Push2Canvas::inter_button_spacing(), 32));
|
2016-09-21 16:25:24 -04:00
|
|
|
|
|
|
|
/* listen for changes */
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->ActiveChanged.connect (_menu_connections, invalidator (*this), boost::bind (&ScaleLayout::mode_changed, this), &_p2);
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::show_root_state ()
|
|
|
|
{
|
|
|
|
if (!parent()) {
|
|
|
|
/* don't do this stuff if we're not visible */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-06-19 16:34:19 -04:00
|
|
|
_row_interval_text->set (
|
|
|
|
row_interval_string (_p2.row_interval (), _p2.in_key ()));
|
|
|
|
|
|
|
|
_column_interval_text->set (column_interval_string (_p2.in_key ()));
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_p2.in_key()) {
|
|
|
|
_chromatic_text->set_color (change_alpha (_chromatic_text->color(), unselected_root_alpha));
|
|
|
|
_inkey_text->set_color (change_alpha (_inkey_text->color(), 1.0));
|
2016-09-21 16:25:24 -04:00
|
|
|
} else {
|
2021-06-18 16:33:32 -04:00
|
|
|
_inkey_text->set_color (change_alpha (_chromatic_text->color(), unselected_root_alpha));
|
|
|
|
_chromatic_text->set_color (change_alpha (_inkey_text->color(), 1.0));
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Pango::FontDescription fd_bold ("Sans Bold 10");
|
|
|
|
Pango::FontDescription fd ("Sans 10");
|
|
|
|
|
|
|
|
uint32_t highlight_text = 0;
|
2021-06-18 20:31:35 -04:00
|
|
|
std::vector<Text*>* none_text_array = 0;
|
|
|
|
std::vector<Text*>* one_text_array = 0;
|
2016-09-30 13:07:53 -04:00
|
|
|
Push2::ButtonID bid = Push2::Upper2; /* keep compilers quiet */
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
switch (_p2.scale_root()) {
|
2016-09-21 16:25:24 -04:00
|
|
|
case 0:
|
|
|
|
highlight_text = 1;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper2;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
highlight_text = 5;
|
2021-06-19 14:16:11 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower6;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
highlight_text = 3;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper4;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
highlight_text = 3;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower4;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
highlight_text = 5;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper6;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
highlight_text = 1;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower2;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
highlight_text = 6;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower7;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
highlight_text = 2;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper3;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
highlight_text = 4;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower5;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
highlight_text = 4;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper5;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
highlight_text = 2;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_upper_text;
|
|
|
|
one_text_array = &_lower_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Lower3;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
highlight_text = 6;
|
2021-06-18 16:33:32 -04:00
|
|
|
none_text_array = &_lower_text;
|
|
|
|
one_text_array = &_upper_text;
|
2016-09-21 16:25:24 -04:00
|
|
|
bid = Push2::Upper7;
|
|
|
|
break;
|
2016-09-30 13:07:53 -04:00
|
|
|
default:
|
|
|
|
return;
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (none_text_array) {
|
|
|
|
|
|
|
|
for (uint32_t nn = 1; nn < 7; ++nn) {
|
|
|
|
(*none_text_array)[nn]->set_font_description (fd);
|
|
|
|
(*none_text_array)[nn]->set_color (change_alpha ((*none_text_array)[nn]->color(), unselected_root_alpha));
|
|
|
|
|
|
|
|
if (nn == highlight_text) {
|
|
|
|
(*one_text_array)[nn]->set_font_description (fd_bold);
|
|
|
|
(*one_text_array)[nn]->set_color (change_alpha ((*one_text_array)[nn]->color(), 1.0));
|
|
|
|
} else {
|
|
|
|
(*one_text_array)[nn]->set_font_description (fd);
|
|
|
|
(*one_text_array)[nn]->set_color (change_alpha ((*one_text_array)[nn]->color(), unselected_root_alpha));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Push2::Button> b = _p2.button_by_id (bid);
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (b != _root_button) {
|
|
|
|
if (_root_button) {
|
2016-09-21 16:25:24 -04:00
|
|
|
/* turn the old one off (but not totally) */
|
2021-06-18 16:33:32 -04:00
|
|
|
_root_button->set_color (Push2::LED::DarkGray);
|
|
|
|
_root_button->set_state (Push2::LED::OneShot24th);
|
|
|
|
_p2.write (_root_button->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_root_button = b;
|
2016-09-21 16:25:24 -04:00
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_root_button) {
|
2016-09-21 16:25:24 -04:00
|
|
|
/* turn the new one on */
|
2021-06-18 16:33:32 -04:00
|
|
|
_root_button->set_color (Push2::LED::White);
|
|
|
|
_root_button->set_state (Push2::LED::OneShot24th);
|
|
|
|
_p2.write (_root_button->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
_scale_menu->set_active ((uint32_t) _p2.mode ());
|
2021-06-19 15:12:12 -04:00
|
|
|
|
|
|
|
show_fixed_state ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::show_fixed_state ()
|
|
|
|
{
|
|
|
|
if (!parent()) {
|
|
|
|
/* don't do this stuff if we're not visible */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_p2.note_grid_origin() == Push2::Fixed) {
|
|
|
|
_rooted_text->set_color (change_alpha (_fixed_text->color(), unselected_root_alpha));
|
|
|
|
_fixed_text->set_color (change_alpha (_rooted_text->color(), 1.0));
|
|
|
|
} else {
|
|
|
|
_fixed_text->set_color (change_alpha (_fixed_text->color(), unselected_root_alpha));
|
|
|
|
_rooted_text->set_color (change_alpha (_rooted_text->color(), 1.0));
|
|
|
|
}
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::mode_changed ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
MusicalMode::Type m = (MusicalMode::Type) _scale_menu->active();
|
2021-06-19 15:12:12 -04:00
|
|
|
_p2.set_pad_scale (_p2.scale_root (),
|
|
|
|
_p2.root_octave (),
|
|
|
|
m,
|
|
|
|
_p2.note_grid_origin (),
|
|
|
|
_p2.row_interval (),
|
|
|
|
_p2.in_key ());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::menu_rearranged ()
|
|
|
|
{
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->can_scroll_left()) {
|
|
|
|
_left_scroll_text->set ("<");
|
|
|
|
_close_text->hide ();
|
2016-09-21 16:25:24 -04:00
|
|
|
} else {
|
2021-06-18 20:31:35 -04:00
|
|
|
_left_scroll_text->set (std::string());
|
2021-06-18 16:33:32 -04:00
|
|
|
_close_text->show ();
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->can_scroll_right()) {
|
|
|
|
_right_scroll_text->set (">");
|
2016-09-21 16:25:24 -04:00
|
|
|
} else {
|
2021-06-18 20:31:35 -04:00
|
|
|
_right_scroll_text->set (std::string());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ScaleLayout::update_cursor_buttons ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Push2::Button> b;
|
2016-09-21 16:25:24 -04:00
|
|
|
bool change;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Up);
|
2016-09-21 16:25:24 -04:00
|
|
|
change = false;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->active() == 0) {
|
2016-09-21 16:25:24 -04:00
|
|
|
if (b->color_index() != Push2::LED::Black) {
|
|
|
|
b->set_color (Push2::LED::Black);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (b->color_index() != Push2::LED::White) {
|
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (change) {
|
|
|
|
b->set_state (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* down */
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Down);
|
2016-09-21 16:25:24 -04:00
|
|
|
change = false;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->active() == _scale_menu->items() - 1) {
|
2016-09-21 16:25:24 -04:00
|
|
|
if (b->color_index() != Push2::LED::Black) {
|
|
|
|
b->set_color (Push2::LED::Black);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (b->color_index() != Push2::LED::White) {
|
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (change) {
|
|
|
|
b->set_color (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* left */
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Left);
|
2016-09-21 16:25:24 -04:00
|
|
|
change = false;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->active() < _scale_menu->rows()) {
|
2016-09-21 16:25:24 -04:00
|
|
|
if (b->color_index() != Push2::LED::Black) {
|
|
|
|
b->set_color (Push2::LED::Black);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (b->color_index() != Push2::LED::White) {
|
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (change) {
|
|
|
|
b->set_color (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* right */
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
b = _p2.button_by_id (Push2::Right);
|
2016-09-21 16:25:24 -04:00
|
|
|
change = false;
|
|
|
|
|
2021-06-18 16:33:32 -04:00
|
|
|
if (_scale_menu->active() > (_scale_menu->items() - _scale_menu->rows())) {
|
2016-09-21 16:25:24 -04:00
|
|
|
if (b->color_index() != Push2::LED::Black) {
|
|
|
|
b->set_color (Push2::LED::Black);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (b->color_index() != Push2::LED::White) {
|
|
|
|
b->set_color (Push2::LED::White);
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (change) {
|
|
|
|
b->set_color (Push2::LED::OneShot24th);
|
2021-06-18 16:33:32 -04:00
|
|
|
_p2.write (b->state_msg());
|
2016-09-21 16:25:24 -04:00
|
|
|
}
|
2016-07-10 10:49:39 -04:00
|
|
|
}
|