push2: an ever-growing array of cue-related support

This commit is contained in:
Paul Davis
2022-08-26 19:23:43 -06:00
parent f835fb279a
commit 1ecdeb25a7
6 changed files with 200 additions and 59 deletions

View File

@@ -145,7 +145,7 @@ Push2::build_maps ()
MAKE_COLOR_BUTTON_PRESS (Master, 28, &Push2::button_master);
MAKE_COLOR_BUTTON_PRESS (Mute, 60, &Push2::button_mute);
MAKE_COLOR_BUTTON_PRESS_RELEASE_LONG (Solo, 61, &Push2::relax, &Push2::button_solo, &Push2::button_solo_long_press);
MAKE_COLOR_BUTTON_PRESS (Stop, 29, &Push2::button_stop);
MAKE_COLOR_BUTTON_PRESS_RELEASE_LONG (Stop, 29, &Push2::button_stop_press, &Push2::button_stop_release, &Push2::button_stop_long_press);
MAKE_COLOR_BUTTON_PRESS (Fwd32ndT, 43, &Push2::button_fwd32t);
MAKE_COLOR_BUTTON_PRESS (Fwd32nd,42 , &Push2::button_fwd32);
MAKE_COLOR_BUTTON_PRESS (Fwd16thT, 41, &Push2::button_fwd16t);
@@ -407,13 +407,15 @@ Push2::button_down ()
void
Push2::button_page_right ()
{
ScrollTimeline (0.75);
_current_layout->button_page_right();
// ScrollTimeline (0.75);
}
void
Push2::button_page_left ()
{
ScrollTimeline (-0.75);
_current_layout->button_page_left();
// ScrollTimeline (-0.75);
}
void
@@ -538,57 +540,89 @@ Push2::button_undo ()
void
Push2::button_fwd32t ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (0+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (0);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (0+n);
}
}
void
Push2::button_fwd32 ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (1+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (1);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (1+n);
}
}
void
Push2::button_fwd16t ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (2+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (2);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (2+n);
}
}
void
Push2::button_fwd16 ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (3+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (3);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (3+n);
}
}
void
Push2::button_fwd8t ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (4+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (4);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (4+n);
}
}
void
Push2::button_fwd8 ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (5+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (5);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (5+n);
}
}
void
Push2::button_fwd4t ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (6+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (6);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (6+n);
}
}
void
Push2::button_fwd4 ()
{
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (7+n);
if (_current_layout == _cue_layout) {
_cue_layout->button_rhs (7);
} else {
const int n = (_modifier_state & ModShift) ? 8 : 0;
goto_nth_marker (7+n);
}
}
void
@@ -598,10 +632,29 @@ Push2::button_add_track ()
}
void
Push2::button_stop ()
Push2::button_stop_press ()
{
_stop_down = true;
_current_layout->button_stop_press ();
/* XXX this needs a better binding */
/* close current window */
access_action ("Main/close-current-dialog");
// access_action ("Main/close-current-dialog");
}
void
Push2::button_stop_release ()
{
_stop_down = false;
_current_layout->button_stop_release ();
}
void
Push2::button_stop_long_press ()
{
_current_layout->button_stop_long_press ();
/* XXX this needs a better binding */
/* close current window */
// access_action ("Main/close-current-dialog");
}
void
@@ -687,28 +740,36 @@ Push2::start_press_timeout (boost::shared_ptr<Button> button, ButtonID id)
void
Push2::button_octave_down ()
{
if (_modifier_state & ModShift) {
_octave_shift = 0;
return;
}
if (_current_layout == _scale_layout) {
if (_modifier_state & ModShift) {
_octave_shift = 0;
return;
}
int os = (std::max (-4, _octave_shift - 1));
if (os != _octave_shift) {
_octave_shift = os;
int os = (std::max (-4, _octave_shift - 1));
if (os != _octave_shift) {
_octave_shift = os;
}
} else if (_current_layout) {
_current_layout->button_octave_up ();
}
}
void
Push2::button_octave_up ()
{
if (_modifier_state & ModShift) {
_octave_shift = 0;
return;
}
if (_current_layout == _scale_layout) {
if (_modifier_state & ModShift) {
_octave_shift = 0;
return;
}
int os = (std::min (4, _octave_shift + 1));
if (os != _octave_shift) {
_octave_shift = os;
int os = (std::min (4, _octave_shift + 1));
if (os != _octave_shift) {
_octave_shift = os;
}
} else if (_current_layout) {
_current_layout->button_octave_up ();
}
}

View File

@@ -79,8 +79,8 @@ using namespace ArdourCanvas;
CueLayout::CueLayout (Push2& p, Session & s, std::string const & name)
: Push2Layout (p, s, name)
, left_edge_index (0)
, top_edge_index (0)
, track_base (0)
, scene_base (0)
{
Pango::FontDescription fd ("Sans 10");
@@ -125,16 +125,30 @@ CueLayout::~CueLayout ()
void
CueLayout::show ()
{
Push2::ButtonID lower_buttons[] = { Push2::Lower1, Push2::Lower2, Push2::Lower3, Push2::Lower4,
Push2::Lower5, Push2::Lower6, Push2::Lower7, Push2::Lower8 };
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) {
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (lower_buttons[n]);
for (auto & lb : lower_buttons) {
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (lb);
b->set_color (Push2::LED::DarkGray);
b->set_state (Push2::LED::OneShot24th);
_p2.write (b->state_msg());
}
Push2::ButtonID scene_buttons[] = {
Push2::Fwd32ndT, Push2::Fwd32nd, Push2::Fwd16th, Push2::Fwd16thT,
Push2::Fwd8thT, Push2::Fwd8th, Push2::Fwd4trT, Push2::Fwd4tr
};
for (auto & sb : scene_buttons) {
boost::shared_ptr<Push2::Button> b = _p2.button_by_id (sb);
b->set_color (Push2::LED::Green);
b->set_state (Push2::LED::NoTransition);
_p2.write (b->state_msg());
}
show_state ();
Container::show ();
@@ -165,32 +179,64 @@ CueLayout::button_lower (uint32_t n)
void
CueLayout::button_left ()
{
if (left_edge_index > 0) {
left_edge_index--;
if (track_base > 0) {
track_base--;
show_state ();
}
}
void
CueLayout::button_page_left ()
{
if (track_base > 8) {
track_base -= 8; /* XXX get back to zero when appropriate */
show_state ();
}
show_state ();
}
void
CueLayout::button_right ()
{
left_edge_index++;
track_base++;
show_state ();
}
void
CueLayout::button_page_right ()
{
track_base += 8; /* XXX limit to number of tracks */
show_state ();
}
void
CueLayout::button_up ()
{
if (top_edge_index > 0) {
top_edge_index--;
if (scene_base > 0) {
scene_base--;
show_state ();
}
}
void
CueLayout::button_octave_up ()
{
if (scene_base > 8) {
scene_base -= 8;
show_state ();
}
show_state ();
}
void
CueLayout::button_down ()
{
top_edge_index++;
scene_base++;
show_state ();
}
void
CueLayout::button_octave_down ()
{
scene_base++;
show_state ();
}
@@ -200,6 +246,12 @@ CueLayout::show_state ()
if (!parent()) {
return;
}
for (auto & t : _upper_text) {
}
for (auto & t : _lower_text) {
}
}
void
@@ -213,7 +265,16 @@ CueLayout::strip_vpot_touch (int n, bool touching)
}
void
CueLayout::update_meters ()
CueLayout::button_rhs (int row)
{
std::cerr << "Scene " << row + scene_base << std::endl;
_p2.get_session().cue_bang (row + scene_base);
}
void
CueLayout::button_stop_press ()
{
if (_p2.modifier_state() == Push2::ModShift) {
_p2.get_session().stop_all_triggers (false); /* quantized global stop */
}
}

View File

@@ -57,22 +57,24 @@ class CueLayout : public Push2Layout
void button_right ();
void button_up();
void button_down ();
void button_rhs (int);
void button_octave_up();
void button_octave_down();
void button_page_left();
void button_page_right();
void button_stop_press ();
void strip_vpot (int, int);
void strip_vpot_touch (int, bool);
void update_meters ();
void update_clocks ();
private:
ArdourCanvas::Rectangle* _bg;
ArdourCanvas::Line* _upper_line;
std::vector<ArdourCanvas::Text*> _upper_text;
std::vector<ArdourCanvas::Text*> _lower_text;
uint8_t _selection_color;
uint32_t left_edge_index;
uint32_t top_edge_index;
uint32_t track_base;
uint32_t scene_base;
Push2Knob* _knobs[8];

View File

@@ -56,6 +56,14 @@ class Push2Layout : public sigc::trackable, public ArdourCanvas::Container
virtual void button_select_release () {}
virtual void button_solo () {}
virtual void button_mute () {}
virtual void button_rhs (int) {} /* scene/notelength buttons aka Right Hand Side */
virtual void button_octave_up() {}
virtual void button_octave_down() {}
virtual void button_page_left() {}
virtual void button_page_right() {}
virtual void button_stop_press () {}
virtual void button_stop_release () {}
virtual void button_stop_long_press () {}
virtual void strip_vpot (int, int) = 0;
virtual void strip_vpot_touch (int, bool) = 0;

View File

@@ -118,6 +118,7 @@ Push2::Push2 (ARDOUR::Session& s)
, _selection_color (LED::Green)
, _contrast_color (LED::Green)
, _in_range_select (false)
, _stop_down (false)
{
/* we're going to need this */
@@ -406,7 +407,8 @@ Push2::init_buttons (bool startup)
ButtonID buttons[] = { Mute, Solo, Master, Up, Right, Left, Down, Note, Session, Mix, AddTrack, Delete, Undo,
Metronome, Shift, Select, Play, RecordEnable, Automate, Repeat, Note, Session,
Quantize, Duplicate, Browse, PageRight, PageLeft, OctaveUp, OctaveDown, Layout, Scale
Quantize, Duplicate, Browse, PageRight, PageLeft, OctaveUp, OctaveDown, Layout, Scale,
Stop
};
for (size_t n = 0; n < sizeof (buttons) / sizeof (buttons[0]); ++n) {
@@ -425,7 +427,7 @@ Push2::init_buttons (bool startup)
/* all other buttons are off (black) */
ButtonID off_buttons[] = { TapTempo, Setup, User, Stop, Convert, New, FixedLength,
ButtonID off_buttons[] = { TapTempo, Setup, User, Convert, New, FixedLength, Clip,
Fwd32ndT, Fwd32nd, Fwd16thT, Fwd16th, Fwd8thT, Fwd8th, Fwd4trT, Fwd4tr,
Accent, Note };

View File

@@ -449,6 +449,10 @@ class Push2 : public ARDOUR::ControlProtocol
libusb_device_handle* usb_handle() const { return _handle; }
ARDOUR::Session & get_session() { return *session; }
bool stop_down () const { return _stop_down; }
CONTROL_PROTOCOL_THREADS_NEED_TEMPO_MAP_DECL();
private:
@@ -558,7 +562,9 @@ class Push2 : public ARDOUR::ControlProtocol
void button_fwd4t ();
void button_fwd4 ();
void button_add_track ();
void button_stop ();
void button_stop_press();
void button_stop_release ();
void button_stop_long_press ();
void button_master ();
void button_quantize ();
void button_duplicate ();
@@ -689,6 +695,7 @@ class Push2 : public ARDOUR::ControlProtocol
uint8_t _contrast_color;
bool _in_range_select;
bool _stop_down;
};
} /* namespace */