NO-OP: whitespace
This commit is contained in:
parent
35647577e0
commit
226cac95e7
@ -18,15 +18,15 @@
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
#include "pbd/convert.h"
|
||||
#include "ardour/async_midi_port.h"
|
||||
#include "ardour/session.h"
|
||||
#include "pbd/convert.h"
|
||||
#include "widgets/tooltips.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "virtual_keyboard_window.h"
|
||||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
#include "virtual_keyboard_window.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
@ -34,7 +34,7 @@ using namespace Glib;
|
||||
using namespace Gtk;
|
||||
using namespace ArdourWidgets;
|
||||
|
||||
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
|
||||
#define PX_SCALE(px) std::max ((float)px, rintf ((float)px* UIConfiguration::instance ().get_ui_scale ()))
|
||||
|
||||
VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
: ArdourWindow (_("Virtual MIDI Keyboard"))
|
||||
@ -50,29 +50,29 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
, _show_note_label ("Label C Key", ArdourButton::led_default_elements)
|
||||
, _send_panic ("Panic", ArdourButton::default_elements)
|
||||
, _piano_key_velocity (*manage (new Adjustment (100, 1, 127, 1, 16)))
|
||||
, _piano_min_velocity (*manage (new Adjustment (1 , 1, 127, 1, 16)))
|
||||
, _piano_min_velocity (*manage (new Adjustment ( 1, 1, 127, 1, 16)))
|
||||
, _piano_max_velocity (*manage (new Adjustment (127, 1, 127, 1, 16)))
|
||||
, _piano_octave_key (*manage (new Adjustment (4, -1, 7, 1, 1)))
|
||||
, _piano_octave_range (*manage (new Adjustment (7, 2, 11, 1, 1)))
|
||||
, _pitch_adjustment (8192, 0, 16383, 1, 256)
|
||||
{
|
||||
_piano = (PianoKeyboard*)piano_keyboard_new();
|
||||
_pianomm = Glib::wrap((GtkWidget*)_piano);
|
||||
_pianomm->set_flags(Gtk::CAN_FOCUS);
|
||||
_pianomm->add_events(Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
_piano = (PianoKeyboard*)piano_keyboard_new ();
|
||||
_pianomm = Glib::wrap ((GtkWidget*)_piano);
|
||||
_pianomm->set_flags (Gtk::CAN_FOCUS);
|
||||
_pianomm->add_events (Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
|
||||
piano_keyboard_set_keyboard_layout (_piano, "QWERTY");
|
||||
piano_keyboard_show_note_label (_piano, true);
|
||||
|
||||
using namespace Menu_Helpers;
|
||||
_keyboard_layout.AddMenuElem (MenuElem ("QWERTY",
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "QWERTY")));
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "QWERTY")));
|
||||
_keyboard_layout.AddMenuElem (MenuElem ("QWERTZ",
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "QWERTZ")));
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "QWERTZ")));
|
||||
_keyboard_layout.AddMenuElem (MenuElem ("AZERTY",
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "AZERTY")));
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "AZERTY")));
|
||||
_keyboard_layout.AddMenuElem (MenuElem ("DVORAK",
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "DVORAK")));
|
||||
_keyboard_layout.set_active (_("QWERTY"));
|
||||
sigc::bind (sigc::mem_fun (*this, &VirtualKeyboardWindow::select_keyboard_layout), "DVORAK")));
|
||||
_keyboard_layout.set_active ("QWERTY");
|
||||
|
||||
_cfg_display.set_active (false);
|
||||
_pgm_display.set_active (false);
|
||||
@ -81,13 +81,12 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
_highlight_key_range.set_active (false);
|
||||
_show_note_label.set_active (true);
|
||||
|
||||
_pitchbend = boost::shared_ptr<VKBDControl> (new VKBDControl ("PB", 8192, 16383));
|
||||
_pitch_slider = manage (new VSliderController(&_pitch_adjustment, _pitchbend, 0, PX_SCALE (15)));
|
||||
_pitchbend = boost::shared_ptr<VKBDControl> (new VKBDControl ("PB", 8192, 16383));
|
||||
_pitch_slider = manage (new VSliderController (&_pitch_adjustment, _pitchbend, 0, PX_SCALE (15)));
|
||||
_pitch_slider_tooltip = new Gtkmm2ext::PersistentTooltip (_pitch_slider);
|
||||
_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));
|
||||
|
||||
_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));
|
||||
|
||||
set_tooltip (_highlight_grand_piano, "Shade keys outside the range of a Grand Piano (A0-C8).");
|
||||
set_tooltip (_highlight_key_range, "Indicate which notes can be controlled by keyboard-shortcuts.");
|
||||
@ -108,32 +107,32 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
|
||||
/* config */
|
||||
Table* cfg_tbl = manage (new Table);
|
||||
cfg_tbl->attach (_yaxis_velocity, 0, 1, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Velocity:"))), 0, 1, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_yaxis_velocity, 0, 1, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Velocity:"))), 0, 1, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
|
||||
cfg_tbl->attach (_piano_min_velocity, 1, 2, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Min"))), 1, 2, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_max_velocity, 2, 3, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Max"))), 2, 3, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_key_velocity, 3, 4, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Key"))), 3, 4, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_min_velocity, 1, 2, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Min"))), 1, 2, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_max_velocity, 2, 3, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Max"))), 2, 3, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_key_velocity, 3, 4, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Key"))), 3, 4, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 4, 5, 0, 2, SHRINK, FILL, 4, 0);
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 4, 5, 0, 2, SHRINK, FILL, 4, 0);
|
||||
|
||||
cfg_tbl->attach (_piano_octave_key, 5, 6, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Octave"))), 5, 6, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_octave_range, 6, 7, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Range"))), 6, 7, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_octave_key, 5, 6, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Octave"))), 5, 6, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (_piano_octave_range, 6, 7, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
cfg_tbl->attach (*manage (new Label (_("Range"))), 6, 7, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 7, 8, 0, 2, SHRINK, FILL, 4, 0);
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 7, 8, 0, 2, SHRINK, FILL, 4, 0);
|
||||
|
||||
cfg_tbl->attach (_highlight_grand_piano, 8, 9, 0, 1, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_highlight_key_range, 8, 9, 1, 2, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_highlight_grand_piano, 8, 9, 0, 1, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_highlight_key_range, 8, 9, 1, 2, FILL, SHRINK, 4, 1);
|
||||
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 9,10, 0, 2, SHRINK, FILL, 4, 0);
|
||||
cfg_tbl->attach (*manage (new ArdourVSpacer), 9, 10, 0, 2, SHRINK, FILL, 4, 0);
|
||||
|
||||
cfg_tbl->attach (_show_note_label, 10,11, 0, 1, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_keyboard_layout, 10,11, 1, 2, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_show_note_label, 10, 11, 0, 1, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->attach (_keyboard_layout, 10, 11, 1, 2, FILL, SHRINK, 4, 1);
|
||||
cfg_tbl->show_all ();
|
||||
|
||||
/* bank/patch */
|
||||
@ -142,16 +141,16 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
Label* lbl = manage (new Label (_("Note: Prefer\nTrack-controls")));
|
||||
lbl->set_justify (JUSTIFY_CENTER);
|
||||
|
||||
pgm_tbl->attach (*lbl, 0, 1, 0, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new ArdourVSpacer), 1, 2, 0, 2, SHRINK, FILL, 4, 0);
|
||||
pgm_tbl->attach (_bank_msb, 2, 3, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (_bank_lsb, 3, 4, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (_patchpgm, 4, 5, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("MSB"))), 2, 3, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("LSB"))), 3, 4, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("PGM"))), 4, 5, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new ArdourVSpacer), 5, 6, 0, 2, SHRINK, FILL, 4, 0);
|
||||
pgm_tbl->attach (_send_panic, 6, 7, 0, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*lbl, 0, 1, 0, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new ArdourVSpacer), 1, 2, 0, 2, SHRINK, FILL, 4, 0);
|
||||
pgm_tbl->attach (_bank_msb, 2, 3, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (_bank_lsb, 3, 4, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (_patchpgm, 4, 5, 0, 1, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("MSB"))), 2, 3, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("LSB"))), 3, 4, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new Label (_("PGM"))), 4, 5, 1, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->attach (*manage (new ArdourVSpacer), 5, 6, 0, 2, SHRINK, FILL, 4, 0);
|
||||
pgm_tbl->attach (_send_panic, 6, 7, 0, 2, SHRINK, SHRINK, 4, 0);
|
||||
pgm_tbl->show_all ();
|
||||
|
||||
/* settings */
|
||||
@ -164,10 +163,10 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
const char* default_cc[VKBD_NCTRLS] = { "7", "8", "1", "11", "91", "92", "93", "94" };
|
||||
|
||||
for (int i = 0; i < VKBD_NCTRLS; ++i) {
|
||||
_cc[i] = boost::shared_ptr<VKBDControl> (new VKBDControl ("CC"));
|
||||
_cc_knob[i] = manage(new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Flags (0)));
|
||||
_cc[i] = boost::shared_ptr<VKBDControl> (new VKBDControl ("CC"));
|
||||
_cc_knob[i] = manage (new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Flags (0)));
|
||||
_cc_knob[i]->set_controllable (_cc[i]);
|
||||
_cc_knob[i]->set_size_request (PX_SCALE(21), PX_SCALE(21));
|
||||
_cc_knob[i]->set_size_request (PX_SCALE (21), PX_SCALE (21));
|
||||
_cc_knob[i]->set_tooltip_prefix (_("CC: "));
|
||||
_cc_knob[i]->set_name ("monitor section knob");
|
||||
|
||||
@ -181,11 +180,11 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
}
|
||||
_cc_key[i].set_active (default_cc[i]);
|
||||
|
||||
tbl->attach (*_cc_knob[i], i+3, i+4, 0, 1, SHRINK, SHRINK, 4, 2);
|
||||
tbl->attach (_cc_key[i] , i+3, i+4, 1, 2, SHRINK, SHRINK, 4, 2);
|
||||
tbl->attach (*_cc_knob[i], i + 3, i + 4, 0, 1, SHRINK, SHRINK, 4, 2);
|
||||
tbl->attach (_cc_key[i], i + 3, i + 4, 1, 2, SHRINK, SHRINK, 4, 2);
|
||||
|
||||
_cc[i]->ValueChanged.connect_same_thread (_cc_connections,
|
||||
boost::bind (&VirtualKeyboardWindow::control_change_event_handler, this, i, _1));
|
||||
boost::bind (&VirtualKeyboardWindow::control_change_event_handler, this, i, _1));
|
||||
}
|
||||
|
||||
/* main layout */
|
||||
@ -223,13 +222,13 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
_piano_octave_key.signal_value_changed ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::update_octave_key));
|
||||
_piano_octave_range.signal_value_changed ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::update_octave_range));
|
||||
|
||||
_cfg_display.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_config), false);
|
||||
_pgm_display.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_bankpatch), false);
|
||||
_yaxis_velocity.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_yaxis_velocity), false);
|
||||
_highlight_grand_piano.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_highlight_piano), false);
|
||||
_highlight_key_range.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_highlight_key), false);
|
||||
_show_note_label.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::toggle_note_label), false);
|
||||
_send_panic.signal_button_release_event().connect (sigc::mem_fun(*this, &VirtualKeyboardWindow::send_panic_message), false);
|
||||
_cfg_display.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_config), false);
|
||||
_pgm_display.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_bankpatch), false);
|
||||
_yaxis_velocity.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_yaxis_velocity), false);
|
||||
_highlight_grand_piano.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_highlight_piano), false);
|
||||
_highlight_key_range.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_highlight_key), false);
|
||||
_show_note_label.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::toggle_note_label), false);
|
||||
_send_panic.signal_button_release_event ().connect (sigc::mem_fun (*this, &VirtualKeyboardWindow::send_panic_message), false);
|
||||
|
||||
g_signal_connect (G_OBJECT (_piano), "note-on", G_CALLBACK (VirtualKeyboardWindow::_note_on_event_handler), this);
|
||||
g_signal_connect (G_OBJECT (_piano), "note-off", G_CALLBACK (VirtualKeyboardWindow::_note_off_event_handler), this);
|
||||
@ -238,7 +237,7 @@ VirtualKeyboardWindow::VirtualKeyboardWindow ()
|
||||
update_octave_range ();
|
||||
|
||||
set_keep_above (true);
|
||||
vbox->show_all();
|
||||
vbox->show_all ();
|
||||
}
|
||||
|
||||
VirtualKeyboardWindow::~VirtualKeyboardWindow ()
|
||||
@ -256,7 +255,7 @@ VirtualKeyboardWindow::set_session (ARDOUR::Session* s)
|
||||
return;
|
||||
}
|
||||
|
||||
XMLNode* node = _session->instant_xml(X_("VirtualKeyboard"));
|
||||
XMLNode* node = _session->instant_xml (X_("VirtualKeyboard"));
|
||||
if (node) {
|
||||
set_state (*node);
|
||||
}
|
||||
@ -266,10 +265,10 @@ XMLNode&
|
||||
VirtualKeyboardWindow::get_state ()
|
||||
{
|
||||
XMLNode* node = new XMLNode (X_("VirtualKeyboard"));
|
||||
node->set_property (X_("YAxisVelocity"), _yaxis_velocity.get_active());
|
||||
node->set_property (X_("HighlightGrandPiano"), _highlight_grand_piano.get_active());
|
||||
node->set_property (X_("HighlightKeyRange"), _highlight_key_range.get_active());
|
||||
node->set_property (X_("ShowNoteLabel"), _show_note_label.get_active());
|
||||
node->set_property (X_("YAxisVelocity"), _yaxis_velocity.get_active ());
|
||||
node->set_property (X_("HighlightGrandPiano"), _highlight_grand_piano.get_active ());
|
||||
node->set_property (X_("HighlightKeyRange"), _highlight_key_range.get_active ());
|
||||
node->set_property (X_("ShowNoteLabel"), _show_note_label.get_active ());
|
||||
node->set_property (X_("Layout"), _keyboard_layout.get_text ());
|
||||
node->set_property (X_("Channel"), _piano_channel.get_value_as_int ());
|
||||
node->set_property (X_("MinVelocity"), _piano_min_velocity.get_value_as_int ());
|
||||
@ -280,23 +279,23 @@ VirtualKeyboardWindow::get_state ()
|
||||
for (int i = 0; i < VKBD_NCTRLS; ++i) {
|
||||
char buf[16];
|
||||
sprintf (buf, "CC-%d", i);
|
||||
node->set_property (buf, _cc_key[i].get_text());
|
||||
node->set_property (buf, _cc_key[i].get_text ());
|
||||
}
|
||||
return *node;
|
||||
}
|
||||
|
||||
void
|
||||
VirtualKeyboardWindow::set_state (const XMLNode &root)
|
||||
VirtualKeyboardWindow::set_state (const XMLNode& root)
|
||||
{
|
||||
if (root.name() != "VirtualKeyboard") {
|
||||
if (root.name () != "VirtualKeyboard") {
|
||||
return;
|
||||
}
|
||||
|
||||
XMLNode const* node = &root;
|
||||
|
||||
std::string layout;
|
||||
if (node->get_property(X_("Layout"), layout)) {
|
||||
piano_keyboard_set_keyboard_layout (_piano, layout.c_str());
|
||||
if (node->get_property (X_("Layout"), layout)) {
|
||||
piano_keyboard_set_keyboard_layout (_piano, layout.c_str ());
|
||||
_keyboard_layout.set_active (layout);
|
||||
}
|
||||
|
||||
@ -304,45 +303,45 @@ VirtualKeyboardWindow::set_state (const XMLNode &root)
|
||||
char buf[16];
|
||||
sprintf (buf, "CC-%d", i);
|
||||
std::string cckey;
|
||||
if (node->get_property(buf, cckey)) {
|
||||
if (node->get_property (buf, cckey)) {
|
||||
_cc_key[i].set_active (cckey);
|
||||
}
|
||||
}
|
||||
|
||||
bool a;
|
||||
if (node->get_property(X_("YAxisVelocity"), a)) {
|
||||
if (node->get_property (X_("YAxisVelocity"), a)) {
|
||||
_yaxis_velocity.set_active (a);
|
||||
}
|
||||
if (node->get_property(X_("HighlightGrandPiano"), a)) {
|
||||
if (node->get_property (X_("HighlightGrandPiano"), a)) {
|
||||
_highlight_grand_piano.set_active (a);
|
||||
piano_keyboard_set_grand_piano_highlight (_piano, a);
|
||||
}
|
||||
if (node->get_property(X_("HighlightKeyRange"), a)) {
|
||||
if (node->get_property (X_("HighlightKeyRange"), a)) {
|
||||
_highlight_key_range.set_active (a);
|
||||
piano_keyboard_set_keyboard_cue (_piano, a);
|
||||
}
|
||||
if (node->get_property(X_("ShowNoteLabel"), a)) {
|
||||
if (node->get_property (X_("ShowNoteLabel"), a)) {
|
||||
_show_note_label.set_active (a);
|
||||
piano_keyboard_show_note_label (_piano, a);
|
||||
}
|
||||
|
||||
int v;
|
||||
if (node->get_property(X_("Channel"), v)) {
|
||||
if (node->get_property (X_("Channel"), v)) {
|
||||
_piano_channel.set_value (v);
|
||||
}
|
||||
if (node->get_property(X_("MinVelocity"), v)) {
|
||||
if (node->get_property (X_("MinVelocity"), v)) {
|
||||
_piano_min_velocity.set_value (v);
|
||||
}
|
||||
if (node->get_property(X_("MaxVelocity"), v)) {
|
||||
if (node->get_property (X_("MaxVelocity"), v)) {
|
||||
_piano_max_velocity.set_value (v);
|
||||
}
|
||||
if (node->get_property(X_("KeyVelocity"), v)) {
|
||||
if (node->get_property (X_("KeyVelocity"), v)) {
|
||||
_piano_key_velocity.set_value (v);
|
||||
}
|
||||
if (node->get_property(X_("Octave"), v)) {
|
||||
if (node->get_property (X_("Octave"), v)) {
|
||||
_piano_octave_key.set_value (v);
|
||||
}
|
||||
if (node->get_property(X_("Range"), v)) {
|
||||
if (node->get_property (X_("Range"), v)) {
|
||||
_piano_octave_range.set_value (v);
|
||||
}
|
||||
|
||||
@ -355,7 +354,7 @@ void
|
||||
VirtualKeyboardWindow::on_unmap ()
|
||||
{
|
||||
ArdourWindow::on_unmap ();
|
||||
ARDOUR_UI::instance()->reset_focus (this);
|
||||
ARDOUR_UI::instance ()->reset_focus (this);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -367,14 +366,14 @@ VirtualKeyboardWindow::on_key_press_event (GdkEventKey* ev)
|
||||
void
|
||||
VirtualKeyboardWindow::select_keyboard_layout (std::string const& l)
|
||||
{
|
||||
piano_keyboard_set_keyboard_layout (_piano, l.c_str());
|
||||
piano_keyboard_set_keyboard_layout (_piano, l.c_str ());
|
||||
_keyboard_layout.set_active (l);
|
||||
}
|
||||
|
||||
bool
|
||||
VirtualKeyboardWindow::toggle_config (GdkEventButton* ev)
|
||||
{
|
||||
bool a = ! _cfg_display.get_active ();
|
||||
bool a = !_cfg_display.get_active ();
|
||||
_cfg_display.set_active (a);
|
||||
if (a) {
|
||||
_cfg_box->show ();
|
||||
@ -387,7 +386,7 @@ VirtualKeyboardWindow::toggle_config (GdkEventButton* ev)
|
||||
bool
|
||||
VirtualKeyboardWindow::toggle_bankpatch (GdkEventButton*)
|
||||
{
|
||||
bool a = ! _pgm_display.get_active ();
|
||||
bool a = !_pgm_display.get_active ();
|
||||
_pgm_display.set_active (a);
|
||||
if (a) {
|
||||
_pgm_box->show ();
|
||||
@ -420,7 +419,7 @@ VirtualKeyboardWindow::toggle_yaxis_velocity (GdkEventButton*)
|
||||
bool
|
||||
VirtualKeyboardWindow::toggle_highlight_piano (GdkEventButton*)
|
||||
{
|
||||
bool a = ! _highlight_grand_piano.get_active ();
|
||||
bool a = !_highlight_grand_piano.get_active ();
|
||||
_highlight_grand_piano.set_active (a);
|
||||
piano_keyboard_set_grand_piano_highlight (_piano, a);
|
||||
return false;
|
||||
@ -429,7 +428,7 @@ VirtualKeyboardWindow::toggle_highlight_piano (GdkEventButton*)
|
||||
bool
|
||||
VirtualKeyboardWindow::toggle_highlight_key (GdkEventButton*)
|
||||
{
|
||||
bool a = ! _highlight_key_range.get_active ();
|
||||
bool a = !_highlight_key_range.get_active ();
|
||||
_highlight_key_range.set_active (a);
|
||||
piano_keyboard_set_keyboard_cue (_piano, a);
|
||||
return false;
|
||||
@ -438,7 +437,7 @@ VirtualKeyboardWindow::toggle_highlight_key (GdkEventButton*)
|
||||
bool
|
||||
VirtualKeyboardWindow::toggle_note_label (GdkEventButton*)
|
||||
{
|
||||
bool a = ! _show_note_label.get_active ();
|
||||
bool a = !_show_note_label.get_active ();
|
||||
_show_note_label.set_active (a);
|
||||
piano_keyboard_show_note_label (_piano, a);
|
||||
return false;
|
||||
@ -452,11 +451,11 @@ VirtualKeyboardWindow::send_panic_message (GdkEventButton*)
|
||||
ev[0] = MIDI_CMD_CONTROL | channel;
|
||||
ev[1] = MIDI_CTL_SUSTAIN;
|
||||
ev[2] = 0;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
ev[1] = MIDI_CTL_ALL_NOTES_OFF;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
ev[1] = MIDI_CTL_RESET_CONTROLLERS;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -472,13 +471,13 @@ VirtualKeyboardWindow::bank_patch ()
|
||||
ev[0] = MIDI_CMD_CONTROL | channel;
|
||||
ev[1] = MIDI_CTL_MSB_BANK;
|
||||
ev[2] = (msb >> 7) & 0x7f;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
ev[1] = MIDI_CTL_LSB_BANK | channel;
|
||||
ev[2] = lsb & 0x7f;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
ev[0] = MIDI_CMD_PGM_CHANGE | channel;
|
||||
ev[1] = pgm & 0x7f;
|
||||
_session->vkbd_output_port()->write (ev, 2, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 2, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -496,16 +495,14 @@ VirtualKeyboardWindow::update_velocity_settings (int ctrl)
|
||||
|
||||
if (_yaxis_velocity.get_active ()) {
|
||||
piano_keyboard_set_velocities (_piano,
|
||||
_piano_min_velocity.get_value_as_int (),
|
||||
_piano_max_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int ()
|
||||
);
|
||||
_piano_min_velocity.get_value_as_int (),
|
||||
_piano_max_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int ());
|
||||
} else {
|
||||
piano_keyboard_set_velocities (_piano,
|
||||
_piano_key_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int ()
|
||||
);
|
||||
_piano_key_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int (),
|
||||
_piano_key_velocity.get_value_as_int ());
|
||||
}
|
||||
update_sensitivity ();
|
||||
}
|
||||
@ -523,11 +520,10 @@ VirtualKeyboardWindow::pitch_slider_adjusted ()
|
||||
{
|
||||
_pitchbend->set_value (_pitch_adjustment.get_value (), PBD::Controllable::NoGroup);
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "Pitchbend: %.0f", _pitch_adjustment.get_value());
|
||||
snprintf (buf, sizeof (buf), "Pitchbend: %.0f", _pitch_adjustment.get_value ());
|
||||
_pitch_slider_tooltip->set_tip (buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VirtualKeyboardWindow::note_on_event_handler (int note, int velocity)
|
||||
{
|
||||
@ -540,7 +536,7 @@ VirtualKeyboardWindow::note_on_event_handler (int note, int velocity)
|
||||
ev[0] = MIDI_CMD_NOTE_ON | channel;
|
||||
ev[1] = note;
|
||||
ev[2] = velocity;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -555,7 +551,7 @@ VirtualKeyboardWindow::note_off_event_handler (int note)
|
||||
ev[0] = MIDI_CMD_NOTE_OFF | channel;
|
||||
ev[1] = note;
|
||||
ev[2] = 0;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -565,14 +561,14 @@ VirtualKeyboardWindow::control_change_event_handler (int key, int val)
|
||||
return;
|
||||
}
|
||||
assert (key >= 0 && key < VKBD_NCTRLS);
|
||||
int ctrl = PBD::atoi (_cc_key[key].get_text());
|
||||
int ctrl = PBD::atoi (_cc_key[key].get_text ());
|
||||
assert (ctrl > 0 && ctrl < 127);
|
||||
uint8_t channel = _piano_channel.get_value_as_int () - 1;
|
||||
uint8_t ev[3];
|
||||
ev[0] = MIDI_CMD_CONTROL | channel;
|
||||
ev[1] = ctrl;
|
||||
ev[2] = val;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -586,5 +582,5 @@ VirtualKeyboardWindow::pitch_bend_event_handler (int val)
|
||||
ev[0] = MIDI_CMD_BENDER | channel;
|
||||
ev[1] = val & 0x7f;
|
||||
ev[2] = (val >> 7) & 0x7f;
|
||||
_session->vkbd_output_port()->write (ev, 3, 0);
|
||||
_session->vkbd_output_port ()->write (ev, 3, 0);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/spinbutton.h>
|
||||
|
||||
#include "pbd/signals.h"
|
||||
#include "pbd/controllable.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "gtkmm2ext/persistent_tooltip.h"
|
||||
|
||||
@ -39,10 +39,11 @@ namespace ARDOUR {
|
||||
class Session;
|
||||
}
|
||||
|
||||
class VKBDControl : public PBD::Controllable {
|
||||
class VKBDControl : public PBD::Controllable
|
||||
{
|
||||
public:
|
||||
VKBDControl (const std::string& name, double normal = 127, double upper = 127)
|
||||
: PBD::Controllable (name, Flag(0))
|
||||
: PBD::Controllable (name, Flag (0))
|
||||
, _lower (0)
|
||||
, _upper (upper)
|
||||
, _normal (normal)
|
||||
@ -50,25 +51,23 @@ public:
|
||||
{}
|
||||
|
||||
/* Controllable API */
|
||||
void set_value (double v, PBD::Controllable::GroupControlDisposition gcd) {
|
||||
void set_value (double v, PBD::Controllable::GroupControlDisposition gcd)
|
||||
{
|
||||
if (v != _value) {
|
||||
_value = std::max (_lower, std::min (_upper, v));
|
||||
Changed (true, gcd); /* EMIT SIGNAL */
|
||||
Changed (true, gcd); /* EMIT SIGNAL */
|
||||
ValueChanged ((int)_value); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
||||
double get_value () const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
std::string get_user_string () const
|
||||
{
|
||||
char buf[32];
|
||||
sprintf (buf, "%.0f", get_value());
|
||||
return std::string(buf);
|
||||
sprintf (buf, "%.0f", get_value ());
|
||||
return std::string (buf);
|
||||
}
|
||||
|
||||
double get_value () const { return _value; }
|
||||
double lower () const { return _lower; }
|
||||
double upper () const { return _upper; }
|
||||
double normal () const { return _normal; }
|
||||
@ -82,7 +81,6 @@ protected:
|
||||
double _value;
|
||||
};
|
||||
|
||||
|
||||
class VirtualKeyboardWindow : public ArdourWindow
|
||||
{
|
||||
public:
|
||||
@ -92,23 +90,23 @@ public:
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
XMLNode& get_state ();
|
||||
void set_state (const XMLNode &);
|
||||
void set_state (const XMLNode&);
|
||||
|
||||
private:
|
||||
static void _note_on_event_handler (GtkWidget*, int note, int vel, gpointer arg)
|
||||
{
|
||||
static_cast<VirtualKeyboardWindow*>(arg)->note_on_event_handler(note, vel);
|
||||
static_cast<VirtualKeyboardWindow*> (arg)->note_on_event_handler (note, vel);
|
||||
}
|
||||
|
||||
static void _note_off_event_handler (GtkWidget*, int note, gpointer arg)
|
||||
static void _note_off_event_handler (GtkWidget*, int note, gpointer arg)
|
||||
{
|
||||
static_cast<VirtualKeyboardWindow*>(arg)->note_off_event_handler(note);
|
||||
static_cast<VirtualKeyboardWindow*> (arg)->note_off_event_handler (note);
|
||||
}
|
||||
|
||||
void on_unmap ();
|
||||
bool on_key_press_event (GdkEventKey*);
|
||||
|
||||
void note_on_event_handler (int, int);
|
||||
void note_on_event_handler (int, int);
|
||||
void note_off_event_handler (int);
|
||||
void control_change_event_handler (int, int);
|
||||
void pitch_bend_event_handler (int);
|
||||
|
Loading…
Reference in New Issue
Block a user