X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui2.cc;h=1b16c6a7617a45ef38300c2241b11d20974995bb;hb=ae6dbb836cc1ab1bcbc21883f282361c43f10883;hp=959d5fc128f1aee20f44bba0bd03b7a615df5517;hpb=997e4b1f9cd7ccfc704b7c035051da7f60d831e7;p=ardour.git diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 959d5fc128..1b16c6a761 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -25,17 +25,17 @@ #include #include -#include -#include -#include +#include "pbd/error.h" +#include "pbd/basename.h" +#include "pbd/fastlog.h" #include #include #include -#include -#include -#include -#include +#include "ardour/audioengine.h" +#include "ardour/ardour.h" +#include "ardour/profile.h" +#include "ardour/route.h" #include "ardour_ui.h" #include "keyboard.h" @@ -115,7 +115,7 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr"; } else { - text = "???"; + text = "???"; } text += prefix; @@ -192,6 +192,10 @@ ARDOUR_UI::setup_transport () 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"); @@ -367,16 +371,17 @@ 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)); - shuttle_style_button.set_name (X_("ShuttleButton")); + shuttle_style_button.set_name (X_("ShuttleStyleButton")); vector 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); @@ -386,8 +391,9 @@ ARDOUR_UI::setup_transport () 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); @@ -450,7 +456,7 @@ ARDOUR_UI::setup_transport () 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); @@ -658,7 +664,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev) 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); @@ -756,31 +762,45 @@ ARDOUR_UI::set_shuttle_fract (double f) 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 (); } @@ -851,10 +871,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); @@ -879,9 +900,7 @@ ARDOUR_UI::editor_realized () 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