13
0

faderport: generalized blink on/off code

This commit is contained in:
Paul Davis 2015-12-03 08:36:56 -05:00
parent 0a54d28454
commit 900f59dcde
2 changed files with 26 additions and 17 deletions

View File

@ -533,6 +533,20 @@ FaderPort::set_active (bool yn)
return 0;
}
void
FaderPort::stop_blinking (ButtonID id)
{
blinkers.remove (id);
get_button (id).set_led_state (_output_port, false);
}
void
FaderPort::start_blinking (ButtonID id)
{
blinkers.push_back (id);
get_button (id).set_led_state (_output_port, true);
}
bool
FaderPort::blink ()
{
@ -567,16 +581,13 @@ FaderPort::notify_record_state_changed ()
{
switch (session->record_status()) {
case Session::Disabled:
get_button (RecEnable).set_led_state (_output_port, false);
blinkers.remove (RecEnable);
stop_blinking (RecEnable);
break;
case Session::Enabled:
get_button (RecEnable).set_led_state (_output_port, true);
blinkers.push_back (RecEnable);
start_blinking (RecEnable);
break;
case Session::Recording:
get_button (RecEnable).set_led_state (_output_port, true);
blinkers.remove (RecEnable);
stop_blinking (RecEnable);
break;
}
}
@ -601,10 +612,9 @@ FaderPort::parameter_changed (string what)
get_button (Punch).set_led_state (_output_port, true);
blinkers.remove (Punch);
} else if (in || out) {
blinkers.push_back (Punch);
start_blinking (Punch);
} else {
blinkers.remove (Punch);
get_button (Punch).set_led_state (_output_port, false);
stop_blinking (Punch);
}
}
}
@ -1086,14 +1096,13 @@ FaderPort::map_cut ()
if (mp) {
bool yn = mp->cut_all ();
get_button (Mute).set_led_state (_output_port, yn);
if (yn) {
blinkers.push_back (Mute);
start_blinking (Mute);
} else {
blinkers.remove (Mute);
stop_blinking (Mute);
}
} else {
blinkers.remove (Mute);
stop_blinking (Mute);
}
}
@ -1180,11 +1189,9 @@ void
FaderPort::map_route_state ()
{
if (!_current_route) {
get_button (Mute).set_led_state (_output_port, false);
get_button (Solo).set_led_state (_output_port, false);
stop_blinking (Mute);
stop_blinking (Solo);
get_button (Rec).set_led_state (_output_port, false);
blinkers.remove (Mute);
blinkers.remove (Solo);
} else {
/* arguments to these map_*() methods are all ignored */
map_mute (0);

View File

@ -279,6 +279,8 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
Blinkers blinkers;
bool blink_state;
bool blink ();
void start_blinking (ButtonID);
void stop_blinking (ButtonID);
void set_current_route (boost::shared_ptr<ARDOUR::Route>);
void drop_current_route ();