13
0

fix behavior of ARDOUR_UI::transport_rewind/forward actions

This commit is contained in:
Paul Davis 2020-04-20 17:18:27 -06:00
parent 5d3554408d
commit 826bdc413c
2 changed files with 27 additions and 34 deletions

View File

@ -1971,57 +1971,49 @@ ARDOUR_UI::transport_rec_count_in ()
}
void
ARDOUR_UI::transport_rewind (int option)
{
float current_transport_speed;
if (_session) {
current_transport_speed = _session->transport_speed();
if (current_transport_speed >= 0.0f) {
switch (option) {
case 0:
_session->request_transport_speed (-1.0f);
break;
case 1:
_session->request_transport_speed (-4.0f);
break;
case -1:
_session->request_transport_speed (-0.5f);
break;
}
} else {
/* speed up */
_session->request_transport_speed (current_transport_speed * 1.5f);
}
}
}
void
ARDOUR_UI::transport_forward (int option)
ARDOUR_UI::transport_ffwd_rewind (int option, int dir)
{
if (!_session) {
return;
}
float current_transport_speed = _session->transport_speed();
/* engine speed is always positive, so multiply by transport
* (-1, 0, 1) to get directional value
*/
if (current_transport_speed <= 0.0f) {
const float current_transport_speed = _session->engine_speed () * _session->transport_speed();
float target_speed;
if ((dir < 0 && current_transport_speed >= 0.0f) || (dir > 0 && current_transport_speed <= 0.0f)) {
switch (option) {
case 0:
_session->request_transport_speed (1.0f);
target_speed = dir * 1.0f;
break;
case 1:
_session->request_transport_speed (4.0f);
target_speed = dir * 4.0f;
break;
case -1:
_session->request_transport_speed (0.5f);
target_speed = dir * 0.5f;
break;
}
} else {
/* speed up */
_session->request_transport_speed (current_transport_speed * 1.5f);
target_speed = current_transport_speed * 1.5f;
}
_session->request_transport_speed (target_speed);
}
void
ARDOUR_UI::transport_rewind (int option)
{
transport_ffwd_rewind (option, -1);
}
void
ARDOUR_UI::transport_forward (int option)
{
transport_ffwd_rewind (option, 1);
}
void

View File

@ -666,6 +666,7 @@ private:
void transport_rec_count_in();
void transport_forward (int option);
void transport_rewind (int option);
void transport_ffwd_rewind (int option, int dir);
void transport_loop ();
void toggle_roll (bool with_abort, bool roll_out_of_bounded_mode);
bool trx_record_enable_all_tracks ();