Allow vari-speed control via scroll-wheel
This commit is contained in:
parent
9a66bd6163
commit
89a4c98bfd
|
@ -183,6 +183,7 @@ ShuttleControl::ShuttleControl ()
|
|||
_vari_button.set_name ("vari button");
|
||||
_vari_button.set_text(_("Vari"));
|
||||
_vari_button.signal_clicked.connect (sigc::mem_fun (*this, &ShuttleControl::varispeed_button_clicked));
|
||||
_vari_button.signal_scroll_event().connect (sigc::mem_fun (*this, &ShuttleControl::varispeed_button_scroll_event), false);
|
||||
|
||||
/* gtkmm 2.4: the C++ wrapper doesn't work */
|
||||
g_signal_connect ((GObject*) gobj(), "query-tooltip", G_CALLBACK (qt), NULL);
|
||||
|
@ -206,6 +207,34 @@ ShuttleControl::varispeed_button_clicked ()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ShuttleControl::varispeed_button_scroll_event (GdkEventScroll* ev)
|
||||
{
|
||||
double semi = 1.0;
|
||||
|
||||
if (ev->state & Gtkmm2ext::Keyboard::GainFineScaleModifier) {
|
||||
if (ev->state & Gtkmm2ext::Keyboard::GainExtraFineScaleModifier) {
|
||||
semi = 0.1;
|
||||
} else {
|
||||
semi = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
switch (ev->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
case GDK_SCROLL_RIGHT:
|
||||
_vari_dialog.present ();
|
||||
_vari_dialog.adj_semi (semi);
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
case GDK_SCROLL_LEFT:
|
||||
_vari_dialog.present ();
|
||||
_vari_dialog.adj_semi (-semi);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ShuttleControl::do_blink (bool onoff)
|
||||
{
|
||||
|
|
|
@ -121,6 +121,7 @@ protected:
|
|||
VarispeedDialog _vari_dialog;
|
||||
ArdourWidgets::ArdourButton _vari_button;
|
||||
void varispeed_button_clicked ();
|
||||
bool varispeed_button_scroll_event (GdkEventScroll*);
|
||||
|
||||
bool on_enter_notify_event (GdkEventCrossing*);
|
||||
bool on_leave_notify_event (GdkEventCrossing*);
|
||||
|
|
|
@ -69,10 +69,13 @@ VarispeedDialog::on_key_press_event (GdkEventKey* ev)
|
|||
}
|
||||
|
||||
void
|
||||
VarispeedDialog::reset ()
|
||||
VarispeedDialog::adj_semi (double delta)
|
||||
{
|
||||
_semitones_spinner.set_value (0);
|
||||
_cents_spinner.set_value (0);
|
||||
int cents = _semitones_spinner.get_value () * 100 + _cents_spinner.get_value ();
|
||||
cents += 100.0 * delta;
|
||||
|
||||
_semitones_spinner.set_value (cents / 100);
|
||||
_cents_spinner.set_value (cents % 100);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -82,6 +85,7 @@ VarispeedDialog::apply_speed ()
|
|||
|
||||
double speed = pow (2.0, ((double)cents / 1200.0));
|
||||
|
||||
printf ("VarispeedDialog::apply_speed\n");
|
||||
if (_session && _session->default_play_speed () != speed) {
|
||||
_session->set_default_play_speed (speed);
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ class VarispeedDialog : public ArdourDialog
|
|||
{
|
||||
public:
|
||||
VarispeedDialog ();
|
||||
void adj_semi (double delta);
|
||||
|
||||
private:
|
||||
void apply_speed ();
|
||||
void reset ();
|
||||
|
||||
void on_show ();
|
||||
void on_hide ();
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef __ardour_plugin_region_h__
|
||||
#define __ardour_plugin_region_h__
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class LIBARDOUR_API PluginRegion : public Region
|
||||
{
|
||||
public:
|
||||
~PluginRegion();
|
||||
|
||||
XMLNode& state ();
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
/* Readable interface */
|
||||
virtual samplecnt_t read (Sample*, samplepos_t /*pos*/, samplecnt_t /*cnt*/, int /*channel*/) const;
|
||||
virtual samplecnt_t readable_length() const { return length(); }
|
||||
virtual uint32_t n_channels () const;
|
||||
|
||||
/* automation */
|
||||
boost::shared_ptr<Evoral::Control>
|
||||
control(const Evoral::Parameter& id, bool create=false) {
|
||||
return _automatable.control(id, create);
|
||||
}
|
||||
|
||||
boost::shared_ptr<const Evoral::Control>
|
||||
control(const Evoral::Parameter& id) const {
|
||||
return _automatable.control(id);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class RegionFactory;
|
||||
PluginRegion (Session& s, boost::shared_ptr<PluinInsert> pi, samplepos_t, samplecnt_t);
|
||||
|
||||
virtual void recompute_at_start () = 0;
|
||||
virtual void recompute_at_end () = 0;
|
||||
|
||||
Automatable _automatable;
|
||||
};
|
||||
|
||||
} /* namespace ARDOUR */
|
||||
#endif /* __ardour_plugin_region_h__ */
|
Loading…
Reference in New Issue