#include <cmath>
#include <sigc++/bind.h>
-#include <pbd/error.h>
-#include <pbd/basename.h>
-#include <pbd/fastlog.h>
+#include "pbd/error.h"
+#include "pbd/basename.h"
+#include "pbd/fastlog.h"
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/tearoff.h>
-#include <ardour/audioengine.h>
-#include <ardour/ardour.h>
-#include <ardour/profile.h>
-#include <ardour/route.h>
+#include "ardour/audioengine.h"
+#include "ardour/ardour.h"
+#include "ardour/profile.h"
+#include "ardour/route.h"
#include "ardour_ui.h"
#include "keyboard.h"
} else if (strcmp (prefix, _("[INFO]: ")) == 0) {
text = "<span color=\"green\" weight=\"bold\">";
} else {
- text = "<span color=\"blue\" weight=\"bold\">???";
+ text = "<span color=\"white\" weight=\"bold\">???";
}
text += prefix;
transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
transport_tearoff->set_name ("TransportBase");
+ if (Profile->get_sae()) {
+ transport_tearoff->set_can_be_torn_off (false);
+ }
+
transport_hbox.pack_start (*transport_tearoff, true, false);
transport_base.set_name ("TransportBase");
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));
- shuttle_style_button.set_name (X_("ShuttleButton"));
+ shuttle_style_button.set_name (X_("ShuttleStyleButton"));
vector<string> shuttle_strings;
shuttle_strings.push_back (_("sprung"));
shuttle_strings.push_back (_("wheel"));
- set_popdown_strings (shuttle_style_button, shuttle_strings);
+ set_popdown_strings (shuttle_style_button, shuttle_strings, true);
shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed));
Frame* sdframe = manage (new Frame);
mtc_port_changed ();
sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
- const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
- set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 2+FUDGE, 10);
+ // XXX HOW TO USE set_popdown_strings() and combo_fudge with this when we don't know
+ // the real strings till later?
+ set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+COMBO_FUDGE, 10);
shbox->pack_start (*sdframe, false, false);
shbox->pack_start (shuttle_units_button, true, true);
transport_tearoff_hbox.pack_start (*toggle_box, false, false, 4);
transport_tearoff_hbox.pack_start (alert_box, false, false);
-
+
if (Profile->get_sae()) {
Image* img = manage (new Image ((::get_icon (X_("sae")))));
transport_tearoff_hbox.pack_end (*img, false, false, 6);
shuttle_grabbed = false;
shuttle_box.remove_modal_grab ();
if (Config->get_shuttle_behaviour() == Sprung) {
- if (Config->get_auto_play() || roll_button.get_visual_state()) {
+ if (session->config.get_auto_play() || roll_button.get_visual_state()) {
shuttle_fract = SHUTTLE_FRACT_SPEED1;
session->request_transport_speed (1.0);
stop_button.set_visual_state (0);
void
ARDOUR_UI::use_shuttle_fract (bool force)
{
- struct timeval now;
- struct timeval diff;
+ microseconds_t now = get_microseconds();
/* do not attempt to submit a motion-driven transport speed request
more than once per process cycle.
*/
- gettimeofday (&now, 0);
- timersub (&now, &last_shuttle_request, &diff);
-
- if (!force && (diff.tv_usec + (diff.tv_sec * 1000000)) < engine->usecs_per_cycle()) {
+ if (!force && (last_shuttle_request - now) < (microseconds_t) engine->usecs_per_cycle()) {
return;
}
last_shuttle_request = now;
- bool neg = (shuttle_fract < 0.0);
+ if (Config->get_shuttle_units() == Semitones) {
+
+ const double step = 1.0 / 24.0; // range is 24 semitones up & down
+ double semitones;
+ double speed;
+
+ semitones = round (shuttle_fract / step);
+ speed = pow (2.0, (semitones / 12.0));
- double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
+ session->request_transport_speed (speed);
- if (neg) {
- fract = -fract;
+ } 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 ();
}
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);
Config->map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed));
set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2);
- const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
- set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
- reset_dpi();
+ reset_dpi ();
}
void