13
0

surfaces transport hotfix: surfaces should query the transport state via BasicUI, when possible

This commit is contained in:
Ben Loftis 2020-02-23 08:49:40 -06:00
parent 276baee8ad
commit 3e77680a57
15 changed files with 35 additions and 40 deletions

View File

@ -669,7 +669,7 @@ CC121::map_transport_state ()
{
get_button (Loop).set_led_state (_output_port, session->get_play_loop());
float ts = session->transport_speed();
float ts = get_transport_speed();
if (ts == 0) {
stop_blinking (Play);

View File

@ -627,7 +627,7 @@ ContourDesignControlProtocol::shuttle_event (int position)
if (position != 0) {
if (_shuttle_was_zero) {
_was_rolling_before_shuttle = session->transport_rolling ();
_was_rolling_before_shuttle = transport_rolling ();
}
const vector<double>& spds = _shuttle_speeds;
const double speed = position > 0 ? spds[position-1] : -spds[-position-1];

View File

@ -685,7 +685,7 @@ FaderPort::map_transport_state ()
{
get_button (Loop).set_led_state (_output_port, session->get_play_loop());
float ts = session->transport_speed();
float ts = get_transport_speed();
if (ts == 0) {
stop_blinking (Play);

View File

@ -135,8 +135,8 @@ FaderPort8::setup_actions ()
void
FaderPort8::button_play ()
{
if (session->transport_rolling ()) {
if (session->transport_speed () != 1.0) {
if (transport_rolling ()) {
if (get_transport_speed() != 1.0) {
session->request_transport_speed (1.0);
} else {
transport_stop ();
@ -149,7 +149,7 @@ FaderPort8::button_play ()
void
FaderPort8::button_stop ()
{
if (session->transport_rolling ()) {
if (transport_rolling ()) {
transport_stop ();
} else {
AccessAction ("Transport", "GotoStart");
@ -315,20 +315,20 @@ FaderPort8::button_varispeed (bool ffw)
// switch play direction, if needed
if (ffw) {
if (session->transport_speed () <= 0) {
if (get_transport_speed() <= 0) {
session->request_transport_speed (1.0);
return ;
}
} else {
if (session->transport_speed () >= 0) {
if (get_transport_speed() >= 0) {
session->request_transport_speed (-1.0);
return ;
}
}
// incremetally increase speed. double speed every 10 clicks
// incrementally increase speed by semitones
// (keypress auto-repeat is 100ms)
float maxspeed = Config->get_shuttle_max_speed();
float speed = exp2f(0.1f) * session->transport_speed ();
float speed = exp2f(1.0/12.0) * get_transport_speed();
speed = std::max (-maxspeed, std::min (maxspeed, speed));
session->request_transport_speed (speed, false);
}

View File

@ -125,16 +125,11 @@ FaderPort8::notify_parameter_changed (std::string param)
void
FaderPort8::notify_transport_state_changed ()
{
if (session->transport_rolling ()) {
_ctrls.button (FP8Controls::BtnPlay).set_active (true);
_ctrls.button (FP8Controls::BtnStop).set_active (false);
} else {
_ctrls.button (FP8Controls::BtnPlay).set_active (false);
_ctrls.button (FP8Controls::BtnStop).set_active (true);
}
_ctrls.button (FP8Controls::BtnPlay).set_active (get_transport_speed()==1.0);
_ctrls.button (FP8Controls::BtnStop).set_active (get_transport_speed()==0.0);
/* set rewind/fastforward lights */
const float ts = session->transport_speed ();
const float ts = get_transport_speed();
FP8ButtonInterface& b_rew = _ctrls.button (FP8Controls::BtnRewind);
FP8ButtonInterface& b_ffw = _ctrls.button (FP8Controls::BtnFastForward);

View File

@ -1706,16 +1706,16 @@ void
TranzportControlProtocol::shuttle ()
{
if (_datawheel < WheelDirectionThreshold) {
if (session->transport_speed() < 0) {
if (get_transport_speed() < 0) {
session->request_transport_speed (1.0);
} else {
session->request_transport_speed_nonzero (session->transport_speed() + 0.1);
session->request_transport_speed_nonzero (get_transport_speed() + 0.1);
}
} else {
if (session->transport_speed() > 0) {
if (get_transport_speed() > 0) {
session->request_transport_speed (-1.0);
} else {
session->request_transport_speed_nonzero (session->transport_speed() - 0.1);
session->request_transport_speed_nonzero (get_transport_speed() - 0.1);
}
}
}

View File

@ -511,7 +511,7 @@ MackieControlProtocol::play_press (Button &)
again, jump back to where we started last time
*/
transport_play (session->transport_speed() == 1.0);
transport_play (get_transport_speed() == 1.0);
return none;
}
@ -823,7 +823,7 @@ MackieControlProtocol::cancel_release (Button &)
LedState
MackieControlProtocol::user_a_press (Button &)
{
transport_play (session->transport_speed() == 1.0);
transport_play (get_transport_speed() == 1.0);
return off;
}
LedState

View File

@ -127,7 +127,7 @@ Maschine2::notify_record_state_changed ()
void
Maschine2::notify_transport_state_changed ()
{
if (session->transport_rolling ()) {
if (transport_rolling ()) {
_ctrl->button (M2Contols::Play)->set_color (COLOR_WHITE);
} else {
_ctrl->button (M2Contols::Play)->set_color (0);
@ -198,7 +198,7 @@ Maschine2::notify_history_changed ()
void
Maschine2::button_play ()
{
if (session->transport_rolling ()) {
if (transport_rolling ()) {
transport_stop ();
} else {
transport_play ();
@ -226,7 +226,7 @@ Maschine2::button_metronom ()
void
Maschine2::button_rewind ()
{
goto_start (session->transport_rolling ());
goto_start (transport_rolling ());
}
void

View File

@ -3182,7 +3182,7 @@ OSC::transport_speed (lo_message msg)
return;
}
check_surface (msg);
double ts = session->transport_speed ();
double ts = get_transport_speed();
lo_message reply = lo_message_new ();
lo_message_add_double (reply, ts);

View File

@ -359,7 +359,7 @@ TranzportControlProtocol::button_event_footswitch_press (bool shifted)
void
TranzportControlProtocol::button_event_footswitch_release (bool shifted)
{
if(session->transport_speed() == 0.0)
if(get_transport_speed() == 0.0)
{
transport_play ();
}

View File

@ -120,7 +120,7 @@ void TranzportControlProtocol::show_mini_meter()
static uint32_t last_meter_fill_r = 0;
uint32_t meter_size;
float speed = fabsf(session->transport_speed());
float speed = fabsf(get_transport_speed());
char buf[meter_buf_size];
if (speed == 1.0) {
@ -301,7 +301,7 @@ TranzportControlProtocol::show_bbt (samplepos_t where)
last_ticks = bbt.ticks;
last_where = where;
float speed = fabsf(session->transport_speed());
float speed = fabsf(get_transport_speed());
if (speed == 1.0) {
sprintf (buf, "%03" PRIu32 "%1" PRIu32, bbt.bars,bbt.beats); // switch to hex one day

View File

@ -187,16 +187,16 @@ void
TranzportControlProtocol::shuttle ()
{
if (_datawheel < WheelDirectionThreshold) {
if (session->transport_speed() < 0) {
if (get_transport_speed() < 0) {
session->request_transport_speed (1.0);
} else {
session->request_transport_speed_nonzero (session->transport_speed() + 0.1);
session->request_transport_speed_nonzero (get_transport_speed() + 0.1);
}
} else {
if (session->transport_speed() > 0) {
if (session->get_transport_speed() > 0) {
session->request_transport_speed (-1.0);
} else {
session->request_transport_speed_nonzero (session->transport_speed() - 0.1);
session->request_transport_speed_nonzero (get_transport_speed() - 0.1);
}
}
}

View File

@ -95,11 +95,11 @@ TranzportControlProtocol::show_wheel_mode ()
{
string text;
// if(session->transport_speed() != 0) {
// if(get_transport_speed() != 0) {
// if session-transport_speed() < 1.0) show_big_bar/beat
// if ? greater. dont
if(session->transport_speed() != 0) {
if(get_transport_speed() != 0) {
show_mini_meter();
} else {

View File

@ -497,7 +497,7 @@ US2400Protocol::play_press (Button &)
again, jump back to where we started last time
*/
transport_play (session->transport_speed() == 1.0);
transport_play (get_transport_speed() == 1.0);
return none;
}
@ -821,7 +821,7 @@ US2400Protocol::cancel_release (Button &)
LedState
US2400Protocol::user_a_press (Button &)
{
transport_play (session->transport_speed() == 1.0);
transport_play (get_transport_speed() == 1.0);
return off;
}
LedState

View File

@ -299,7 +299,7 @@ WiimoteControlProtocol::update_led_state ()
}
// enable LED1 if Ardour is playing
if (session->transport_rolling ()) {
if (transport_rolling ()) {
DEBUG_TRACE (DEBUG::WiimoteControl, "WiimoteControlProtocol::update_led_state playing, activate LED1\n");
state |= CWIID_LED1_ON;
}