Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Ben Loftis | f407180315 | |
Robin Gareus | 5ed5de931b |
|
@ -2013,13 +2013,13 @@ ARDOUR_UI::transport_ffwd_rewind (bool fwd)
|
|||
|
||||
if (fwd) {
|
||||
if (transport_speed <= 0) {
|
||||
_session->request_transport_speed (1.0, false);
|
||||
_session->request_transport_speed (1.0);
|
||||
_session->request_roll (TRS_UI);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (transport_speed >= 0) {
|
||||
_session->request_transport_speed (-1.0, false);
|
||||
_session->request_transport_speed (-1.0);
|
||||
_session->request_roll (TRS_UI);
|
||||
return;
|
||||
}
|
||||
|
@ -2034,12 +2034,12 @@ ARDOUR_UI::transport_ffwd_rewind (bool fwd)
|
|||
|
||||
if (fwd) {
|
||||
if (transport_speed <= 0) {
|
||||
_session->request_transport_speed (1.0, false);
|
||||
_session->request_transport_speed (1.0);
|
||||
_session->request_roll (TRS_UI);
|
||||
}
|
||||
} else {
|
||||
if (transport_speed >= 0) {
|
||||
_session->request_transport_speed (-1.0, false);
|
||||
_session->request_transport_speed (-1.0);
|
||||
_session->request_roll (TRS_UI);
|
||||
}
|
||||
}
|
||||
|
@ -2086,7 +2086,7 @@ ARDOUR_UI::transport_ffwd_rewind (bool fwd)
|
|||
|
||||
speed = semitone_ratio * transport_speed;
|
||||
speed = std::max (-maxspeed, std::min (maxspeed, speed));
|
||||
_session->request_transport_speed (speed, false);
|
||||
_session->request_transport_speed (speed);
|
||||
_session->request_roll (TRS_UI);
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#include "video_timeline.h"
|
||||
|
||||
#include "widgets/ardour_button.h"
|
||||
#include "widgets/ardour_dropdown.h"
|
||||
#include "widgets/ardour_spacer.h"
|
||||
|
||||
#include "add_route_dialog.h"
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/menuitem.h>
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
#include <gtkmm/settings.h>
|
||||
|
||||
|
@ -79,6 +82,7 @@ using namespace ArdourWidgets;
|
|||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
using namespace ARDOUR_UI_UTILS;
|
||||
using namespace Menu_Helpers;
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_tooltips ()
|
||||
|
@ -528,9 +532,9 @@ ARDOUR_UI::setup_transport ()
|
|||
ssbox->set_spacing (PX_SCALE(2));
|
||||
ssbox->pack_start (sync_button, false, false, 0);
|
||||
ssbox->pack_start (shuttle_box, true, true, 0);
|
||||
ssbox->pack_start (*shuttle_box.vari_button(), false, false, 0);
|
||||
ssbox->pack_start (*shuttle_box.info_button(), false, false, 0);
|
||||
|
||||
|
||||
/* and the main table layout */
|
||||
int vpadding = 1;
|
||||
int hpadding = 2;
|
||||
|
|
|
@ -2115,7 +2115,7 @@ Editor::scrub (samplepos_t sample, double current_x)
|
|||
if (scrubbing_direction == 0) {
|
||||
/* first move */
|
||||
_session->request_locate (sample, MustStop);
|
||||
_session->request_transport_speed (0.1, false);
|
||||
_session->request_transport_speed (0.1);
|
||||
scrubbing_direction = 1;
|
||||
|
||||
} else {
|
||||
|
@ -2139,7 +2139,7 @@ Editor::scrub (samplepos_t sample, double current_x)
|
|||
scrub_reverse_distance = 0;
|
||||
|
||||
delta = 0.01 * (last_scrub_x - current_x);
|
||||
_session->request_transport_speed_nonzero (_session->actual_speed() - delta, false);
|
||||
_session->request_transport_speed_nonzero (_session->actual_speed() - delta);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2158,7 +2158,7 @@ Editor::scrub (samplepos_t sample, double current_x)
|
|||
scrub_reverse_distance = 0;
|
||||
|
||||
delta = 0.01 * (current_x - last_scrub_x);
|
||||
_session->request_transport_speed_nonzero (_session->actual_speed() + delta, false);
|
||||
_session->request_transport_speed_nonzero (_session->actual_speed() + delta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2170,11 +2170,11 @@ Editor::scrub (samplepos_t sample, double current_x)
|
|||
|
||||
if (scrubbing_direction > 0) {
|
||||
/* was forwards, go backwards */
|
||||
_session->request_transport_speed (-0.1, false);
|
||||
_session->request_transport_speed (-0.1);
|
||||
scrubbing_direction = -1;
|
||||
} else {
|
||||
/* was backwards, go forwards */
|
||||
_session->request_transport_speed (0.1, false);
|
||||
_session->request_transport_speed (0.1);
|
||||
scrubbing_direction = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2673,7 +2673,7 @@ Editor::transition_to_rolling (bool fwd)
|
|||
return;
|
||||
}
|
||||
|
||||
_session->request_transport_speed (fwd ? 1.0f : -1.0f, false);
|
||||
_session->request_transport_speed (fwd ? _session->default_play_speed() : -_session->default_play_speed());
|
||||
_session->request_roll ();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include <algorithm>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/menuitem.h>
|
||||
|
||||
#include "pbd/string_convert.h"
|
||||
|
||||
#include "ardour/audioengine.h"
|
||||
|
@ -66,6 +69,8 @@ using namespace Gtkmm2ext;
|
|||
using namespace ArdourWidgets;
|
||||
using namespace Gtk;
|
||||
using namespace std;
|
||||
using namespace Menu_Helpers;
|
||||
|
||||
|
||||
#define PX_SCALE(px) std::max ((float)px, rintf ((float)px* UIConfiguration::instance ().get_ui_scale ()))
|
||||
|
||||
|
@ -231,6 +236,9 @@ RecorderUI::RecorderUI ()
|
|||
_button_table.attach (_btn_new_plist_rec, col, col + 2, 1, 2 , FILL, SHRINK, hpadding, vpadding);
|
||||
col += 2;
|
||||
|
||||
_button_table.attach (*(manage (new ArdourVSpacer ())), col, col + 1, 0, 2, FILL, FILL, spacepad, vpadding);
|
||||
col += 1;
|
||||
|
||||
_toolbar.pack_start (_button_table, false, false);
|
||||
_toolbar.pack_end (_btn_peak_reset, false, false, 4);
|
||||
_toolbar.pack_end (_remain_info_box, false, false, 4);
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include "input_port_monitor.h"
|
||||
#include "rec_info_box.h"
|
||||
#include "shuttle_control.h"
|
||||
#include "transport_control_ui.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include "actions.h"
|
||||
#include "rgb_macros.h"
|
||||
#include "shuttle_control.h"
|
||||
#include "timers.h"
|
||||
#include "transpose_dialog.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
|
@ -59,17 +61,90 @@ gboolean qt (gboolean, gint, gint, gboolean, Gtk::Tooltip*, gpointer)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ShuttleInfoButton::~ShuttleInfoButton ()
|
||||
{
|
||||
delete disp_context_menu;
|
||||
}
|
||||
|
||||
ShuttleInfoButton::ShuttleInfoButton ()
|
||||
{
|
||||
set_layout_font (UIConfiguration::instance().get_NormalFont());
|
||||
set_sizing_text (S_("LogestShuttle|+00 st"));
|
||||
set_tooltip (*this, _("Speed Display (Context-click for options)"));
|
||||
set_name ("shuttle text");
|
||||
set_visual_state (Gtkmm2ext::NoVisualState);
|
||||
set_elements (ArdourButton::Text);
|
||||
|
||||
Config->ParameterChanged.connect (parameter_connection, MISSING_INVALIDATOR, boost::bind (&ShuttleInfoButton::parameter_changed, this, _1), gui_context());
|
||||
|
||||
add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
|
||||
|
||||
disp_context_menu = 0;
|
||||
_ignore_change = false;
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleInfoButton::set_shuttle_units (ShuttleUnits s)
|
||||
{
|
||||
if (_ignore_change) {
|
||||
return;
|
||||
}
|
||||
Config->set_shuttle_units (s);
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleInfoButton::parameter_changed (std::string p)
|
||||
{
|
||||
/* units changed; recreate the menu when it is next opened to show the current selection*/
|
||||
if (p == "shuttle-units") {
|
||||
delete disp_context_menu;
|
||||
disp_context_menu = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ShuttleInfoButton::on_button_press_event (GdkEventButton* ev)
|
||||
{
|
||||
if (Keyboard::is_context_menu_event (ev)) {
|
||||
if (disp_context_menu == 0) {
|
||||
build_disp_context_menu ();
|
||||
}
|
||||
disp_context_menu->popup (ev->button, ev->time);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShuttleInfoButton::build_disp_context_menu ()
|
||||
{
|
||||
PBD::Unwinder<bool> uw (_ignore_change, true);
|
||||
|
||||
using namespace Menu_Helpers;
|
||||
|
||||
disp_context_menu = new Gtk::Menu();
|
||||
MenuList& items = disp_context_menu->items();
|
||||
|
||||
RadioMenuItem::Group units_group;
|
||||
|
||||
items.push_back (RadioMenuElem (units_group, _("Percent"), sigc::bind (sigc::mem_fun (*this, &ShuttleInfoButton::set_shuttle_units), Percentage)));
|
||||
if (Config->get_shuttle_units() == Percentage) {
|
||||
static_cast<RadioMenuItem*>(&items.back())->set_active();
|
||||
}
|
||||
items.push_back (RadioMenuElem (units_group, _("Semitones"), sigc::bind (sigc::mem_fun (*this, &ShuttleInfoButton::set_shuttle_units), Semitones)));
|
||||
if (Config->get_shuttle_units() == Semitones) {
|
||||
static_cast<RadioMenuItem*>(&items.back())->set_active();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ShuttleControl::ShuttleControl ()
|
||||
: _controllable (new ShuttleControllable (*this))
|
||||
, binding_proxy (_controllable)
|
||||
{
|
||||
_info_button.set_layout_font (UIConfiguration::instance().get_NormalFont());
|
||||
_info_button.set_sizing_text (S_("LogestShuttle|< +00 st"));
|
||||
_info_button.set_name ("shuttle text");
|
||||
_info_button.set_sensitive (false);
|
||||
_info_button.set_visual_state (Gtkmm2ext::NoVisualState);
|
||||
_info_button.set_elements (ArdourButton::Text);
|
||||
|
||||
set_tooltip (*this, _("Shuttle speed control (Context-click for options)"));
|
||||
|
||||
pattern = 0;
|
||||
|
@ -101,6 +176,14 @@ ShuttleControl::ShuttleControl ()
|
|||
|
||||
Config->ParameterChanged.connect (parameter_connection, MISSING_INVALIDATOR, boost::bind (&ShuttleControl::parameter_changed, this, _1), gui_context());
|
||||
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ShuttleControl::set_colors));
|
||||
Timers::blink_connect (sigc::mem_fun (*this, &ShuttleControl::do_blink));
|
||||
|
||||
set_tooltip (_vari_button, _("Varispeed: change the default playback and recording speed"));
|
||||
|
||||
// _vari_button.set_icon (ArdourIcon::RecButton);
|
||||
_vari_button.set_name ("vari button");
|
||||
_vari_button.set_text(_("Vari"));
|
||||
_vari_button.signal_clicked.connect (sigc::mem_fun (*this, &ShuttleControl::varispeed_button_clicked));
|
||||
|
||||
/* gtkmm 2.4: the C++ wrapper doesn't work */
|
||||
g_signal_connect ((GObject*) gobj(), "query-tooltip", G_CALLBACK (qt), NULL);
|
||||
|
@ -114,6 +197,32 @@ ShuttleControl::~ShuttleControl ()
|
|||
delete shuttle_context_menu;
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::varispeed_button_clicked ()
|
||||
{
|
||||
_vari_dialog.set_session(_session);
|
||||
if (_session->default_play_speed()==1.0) {
|
||||
_vari_dialog.show_all ();
|
||||
_vari_dialog.apply_speed ();
|
||||
} else {
|
||||
_session->set_default_play_speed(1.0);
|
||||
_vari_dialog.hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::do_blink (bool onoff)
|
||||
{
|
||||
if (!shuttle_grabbed && _session && _session->default_play_speed()!=1.0) {
|
||||
_info_button.set_active(onoff);
|
||||
_vari_button.set_active(onoff);
|
||||
} else {
|
||||
_info_button.set_active(false);
|
||||
_vari_button.set_active(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShuttleControl::set_session (Session *s)
|
||||
{
|
||||
|
@ -122,6 +231,7 @@ ShuttleControl::set_session (Session *s)
|
|||
if (_session) {
|
||||
set_sensitive (true);
|
||||
_session->add_controllable (_controllable);
|
||||
_info_button.set_session (s);
|
||||
} else {
|
||||
set_sensitive (false);
|
||||
}
|
||||
|
@ -158,14 +268,62 @@ ShuttleControl::on_size_allocate (Gtk::Allocation& alloc)
|
|||
void
|
||||
ShuttleControl::map_transport_state ()
|
||||
{
|
||||
float speed;
|
||||
float speed = 0.0;
|
||||
float actual_speed = 0.0;
|
||||
char buf[32];
|
||||
|
||||
if (!_session) {
|
||||
speed = 0.0;
|
||||
} else {
|
||||
if (_session) {
|
||||
speed = _session->actual_speed ();
|
||||
actual_speed = speed;
|
||||
if (shuttle_grabbed) {
|
||||
speed = requested_speed;
|
||||
} else if (_session->default_play_speed()!=1.0) {
|
||||
/*use has selected a varispeed AND the shuttle widget is not held ... show the varispeed*/
|
||||
actual_speed = _session->default_play_speed();
|
||||
}
|
||||
}
|
||||
|
||||
if (actual_speed != 0) {
|
||||
if (_session->default_play_speed()==1.0) {
|
||||
if (actual_speed == _session->default_play_speed()) {
|
||||
snprintf (buf, sizeof (buf), "%s", _("Play"));
|
||||
} else if (Config->get_shuttle_units() == Percentage) {
|
||||
{
|
||||
if (actual_speed < 0.0) {
|
||||
snprintf (buf, sizeof (buf), "< %.1f%%", -actual_speed * 100.f);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "> %.1f%%", actual_speed * 100.f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool reversed;
|
||||
int semi = speed_as_semitones (actual_speed, reversed);
|
||||
if (reversed) {
|
||||
snprintf (buf, sizeof (buf), _("< %+2d st"), semi);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), _("> %+2d st"), semi);
|
||||
}
|
||||
}
|
||||
} else { /*default_play_speed (varispeed) is always forward */
|
||||
if (Config->get_shuttle_units() == Percentage) {
|
||||
snprintf (buf, sizeof (buf), "%.1f%%", actual_speed * 100.f);
|
||||
} else {
|
||||
bool reversed;
|
||||
int semi = speed_as_semitones (actual_speed, reversed);
|
||||
if (abs(semi)<1) {
|
||||
int cents = speed_as_cents (actual_speed, reversed);
|
||||
snprintf (buf, sizeof (buf), _("%+2d c"), cents);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), _("%+2d st"), semi);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "%s", _("Stop"));
|
||||
}
|
||||
_info_button.set_text(buf);
|
||||
|
||||
|
||||
if ( (fabsf( speed - last_speed_displayed) < 0.005f) // dead-zone
|
||||
&& !( speed == 1.f && last_speed_displayed != 1.f)
|
||||
&& !( speed == 0.f && last_speed_displayed != 0.f)
|
||||
|
@ -201,36 +359,7 @@ ShuttleControl::build_shuttle_context_menu ()
|
|||
shuttle_context_menu = new Menu();
|
||||
MenuList& items = shuttle_context_menu->items();
|
||||
|
||||
Menu* units_menu = manage (new Menu);
|
||||
MenuList& units_items = units_menu->items();
|
||||
RadioMenuItem::Group units_group;
|
||||
|
||||
units_items.push_back (RadioMenuElem (units_group, _("Percent"), sigc::bind (sigc::mem_fun (*this, &ShuttleControl::set_shuttle_units), Percentage)));
|
||||
if (Config->get_shuttle_units() == Percentage) {
|
||||
static_cast<RadioMenuItem*>(&units_items.back())->set_active();
|
||||
}
|
||||
units_items.push_back (RadioMenuElem (units_group, _("Semitones"), sigc::bind (sigc::mem_fun (*this, &ShuttleControl::set_shuttle_units), Semitones)));
|
||||
if (Config->get_shuttle_units() == Semitones) {
|
||||
static_cast<RadioMenuItem*>(&units_items.back())->set_active();
|
||||
}
|
||||
items.push_back (MenuElem (_("Units"), *units_menu));
|
||||
|
||||
Menu* style_menu = manage (new Menu);
|
||||
MenuList& style_items = style_menu->items();
|
||||
RadioMenuItem::Group style_group;
|
||||
|
||||
style_items.push_back (RadioMenuElem (style_group, _("Sprung"), sigc::bind (sigc::mem_fun (*this, &ShuttleControl::set_shuttle_style), Sprung)));
|
||||
if (Config->get_shuttle_behaviour() == Sprung) {
|
||||
static_cast<RadioMenuItem*>(&style_items.back())->set_active();
|
||||
}
|
||||
style_items.push_back (RadioMenuElem (style_group, _("Wheel"), sigc::bind (sigc::mem_fun (*this, &ShuttleControl::set_shuttle_style), Wheel)));
|
||||
if (Config->get_shuttle_behaviour() == Wheel) {
|
||||
static_cast<RadioMenuItem*>(&style_items.back())->set_active();
|
||||
}
|
||||
|
||||
items.push_back (MenuElem (_("Mode"), *style_menu));
|
||||
|
||||
if (Config->get_shuttle_units() == Percentage) {
|
||||
{
|
||||
RadioMenuItem::Group speed_group;
|
||||
|
||||
/* XXX this code assumes that Config->get_max_transport_speed() returns 8 */
|
||||
|
@ -264,19 +393,6 @@ ShuttleControl::build_shuttle_context_menu ()
|
|||
|
||||
items.push_back (MenuElem (_("Maximum speed"), *speed_menu));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem ());
|
||||
items.push_back (MenuElem (_("Reset to 100%"), sigc::mem_fun (*this, &ShuttleControl::reset_speed)));
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::reset_speed ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
_session->reset_transport_speed ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -347,14 +463,10 @@ ShuttleControl::on_button_release_event (GdkEventButton* ev)
|
|||
remove_modal_grab ();
|
||||
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
||||
|
||||
if (Config->get_shuttle_behaviour() == Sprung) {
|
||||
if (shuttle_speed_on_grab == 0 ) {
|
||||
_session->request_stop ();
|
||||
} else {
|
||||
_session->request_transport_speed (shuttle_speed_on_grab);
|
||||
}
|
||||
if (shuttle_speed_on_grab == 0 ) {
|
||||
_session->request_stop ();
|
||||
} else {
|
||||
mouse_shuttle (ev->x, true);
|
||||
_session->request_transport_speed (shuttle_speed_on_grab);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -375,63 +487,6 @@ ShuttleControl::on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Toolti
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ShuttleControl::on_scroll_event (GdkEventScroll* ev)
|
||||
{
|
||||
if (!_session || Config->get_shuttle_behaviour() != Wheel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool semis = (Config->get_shuttle_units() == Semitones);
|
||||
|
||||
switch (ev->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
case GDK_SCROLL_RIGHT:
|
||||
if (semis) {
|
||||
if (shuttle_fract == 0) {
|
||||
shuttle_fract = semitones_as_fract (-24, false);
|
||||
} else {
|
||||
bool rev;
|
||||
int st = fract_as_semitones (shuttle_fract, rev);
|
||||
st += (rev ? -1 : 1);
|
||||
if (st < -24) {
|
||||
st = -24;
|
||||
rev = !rev;
|
||||
}
|
||||
shuttle_fract = semitones_as_fract (st, rev);
|
||||
}
|
||||
} else {
|
||||
shuttle_fract += 0.00125;
|
||||
}
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
case GDK_SCROLL_LEFT:
|
||||
if (semis) {
|
||||
if (shuttle_fract == 0) {
|
||||
shuttle_fract = semitones_as_fract (-24, true);
|
||||
} else {
|
||||
bool rev;
|
||||
int st = fract_as_semitones (shuttle_fract, rev);
|
||||
st += (rev ? 1 : -1);
|
||||
if (st < -24) {
|
||||
st = -24;
|
||||
rev = !rev;
|
||||
}
|
||||
shuttle_fract = semitones_as_fract (st, rev);
|
||||
}
|
||||
} else {
|
||||
shuttle_fract -= 0.00125;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
use_shuttle_fract (true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ShuttleControl::on_motion_notify_event (GdkEventMotion* ev)
|
||||
{
|
||||
|
@ -485,6 +540,30 @@ ShuttleControl::speed_as_semitones (float speed, bool& reverse)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
ShuttleControl::speed_as_cents (float speed, bool& reverse)
|
||||
{
|
||||
assert (speed != 0.0);
|
||||
|
||||
if (speed < 0.0) {
|
||||
reverse = true;
|
||||
return (int) ceilf (1200.0 * fast_log2 (-speed));
|
||||
} else {
|
||||
reverse = false;
|
||||
return (int) ceilf (1200.0 * fast_log2 (speed));
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
ShuttleControl::cents_as_speed (int cents, bool reverse)
|
||||
{
|
||||
if (reverse) {
|
||||
return -pow (2.0, (cents / 1200.0));
|
||||
} else {
|
||||
return pow (2.0, (cents / 1200.0));
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
ShuttleControl::semitones_as_speed (int semi, bool reverse)
|
||||
{
|
||||
|
@ -538,6 +617,7 @@ ShuttleControl::use_shuttle_fract (bool force, bool zero_ok)
|
|||
speed = 0.0;
|
||||
}
|
||||
} else {
|
||||
shuttle_fract = shuttle_fract*shuttle_fract*shuttle_fract; // ^3 preserves the sign;
|
||||
speed = shuttle_max_speed * shuttle_fract;
|
||||
}
|
||||
|
||||
|
@ -545,9 +625,9 @@ ShuttleControl::use_shuttle_fract (bool force, bool zero_ok)
|
|||
|
||||
if (_session) {
|
||||
if (zero_ok) {
|
||||
_session->request_transport_speed (speed, Config->get_shuttle_behaviour() == Wheel);
|
||||
_session->request_transport_speed (speed);
|
||||
} else {
|
||||
_session->request_transport_speed_nonzero (speed, Config->get_shuttle_behaviour() == Wheel);
|
||||
_session->request_transport_speed_nonzero (speed);
|
||||
}
|
||||
|
||||
if (speed != 0 && !_session->transport_state_rolling()) {
|
||||
|
@ -590,12 +670,8 @@ ShuttleControl::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangl
|
|||
cairo_stroke (cr);
|
||||
|
||||
float speed = 0.0;
|
||||
float actual_speed = 0.0;
|
||||
char buf[32];
|
||||
|
||||
if (_session) {
|
||||
speed = _session->actual_speed ();
|
||||
actual_speed = speed;
|
||||
if (shuttle_grabbed) {
|
||||
speed = requested_speed;
|
||||
}
|
||||
|
@ -623,34 +699,8 @@ ShuttleControl::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangl
|
|||
}
|
||||
cairo_fill(cr);
|
||||
|
||||
/* text */
|
||||
if (actual_speed != 0) {
|
||||
if (Config->get_shuttle_units() == Percentage) {
|
||||
if (actual_speed == 1.0) {
|
||||
snprintf (buf, sizeof (buf), "%s", _("Play"));
|
||||
} else {
|
||||
if (actual_speed < 0.0) {
|
||||
snprintf (buf, sizeof (buf), "< %.1f%%", -actual_speed * 100.f);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "> %.1f%%", actual_speed * 100.f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool reversed;
|
||||
int semi = speed_as_semitones (actual_speed, reversed);
|
||||
if (reversed) {
|
||||
snprintf (buf, sizeof (buf), _("< %+2d st"), semi);
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), _("> %+2d st"), semi);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
snprintf (buf, sizeof (buf), "%s", _("Stop"));
|
||||
}
|
||||
|
||||
last_speed_displayed = actual_speed;
|
||||
|
||||
_info_button.set_text (buf);
|
||||
last_speed_displayed = speed;
|
||||
|
||||
#if 0
|
||||
if (UIConfiguration::instance().get_widget_prelight()) {
|
||||
|
@ -663,24 +713,6 @@ ShuttleControl::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangl
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::set_shuttle_style (ShuttleBehaviour s)
|
||||
{
|
||||
if (_ignore_change) {
|
||||
return;
|
||||
}
|
||||
Config->set_shuttle_behaviour (s);
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::set_shuttle_units (ShuttleUnits s)
|
||||
{
|
||||
if (_ignore_change) {
|
||||
return;
|
||||
}
|
||||
Config->set_shuttle_units (s);
|
||||
}
|
||||
|
||||
ShuttleControl::ShuttleControllable::ShuttleControllable (ShuttleControl& s)
|
||||
: PBD::Controllable (X_("Shuttle"))
|
||||
, sc (s)
|
||||
|
@ -702,44 +734,15 @@ ShuttleControl::ShuttleControllable::get_value () const
|
|||
void
|
||||
ShuttleControl::parameter_changed (std::string p)
|
||||
{
|
||||
if (p == "shuttle-behaviour") {
|
||||
switch (Config->get_shuttle_behaviour ()) {
|
||||
case Sprung:
|
||||
/* back to Sprung - reset to speed = 1.0 if playing
|
||||
*/
|
||||
if (_session) {
|
||||
if (_session->transport_rolling()) {
|
||||
if (_session->actual_speed() == 1.0) {
|
||||
queue_draw ();
|
||||
} else {
|
||||
/* reset current speed and
|
||||
revert to 1.0 as the default
|
||||
*/
|
||||
_session->reset_transport_speed ();
|
||||
/* redraw when speed changes */
|
||||
}
|
||||
} else {
|
||||
queue_draw ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Wheel:
|
||||
queue_draw ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (p == "shuttle-units") {
|
||||
map_transport_state ();
|
||||
} else if (p == "shuttle-max-speed") {
|
||||
shuttle_max_speed = Config->get_shuttle_max_speed ();
|
||||
last_speed_displayed = -99999999;
|
||||
map_transport_state ();
|
||||
use_shuttle_fract (true);
|
||||
} else if (p == "shuttle-units") {
|
||||
last_speed_displayed = -99999999;
|
||||
map_transport_state ();
|
||||
use_shuttle_fract (true);
|
||||
delete shuttle_context_menu;
|
||||
shuttle_context_menu = 0;
|
||||
shuttle_context_menu=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,31 @@
|
|||
#include "widgets/ardour_button.h"
|
||||
#include "widgets/binding_proxy.h"
|
||||
|
||||
#include "transpose_dialog.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Menu;
|
||||
}
|
||||
|
||||
class ShuttleInfoButton : public ArdourWidgets::ArdourButton, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
ShuttleInfoButton ();
|
||||
~ShuttleInfoButton ();
|
||||
|
||||
bool on_button_press_event (GdkEventButton*);
|
||||
|
||||
void set_shuttle_units (ARDOUR::ShuttleUnits s);
|
||||
|
||||
private:
|
||||
void parameter_changed (std::string);
|
||||
void build_disp_context_menu ();
|
||||
Gtk::Menu* disp_context_menu;
|
||||
PBD::ScopedConnection parameter_connection;
|
||||
|
||||
bool _ignore_change;
|
||||
};
|
||||
|
||||
class ShuttleControl : public CairoWidget, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
|
@ -47,6 +68,8 @@ public:
|
|||
double get_shuttle_fract () const { return shuttle_fract; }
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
void do_blink (bool);
|
||||
|
||||
struct ShuttleControllable : public PBD::Controllable {
|
||||
ShuttleControllable (ShuttleControl&);
|
||||
void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
|
||||
|
@ -62,6 +85,18 @@ public:
|
|||
void set_colors ();
|
||||
|
||||
ArdourWidgets::ArdourButton* info_button () { return &_info_button; }
|
||||
ArdourWidgets::ArdourButton* vari_button () { return &_vari_button; }
|
||||
|
||||
public:
|
||||
static int speed_as_semitones (float, bool&);
|
||||
static int fract_as_semitones (float, bool&);
|
||||
|
||||
static float semitones_as_speed (int, bool);
|
||||
static float semitones_as_fract (int, bool);
|
||||
|
||||
static int speed_as_cents (float, bool&);
|
||||
static float cents_as_speed (int, bool);
|
||||
|
||||
|
||||
protected:
|
||||
bool _hovering;
|
||||
|
@ -76,22 +111,25 @@ protected:
|
|||
cairo_pattern_t* shine_pattern;
|
||||
ARDOUR::microseconds_t last_shuttle_request;
|
||||
PBD::ScopedConnection parameter_connection;
|
||||
ArdourWidgets::ArdourButton _info_button;
|
||||
ShuttleInfoButton _info_button;
|
||||
Gtk::Menu* shuttle_context_menu;
|
||||
ArdourWidgets::BindingProxy binding_proxy;
|
||||
float bg_r, bg_g, bg_b;
|
||||
void build_shuttle_context_menu ();
|
||||
void shuttle_style_changed();
|
||||
void set_shuttle_max_speed (float);
|
||||
void reset_speed ();
|
||||
|
||||
VarispeedDialog _vari_dialog;
|
||||
ArdourWidgets::ArdourButton _vari_button;
|
||||
void varispeed_button_clicked ();
|
||||
|
||||
bool on_enter_notify_event (GdkEventCrossing*);
|
||||
bool on_leave_notify_event (GdkEventCrossing*);
|
||||
bool on_button_press_event (GdkEventButton*);
|
||||
bool on_button_release_event(GdkEventButton*);
|
||||
bool on_scroll_event (GdkEventScroll*);
|
||||
bool on_motion_notify_event(GdkEventMotion*);
|
||||
|
||||
bool on_button_press_event_for_display (GdkEventButton*);
|
||||
|
||||
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
||||
|
||||
void on_size_allocate (Gtk::Allocation&);
|
||||
|
@ -102,13 +140,6 @@ protected:
|
|||
void parameter_changed (std::string);
|
||||
|
||||
void set_shuttle_units (ARDOUR::ShuttleUnits);
|
||||
void set_shuttle_style (ARDOUR::ShuttleBehaviour);
|
||||
|
||||
int speed_as_semitones (float, bool&);
|
||||
int fract_as_semitones (float, bool&);
|
||||
|
||||
float semitones_as_speed (int, bool);
|
||||
float semitones_as_fract (int, bool);
|
||||
|
||||
bool _ignore_change;
|
||||
};
|
||||
|
|
|
@ -385,7 +385,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -386,7 +386,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -386,7 +386,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -386,7 +386,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -386,7 +386,9 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="vari button: fill" alias="widget:bg"/>
|
||||
<ColorAlias name="vari button: fill active" alias="alert:ruddy"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -386,7 +386,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foreground2"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -385,7 +385,8 @@
|
|||
<ColorAlias name="send pan" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="shuttle" alias="widget:bg"/>
|
||||
<ColorAlias name="shuttle bg" alias="neutral:backgroundest"/>
|
||||
<ColorAlias name="shuttle text" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill" alias="neutral:foregroundest"/>
|
||||
<ColorAlias name="shuttle text: fill active" alias="alert:red"/>
|
||||
<ColorAlias name="silence" alias="theme:contrasting alt"/>
|
||||
<ColorAlias name="silence text" alias="neutral:foreground"/>
|
||||
<ColorAlias name="solo button: fill" alias="widget:bg"/>
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "transpose_dialog.h"
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#include <ardour/session.h>
|
||||
|
||||
using namespace Gtk;
|
||||
|
||||
TransposeDialog::TransposeDialog ()
|
||||
|
@ -60,3 +62,78 @@ TransposeDialog::semitones () const
|
|||
{
|
||||
return _octaves_spinner.get_value () * 12 + _semitones_spinner.get_value ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
VarispeedDialog::VarispeedDialog ()
|
||||
: ArdourDialog (_("Varispeed"))
|
||||
, _octaves_adjustment (0.0, -4.0, 4.0, 1, 2.0)
|
||||
, _semitones_adjustment (0.0, -12.0, 12.0, 1.0, 4.0)
|
||||
, _cents_adjustment (0.0, -100.0, 100.0, 1.0, 10.0)
|
||||
, _octaves_spinner (_octaves_adjustment)
|
||||
, _semitones_spinner (_semitones_adjustment)
|
||||
, _cents_spinner (_cents_adjustment)
|
||||
{
|
||||
set_modal(false);
|
||||
|
||||
Table* t = manage (new Table (3, 2));
|
||||
t->set_row_spacings (6);
|
||||
t->set_col_spacings (6);
|
||||
|
||||
int r = 0;
|
||||
Label* l = manage (new Label (_("Octaves:"), ALIGN_LEFT, ALIGN_CENTER, false));
|
||||
t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
|
||||
t->attach (_octaves_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
|
||||
++r;
|
||||
|
||||
l = manage (new Label (_("Semitones:"), ALIGN_LEFT, ALIGN_CENTER, false));
|
||||
t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
|
||||
t->attach (_semitones_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
|
||||
++r;
|
||||
|
||||
l = manage (new Label (_("Cents:"), ALIGN_LEFT, ALIGN_CENTER, false));
|
||||
t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
|
||||
t->attach (_cents_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
|
||||
++r;
|
||||
|
||||
get_vbox()->set_spacing (6);
|
||||
get_vbox()->pack_start (*t, false, false);
|
||||
|
||||
// add_button (Stock::CANCEL, RESPONSE_CANCEL);
|
||||
// add_button (_("Transpose"), RESPONSE_ACCEPT);
|
||||
|
||||
_octaves_spinner.signal_changed().connect (sigc::mem_fun (*this, &VarispeedDialog::apply_speed));
|
||||
_semitones_spinner.signal_changed().connect (sigc::mem_fun (*this, &VarispeedDialog::apply_speed));
|
||||
_cents_spinner.signal_changed().connect (sigc::mem_fun (*this, &VarispeedDialog::apply_speed));
|
||||
|
||||
show_all_children ();
|
||||
}
|
||||
|
||||
void
|
||||
VarispeedDialog::reset ()
|
||||
{
|
||||
_octaves_spinner.set_value(0);
|
||||
_semitones_spinner.set_value(0);
|
||||
_cents_spinner.set_value(0);
|
||||
}
|
||||
|
||||
void
|
||||
VarispeedDialog::apply_speed ()
|
||||
{
|
||||
int cents = _octaves_spinner.get_value () * 12 * 100 + _semitones_spinner.get_value () * 100 + _cents_spinner.get_value ();
|
||||
|
||||
double speed = pow (2.0, ((double)cents / (double)1200.0));
|
||||
|
||||
if (_session) {
|
||||
_session->set_default_play_speed(speed);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VarispeedDialog::on_hide ()
|
||||
{
|
||||
_session->set_default_play_speed(1.0);
|
||||
ArdourDialog::on_hide();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,14 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __ardour_transpose_dialog_h__
|
||||
#define __ardour_transpose_dialog_h__
|
||||
|
||||
#include <gtkmm/spinbutton.h>
|
||||
#include "ardour_dialog.h"
|
||||
|
||||
|
||||
|
||||
/** A dialog box to select a transposition to apply to a MIDI region.
|
||||
* It asks for octaves and semitones, with the transposition being
|
||||
* the sum of the two.
|
||||
|
@ -37,3 +42,28 @@ private:
|
|||
Gtk::SpinButton _octaves_spinner;
|
||||
Gtk::SpinButton _semitones_spinner;
|
||||
};
|
||||
|
||||
|
||||
/** A dialog box to select a speed change for "varispeed" recording/playback.
|
||||
* It asks for octaves, semitones, and cents, and sums them to report 'speed'
|
||||
*/
|
||||
|
||||
class VarispeedDialog : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
VarispeedDialog ();
|
||||
|
||||
void reset ();
|
||||
void apply_speed ();
|
||||
void on_hide ();
|
||||
|
||||
private:
|
||||
Gtk::Adjustment _octaves_adjustment;
|
||||
Gtk::Adjustment _semitones_adjustment;
|
||||
Gtk::Adjustment _cents_adjustment;
|
||||
Gtk::SpinButton _octaves_spinner;
|
||||
Gtk::SpinButton _semitones_spinner;
|
||||
Gtk::SpinButton _cents_spinner;
|
||||
};
|
||||
|
||||
#endif /* __ardour_transpose_dialog_h__ */
|
||||
|
|
|
@ -174,7 +174,6 @@ CONFIG_VARIABLE (samplecnt_t, preroll, "preroll", 0)
|
|||
CONFIG_VARIABLE (samplecnt_t, postroll, "postroll", 0)
|
||||
CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle
|
||||
CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle
|
||||
CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Wheel)
|
||||
CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage)
|
||||
CONFIG_VARIABLE (float, shuttle_max_speed, "shuttle-max-speed", 8.0f)
|
||||
CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-sync", false)
|
||||
|
|
|
@ -479,9 +479,12 @@ public:
|
|||
void use_rf_shuttle_speed ();
|
||||
void allow_auto_play (bool yn);
|
||||
|
||||
double default_play_speed ();
|
||||
void set_default_play_speed (double spd, TransportRequestSource origin = TRS_UI);
|
||||
void reset_transport_speed (TransportRequestSource origin = TRS_UI);
|
||||
void request_transport_speed (double speed, bool as_default = true, TransportRequestSource origin = TRS_UI);
|
||||
void request_transport_speed_nonzero (double, bool as_default = true, TransportRequestSource origin = TRS_UI);
|
||||
|
||||
void request_transport_speed (double speed, TransportRequestSource origin = TRS_UI);
|
||||
void request_transport_speed_nonzero (double, TransportRequestSource origin = TRS_UI);
|
||||
void request_overwrite_buffer (boost::shared_ptr<Track>, OverwriteReason);
|
||||
void adjust_playback_buffering();
|
||||
void adjust_capture_buffering();
|
||||
|
@ -1390,10 +1393,6 @@ private:
|
|||
|
||||
// varispeed playback -- TODO: move out of session to backend.
|
||||
double _engine_speed;
|
||||
double _default_transport_speed;
|
||||
double _default_engine_speed;
|
||||
double _last_transport_speed;
|
||||
double _requested_transport_speed;
|
||||
double _signalled_varispeed;
|
||||
|
||||
bool auto_play_legal;
|
||||
|
|
|
@ -54,7 +54,6 @@ struct TransportFSM
|
|||
bool force;
|
||||
/* for SetSpeed */
|
||||
double speed;
|
||||
bool as_default;
|
||||
|
||||
Event (EventType t)
|
||||
: type (t)
|
||||
|
@ -95,10 +94,9 @@ struct TransportFSM
|
|||
cast double-to-bool and complains. C++11 would allow "=
|
||||
delete" as an alternate fix, but this is fine.
|
||||
*/
|
||||
Event (double sp, bool ad)
|
||||
Event (double sp)
|
||||
: type (SetSpeed)
|
||||
, speed (sp)
|
||||
, as_default (ad)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -147,7 +145,9 @@ struct TransportFSM
|
|||
std::string current_state () const;
|
||||
|
||||
double transport_speed() const { return _transport_speed; }
|
||||
|
||||
double default_speed() const { return _default_speed; }
|
||||
void set_default_speed(double spd) const { _default_speed = spd; }
|
||||
|
||||
private:
|
||||
MotionState _motion_state;
|
||||
|
|
|
@ -626,11 +626,6 @@ enum TransportRequestType {
|
|||
TR_Locate = 0x4
|
||||
};
|
||||
|
||||
enum ShuttleBehaviour {
|
||||
Sprung,
|
||||
Wheel
|
||||
};
|
||||
|
||||
enum ShuttleUnits {
|
||||
Percentage,
|
||||
Semitones
|
||||
|
|
|
@ -48,7 +48,6 @@ DEFINE_ENUM_CONVERT(ARDOUR::ListenPosition)
|
|||
DEFINE_ENUM_CONVERT(ARDOUR::LayerModel)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::InsertMergePolicy)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::SyncSource)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::ShuttleBehaviour)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::ShuttleUnits)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::ClockDeltaMode)
|
||||
DEFINE_ENUM_CONVERT(ARDOUR::DenormalModel)
|
||||
|
|
|
@ -99,7 +99,6 @@ setup_enum_writer ()
|
|||
PluginType _PluginType;
|
||||
SyncSource _SyncSource;
|
||||
TransportRequestType _TransportRequestType;
|
||||
ShuttleBehaviour _ShuttleBehaviour;
|
||||
ShuttleUnits _ShuttleUnits;
|
||||
Session::RecordState _Session_RecordState;
|
||||
SessionEvent::Type _SessionEvent_Type;
|
||||
|
@ -434,10 +433,6 @@ setup_enum_writer ()
|
|||
REGISTER_ENUM (TR_Locate);
|
||||
REGISTER (_TransportRequestType);
|
||||
|
||||
REGISTER_ENUM (Sprung);
|
||||
REGISTER_ENUM (Wheel);
|
||||
REGISTER (_ShuttleBehaviour);
|
||||
|
||||
REGISTER_ENUM (Percentage);
|
||||
REGISTER_ENUM (Semitones);
|
||||
REGISTER (_ShuttleUnits);
|
||||
|
|
|
@ -2274,11 +2274,6 @@ LuaBindings::common (lua_State* L)
|
|||
.addConst ("ForceSel", ARDOUR::RangeSelectionAfterSplit(ForceSel))
|
||||
.endNamespace ()
|
||||
|
||||
.beginNamespace ("ShuttleBehaviour")
|
||||
.addConst ("Sprung", ARDOUR::ShuttleBehaviour(Sprung))
|
||||
.addConst ("Wheel", ARDOUR::ShuttleBehaviour(Wheel))
|
||||
.endNamespace ()
|
||||
|
||||
.beginNamespace ("ScreenSaverMode")
|
||||
.addConst ("InhibitNever", ARDOUR::ScreenSaverMode(InhibitNever))
|
||||
.addConst ("InhibitWhileRecording", ARDOUR::ScreenSaverMode(InhibitWhileRecording))
|
||||
|
|
|
@ -191,8 +191,6 @@ Session::Session (AudioEngine &eng,
|
|||
, _silent (false)
|
||||
, _remaining_latency_preroll (0)
|
||||
, _engine_speed (1.0)
|
||||
, _last_transport_speed (1.0)
|
||||
, _requested_transport_speed (std::numeric_limits<double>::max())
|
||||
, _signalled_varispeed (0)
|
||||
, auto_play_legal (false)
|
||||
, _requested_return_sample (-1)
|
||||
|
|
|
@ -43,7 +43,7 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
|
||||
#define TFSM_ROLL() { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::StartTransport)); }
|
||||
#define TFSM_SPEED(speed,as_default) { _transport_fsm->enqueue (new TransportFSM::Event (speed,as_default)); }
|
||||
#define TFSM_SPEED(speed) { _transport_fsm->enqueue (new TransportFSM::Event (speed)); }
|
||||
|
||||
boost::shared_ptr<ExportHandler>
|
||||
Session::get_export_handler ()
|
||||
|
@ -308,7 +308,7 @@ Session::process_export_fw (pframes_t nframes)
|
|||
return;
|
||||
}
|
||||
|
||||
TFSM_SPEED (1.0, false);
|
||||
TFSM_SPEED (1.0);
|
||||
TFSM_ROLL ();
|
||||
_butler->schedule_transport_work ();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ using namespace std;
|
|||
#define TFSM_EVENT(evtype) { _transport_fsm->enqueue (new TransportFSM::Event (evtype)); }
|
||||
#define TFSM_ROLL() { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::StartTransport)); }
|
||||
#define TFSM_STOP(abort,clear) { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::StopTransport,abort,clear)); }
|
||||
#define TFSM_SPEED(speed,as_default) { _transport_fsm->enqueue (new TransportFSM::Event (speed,as_default)); }
|
||||
#define TFSM_SPEED(speed) { _transport_fsm->enqueue (new TransportFSM::Event (speed)); }
|
||||
#define TFSM_LOCATE(target,ltd,loop,force) { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::Locate,target,ltd,loop,force)); }
|
||||
|
||||
|
||||
|
@ -918,7 +918,7 @@ Session::process_event (SessionEvent* ev)
|
|||
|
||||
|
||||
case SessionEvent::SetTransportSpeed:
|
||||
TFSM_SPEED (ev->speed, ev->yes_or_no);
|
||||
TFSM_SPEED (ev->speed);
|
||||
break;
|
||||
|
||||
case SessionEvent::StartRoll:
|
||||
|
@ -986,7 +986,7 @@ Session::process_event (SessionEvent* ev)
|
|||
break;
|
||||
|
||||
case SessionEvent::SetPlayAudioRange:
|
||||
set_play_range (ev->audio_range, (ev->speed == 1.0f));
|
||||
set_play_range (ev->audio_range, (ev->speed == _transport_fsm->default_speed())); //an explicit PLAY state would be nicer here
|
||||
break;
|
||||
|
||||
case SessionEvent::CancelPlayAudioRange:
|
||||
|
@ -1251,7 +1251,11 @@ Session::plan_master_strategy (pframes_t nframes, double master_speed, samplepos
|
|||
*/
|
||||
|
||||
if (!config.get_external_sync()) {
|
||||
return actual_speed ();
|
||||
float desired = actual_speed ();
|
||||
if (desired==0.0) {
|
||||
return _transport_fsm->default_speed();
|
||||
}
|
||||
return desired;
|
||||
}
|
||||
|
||||
/* When calling TransportMasterStart, sould aim for
|
||||
|
|
|
@ -86,7 +86,7 @@ using namespace PBD;
|
|||
#define TFSM_EVENT(evtype) { _transport_fsm->enqueue (new TransportFSM::Event (evtype)); }
|
||||
#define TFSM_STOP(abort,clear) { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::StopTransport,abort,clear)); }
|
||||
#define TFSM_LOCATE(target,ltd,loop,force) { _transport_fsm->enqueue (new TransportFSM::Event (TransportFSM::Locate,target,ltd,loop,force)); }
|
||||
#define TFSM_SPEED(speed,as_default) { _transport_fsm->enqueue (new TransportFSM::Event (speed,as_default)); }
|
||||
#define TFSM_SPEED(speed) { _transport_fsm->enqueue (new TransportFSM::Event (speed)); }
|
||||
|
||||
/* *****************************************************************************
|
||||
* REALTIME ACTIONS (to be called on state transitions)
|
||||
|
@ -309,6 +309,23 @@ Session::post_locate ()
|
|||
}
|
||||
}
|
||||
|
||||
double
|
||||
Session::default_play_speed ()
|
||||
{
|
||||
return _transport_fsm->default_speed();
|
||||
}
|
||||
|
||||
/** Set the default speed that is used when we respond to a "play" action.
|
||||
* @param speed New speed
|
||||
*/
|
||||
void
|
||||
Session::set_default_play_speed (double spd, TransportRequestSource origin)
|
||||
{
|
||||
_transport_fsm->set_default_speed(spd);
|
||||
TFSM_SPEED(spd);
|
||||
TransportStateChange (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
/** Set the transport speed.
|
||||
* Called from the process thread.
|
||||
* @param speed New speed
|
||||
|
@ -319,6 +336,8 @@ Session::set_transport_speed (double speed)
|
|||
ENSURE_PROCESS_THREAD;
|
||||
DEBUG_TRACE (DEBUG::Transport, string_compose ("@ %1 Set transport speed to %2 from %3 (es = %4)\n", _transport_sample, speed, _transport_fsm->transport_speed(), _engine_speed));
|
||||
|
||||
double default_speed = _transport_fsm->default_speed();
|
||||
|
||||
assert (speed != 0.0);
|
||||
|
||||
/* the logic:
|
||||
|
@ -335,7 +354,7 @@ Session::set_transport_speed (double speed)
|
|||
|
||||
*/
|
||||
|
||||
if ((_engine_speed != 1) && (_engine_speed == fabs (speed)) && ((speed * _transport_fsm->transport_speed()) > 0)) {
|
||||
if ((_engine_speed != default_speed) && (_engine_speed == fabs (speed)) && ((speed * _transport_fsm->transport_speed()) > 0)) {
|
||||
/* engine speed is not changing and no direction change, do nothing */
|
||||
DEBUG_TRACE (DEBUG::Transport, "no reason to change speed, do nothing\n");
|
||||
return;
|
||||
|
@ -365,8 +384,9 @@ Session::set_transport_speed (double speed)
|
|||
clear_clicks ();
|
||||
_engine_speed = new_engine_speed;
|
||||
|
||||
if (!Config->get_auto_return_after_rewind_ffwd() && fabs (speed) != 1.0 && _transport_fsm->default_speed() == 1.0) {
|
||||
/* varispeed of any sort cancels auto-return */
|
||||
if (!Config->get_auto_return_after_rewind_ffwd() && fabs (speed) > 2.0) {
|
||||
/* fast-wind of any sort should cancel auto-return */
|
||||
/* since we don't have an actual ffwd/rew state yet, just trigger on a 'fast' varispeed */
|
||||
_requested_return_sample = -1;
|
||||
_last_roll_location = -1;
|
||||
_last_roll_or_reversal_location = -1;
|
||||
|
@ -390,7 +410,7 @@ Session::set_transport_speed (double speed)
|
|||
|
||||
if (fabs (_signalled_varispeed - act_speed) > .002
|
||||
// still, signal hard changes to 1.0 and 0.0:
|
||||
|| (act_speed == 1.0 && _signalled_varispeed != 1.0)
|
||||
|| (act_speed == default_speed && _signalled_varispeed != default_speed)
|
||||
|| (act_speed == 0.0 && _signalled_varispeed != 0.0)
|
||||
)
|
||||
{
|
||||
|
@ -742,11 +762,11 @@ Session::request_sync_source (boost::shared_ptr<TransportMaster> tm)
|
|||
void
|
||||
Session::reset_transport_speed (TransportRequestSource origin)
|
||||
{
|
||||
request_transport_speed (1.0, true, origin);
|
||||
request_transport_speed (_transport_fsm->default_speed(), origin);
|
||||
}
|
||||
|
||||
void
|
||||
Session::request_transport_speed (double speed, bool as_default, TransportRequestSource origin)
|
||||
Session::request_transport_speed (double speed, TransportRequestSource origin)
|
||||
{
|
||||
if (synced_to_engine()) {
|
||||
if (speed != 0) {
|
||||
|
@ -768,8 +788,7 @@ Session::request_transport_speed (double speed, bool as_default, TransportReques
|
|||
}
|
||||
|
||||
SessionEvent* ev = new SessionEvent (SessionEvent::SetTransportSpeed, SessionEvent::Add, SessionEvent::Immediate, 0, speed);
|
||||
ev->yes_or_no = as_default; // as_default
|
||||
DEBUG_TRACE (DEBUG::Transport, string_compose ("Request transport speed = %1 as default = %2\n", speed, as_default));
|
||||
DEBUG_TRACE (DEBUG::Transport, string_compose ("Request transport speed = %1 as default = %2\n", speed));
|
||||
queue_event (ev);
|
||||
}
|
||||
|
||||
|
@ -778,13 +797,13 @@ Session::request_transport_speed (double speed, bool as_default, TransportReques
|
|||
* be used by callers who are varying transport speed but don't ever want to stop it.
|
||||
*/
|
||||
void
|
||||
Session::request_transport_speed_nonzero (double speed, bool as_default, TransportRequestSource origin)
|
||||
Session::request_transport_speed_nonzero (double speed, TransportRequestSource origin)
|
||||
{
|
||||
if (speed == 0) {
|
||||
speed = DBL_EPSILON;
|
||||
}
|
||||
|
||||
request_transport_speed (speed, as_default);
|
||||
request_transport_speed (speed);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -906,7 +925,7 @@ Session::request_count_in_record ()
|
|||
}
|
||||
maybe_enable_record ();
|
||||
_count_in_once = true;
|
||||
request_transport_speed (1.0, true);
|
||||
request_transport_speed(_transport_fsm->default_speed());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -936,7 +955,7 @@ Session::request_play_loop (bool yn, bool change_transport_roll)
|
|||
/* currently stopped */
|
||||
if (yn) {
|
||||
/* start looping at normal speed */
|
||||
target_speed = 1.0;
|
||||
target_speed = _transport_fsm->default_speed();
|
||||
} else {
|
||||
target_speed = 0.0;
|
||||
}
|
||||
|
@ -954,7 +973,7 @@ Session::request_play_loop (bool yn, bool change_transport_roll)
|
|||
void
|
||||
Session::request_play_range (list<AudioRange>* range, bool leave_rolling)
|
||||
{
|
||||
SessionEvent* ev = new SessionEvent (SessionEvent::SetPlayAudioRange, SessionEvent::Add, SessionEvent::Immediate, 0, (leave_rolling ? 1.0 : 0.0));
|
||||
SessionEvent* ev = new SessionEvent (SessionEvent::SetPlayAudioRange, SessionEvent::Add, SessionEvent::Immediate, 0, (leave_rolling ? _transport_fsm->default_speed() : 0.0));
|
||||
if (range) {
|
||||
ev->audio_range = *range;
|
||||
} else {
|
||||
|
@ -1735,7 +1754,7 @@ Session::set_requested_return_sample (samplepos_t return_to)
|
|||
void
|
||||
Session::request_roll_at_and_return (samplepos_t start, samplepos_t return_to)
|
||||
{
|
||||
SessionEvent *ev = new SessionEvent (SessionEvent::LocateRollLocate, SessionEvent::Add, SessionEvent::Immediate, return_to, 1.0);
|
||||
SessionEvent *ev = new SessionEvent (SessionEvent::LocateRollLocate, SessionEvent::Add, SessionEvent::Immediate, return_to, _transport_fsm->default_speed());
|
||||
ev->target2_sample = start;
|
||||
queue_event (ev);
|
||||
}
|
||||
|
|
|
@ -505,8 +505,10 @@ TransportFSM::maybe_reset_speed ()
|
|||
|
||||
if (Config->get_reset_default_speed_on_stop()) {
|
||||
|
||||
if (most_recently_requested_speed != 1.0) {
|
||||
state_changed = set_speed (Event (1.0, false));
|
||||
if (most_recently_requested_speed != 1.0 || default_speed() != 1.0) {
|
||||
set_default_speed(1.0);
|
||||
set_speed (Event (1.0));
|
||||
state_changed = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -515,11 +517,11 @@ TransportFSM::maybe_reset_speed ()
|
|||
* speed change from whatever we have been rolling at to
|
||||
* whatever the current default is. We could have been
|
||||
* rewinding at -4.5 ... when we restart, we need to play at
|
||||
* the current _default_transport_speed
|
||||
* the current _default_speed
|
||||
*/
|
||||
|
||||
if (most_recently_requested_speed != _default_speed) {
|
||||
state_changed = set_speed (Event (_default_speed, false));
|
||||
state_changed = set_speed (Event (_default_speed));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,10 +804,6 @@ TransportFSM::set_speed (Event const & ev)
|
|||
|
||||
most_recently_requested_speed = ev.speed;
|
||||
|
||||
if (ev.as_default) {
|
||||
_default_speed = ev.speed;
|
||||
}
|
||||
|
||||
if (must_reverse) {
|
||||
|
||||
/* direction change */
|
||||
|
|
|
@ -200,13 +200,13 @@ BasicUI::button_varispeed (bool fwd)
|
|||
|
||||
if (fwd) {
|
||||
if (transport_speed <= 0) {
|
||||
session->request_transport_speed (1.0, false);
|
||||
session->request_transport_speed (1.0);
|
||||
session->request_roll (TRS_UI);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (transport_speed >= 0) {
|
||||
session->request_transport_speed (-1.0, false);
|
||||
session->request_transport_speed (-1.0);
|
||||
session->request_roll (TRS_UI);
|
||||
return;
|
||||
}
|
||||
|
@ -221,12 +221,12 @@ BasicUI::button_varispeed (bool fwd)
|
|||
|
||||
if (fwd) {
|
||||
if (transport_speed <= 0) {
|
||||
session->request_transport_speed (1.0, false);
|
||||
session->request_transport_speed (1.0);
|
||||
session->request_roll (TRS_UI);
|
||||
}
|
||||
} else {
|
||||
if (transport_speed >= 0) {
|
||||
session->request_transport_speed (-1.0, false);
|
||||
session->request_transport_speed (-1.0);
|
||||
session->request_roll (TRS_UI);
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ BasicUI::button_varispeed (bool fwd)
|
|||
|
||||
speed = semitone_ratio * transport_speed;
|
||||
speed = std::max (-maxspeed, std::min (maxspeed, speed));
|
||||
session->request_transport_speed (speed, false);
|
||||
session->request_transport_speed (speed);
|
||||
session->request_roll (TRS_UI);
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ BasicUI::transport_play (bool from_last_start)
|
|||
}
|
||||
|
||||
if (rolling) {
|
||||
session->request_transport_speed (1.0, false, TRS_UI);
|
||||
session->request_transport_speed (1.0, TRS_UI);
|
||||
} else {
|
||||
session->request_roll ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue