mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
VKeybd: Pitchebend sprung mode and keyboard-shortcuts
This unconditionally returns the pitch-bend wheel when used by mouse-drag/drop. Mouse-wheel retains the "wheel" mode. <F1>-<F4> key-bindings have been added to jump to discrete values
This commit is contained in:
parent
b2bc934e21
commit
a31fde491a
2 changed files with 61 additions and 7 deletions
|
|
@ -100,6 +100,7 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||||
|
|
||||||
_pitch_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::pitch_slider_adjusted));
|
_pitch_adjustment.signal_value_changed ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::pitch_slider_adjusted));
|
||||||
_pitchbend->ValueChanged.connect_same_thread (_cc_connections, boost::bind (&VirtualKeyboardWindow::pitch_bend_event_handler, this, _1));
|
_pitchbend->ValueChanged.connect_same_thread (_cc_connections, boost::bind (&VirtualKeyboardWindow::pitch_bend_event_handler, this, _1));
|
||||||
|
_pitch_slider->StopGesture.connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::pitch_bend_release));
|
||||||
|
|
||||||
set_tooltip (_yaxis_velocity, _("When enabled, mouse-click y-axis position defines the velocity."));
|
set_tooltip (_yaxis_velocity, _("When enabled, mouse-click y-axis position defines the velocity."));
|
||||||
|
|
||||||
|
|
@ -382,19 +383,64 @@ VirtualKeyboardWindow::on_key_press_event (GdkEventKey* ev)
|
||||||
// and use signals. -- also subscribe SustainChanged, indicate sustain.
|
// and use signals. -- also subscribe SustainChanged, indicate sustain.
|
||||||
// TODO: pitch-bend shortcuts
|
// TODO: pitch-bend shortcuts
|
||||||
if (ev->type == GDK_KEY_PRESS) {
|
if (ev->type == GDK_KEY_PRESS) {
|
||||||
if (ev->keyval == GDK_KEY_Left) {
|
switch (ev->keyval) {
|
||||||
_piano_octave_key.set_value (_piano_octave_key.get_value_as_int () - 1);
|
case GDK_KEY_Left:
|
||||||
return true;
|
_piano_octave_key.set_value (_piano_octave_key.get_value_as_int () - 1);
|
||||||
}
|
return true;
|
||||||
if (ev->keyval == GDK_KEY_Right) {
|
case GDK_KEY_Right:
|
||||||
_piano_octave_key.set_value (_piano_octave_key.get_value_as_int () + 1);
|
_piano_octave_key.set_value (_piano_octave_key.get_value_as_int () + 1);
|
||||||
return true;
|
return true;
|
||||||
|
case GDK_KEY_F1:
|
||||||
|
_pitch_adjustment.set_value (0);
|
||||||
|
return true;
|
||||||
|
case GDK_KEY_F2:
|
||||||
|
_pitch_adjustment.set_value (4096);
|
||||||
|
return true;
|
||||||
|
case GDK_KEY_F3:
|
||||||
|
_pitch_adjustment.set_value (12288);
|
||||||
|
return true;
|
||||||
|
case GDK_KEY_F4:
|
||||||
|
_pitch_adjustment.set_value (16383);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ARDOUR_UI_UTILS::relay_key_press (ev, this);
|
return ARDOUR_UI_UTILS::relay_key_press (ev, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
VirtualKeyboardWindow::on_key_release_event (GdkEventKey* ev)
|
||||||
|
{
|
||||||
|
/* try propagate unmodified events first */
|
||||||
|
if ((ev->state & 0xf) == 0) {
|
||||||
|
if (gtk_window_propagate_key_event (gobj(), ev)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_piano.grab_focus ();
|
||||||
|
|
||||||
|
if (ev->type == GDK_KEY_RELEASE) {
|
||||||
|
switch (ev->keyval) {
|
||||||
|
case GDK_KEY_F1:
|
||||||
|
/* fallthrough */
|
||||||
|
case GDK_KEY_F2:
|
||||||
|
/* fallthrough */
|
||||||
|
case GDK_KEY_F3:
|
||||||
|
/* fallthrough */
|
||||||
|
case GDK_KEY_F4:
|
||||||
|
_pitch_adjustment.set_value (8192);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ArdourWindow::on_key_release_event (ev);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VirtualKeyboardWindow::select_keyboard_layout (std::string const& l)
|
VirtualKeyboardWindow::select_keyboard_layout (std::string const& l)
|
||||||
{
|
{
|
||||||
|
|
@ -623,3 +669,9 @@ VirtualKeyboardWindow::pitch_bend_event_handler (int val)
|
||||||
ev[2] = (val >> 7) & 0x7f;
|
ev[2] = (val >> 7) & 0x7f;
|
||||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VirtualKeyboardWindow::pitch_bend_release ()
|
||||||
|
{
|
||||||
|
_pitch_adjustment.set_value (8192);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,13 @@ protected:
|
||||||
private:
|
private:
|
||||||
void on_unmap ();
|
void on_unmap ();
|
||||||
bool on_key_press_event (GdkEventKey*);
|
bool on_key_press_event (GdkEventKey*);
|
||||||
|
bool on_key_release_event (GdkEventKey*);
|
||||||
|
|
||||||
void note_on_event_handler (int, int);
|
void note_on_event_handler (int, int);
|
||||||
void note_off_event_handler (int);
|
void note_off_event_handler (int);
|
||||||
void control_change_event_handler (int, int);
|
void control_change_event_handler (int, int);
|
||||||
void pitch_bend_event_handler (int);
|
void pitch_bend_event_handler (int);
|
||||||
|
void pitch_bend_release ();
|
||||||
|
|
||||||
void select_keyboard_layout (std::string const&);
|
void select_keyboard_layout (std::string const&);
|
||||||
void update_velocity_settings (int);
|
void update_velocity_settings (int);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue