mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-15 18:06:06 +01:00
quantize speed changes in semitone mode to whole semitones, range is 2 octaves
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4882 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3c62351159
commit
e79f953efd
1 changed files with 27 additions and 7 deletions
|
|
@ -370,6 +370,7 @@ ARDOUR_UI::setup_transport ()
|
|||
|
||||
speed_display_box.add (speed_display_label);
|
||||
speed_display_box.set_name (X_("ShuttleDisplay"));
|
||||
set_size_request_to_display_given_text (speed_display_label, X_("> 24.0"), 2, 2);
|
||||
|
||||
shuttle_units_button.set_name (X_("ShuttleButton"));
|
||||
shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked));
|
||||
|
|
@ -772,15 +773,33 @@ ARDOUR_UI::use_shuttle_fract (bool force)
|
|||
|
||||
last_shuttle_request = now;
|
||||
|
||||
bool neg = (shuttle_fract < 0.0);
|
||||
if (Config->get_shuttle_units() == Semitones) {
|
||||
|
||||
double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
|
||||
const double step = 1.0 / 24.0; // range is 24 semitones up & down
|
||||
double semitones;
|
||||
double speed;
|
||||
|
||||
if (neg) {
|
||||
fract = -fract;
|
||||
semitones = round (shuttle_fract / step);
|
||||
speed = pow (2.0, (semitones / 12.0));
|
||||
|
||||
session->request_transport_speed (speed);
|
||||
|
||||
} else {
|
||||
|
||||
bool neg;
|
||||
double fract;
|
||||
|
||||
neg = (shuttle_fract < 0.0);
|
||||
|
||||
fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
|
||||
|
||||
if (neg) {
|
||||
fract = -fract;
|
||||
}
|
||||
|
||||
session->request_transport_speed (shuttle_max_speed * fract);
|
||||
}
|
||||
|
||||
session->request_transport_speed (shuttle_max_speed * fract); // Formula A2
|
||||
shuttle_box.queue_draw ();
|
||||
}
|
||||
|
||||
|
|
@ -851,10 +870,11 @@ ARDOUR_UI::update_speed_display ()
|
|||
if (Config->get_shuttle_units() == Percentage) {
|
||||
snprintf (buf, sizeof (buf), "%.2f", x);
|
||||
} else {
|
||||
|
||||
if (x < 0) {
|
||||
snprintf (buf, sizeof (buf), "< %.1f", 12.0 * fast_log2 (-x));
|
||||
snprintf (buf, sizeof (buf), "< %d", (int) round (12.0 * fast_log2 (-x)));
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "> %.1f", 12.0 * fast_log2 (x));
|
||||
snprintf (buf, sizeof (buf), "> %d", (int) round (12.0 * fast_log2 (x)));
|
||||
}
|
||||
}
|
||||
speed_display_label.set_text (buf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue