drumstick 2.6.1
pianokeybd.cpp
Go to the documentation of this file.
1/*
2 Virtual Piano Widget for Qt5
3 Copyright (C) 2008-2022, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#include <QApplication>
21#include "pianoscene.h"
22
34namespace drumstick { namespace widgets {
35
40 {Qt::Key_Z, 12},
41 {Qt::Key_S, 13},
42 {Qt::Key_X, 14},
43 {Qt::Key_D, 15},
44 {Qt::Key_C, 16},
45 {Qt::Key_V, 17},
46 {Qt::Key_G, 18},
47 {Qt::Key_B, 19},
48 {Qt::Key_H, 20},
49 {Qt::Key_N, 21},
50 {Qt::Key_J, 22},
51 {Qt::Key_M, 23},
52 {Qt::Key_Q, 24},
53 {Qt::Key_2, 25},
54 {Qt::Key_W, 26},
55 {Qt::Key_3, 27},
56 {Qt::Key_E, 28},
57 {Qt::Key_R, 29},
58 {Qt::Key_5, 30},
59 {Qt::Key_T, 31},
60 {Qt::Key_6, 32},
61 {Qt::Key_Y, 33},
62 {Qt::Key_7, 34},
63 {Qt::Key_U, 35},
64 {Qt::Key_I, 36},
65 {Qt::Key_9, 37},
66 {Qt::Key_O, 38},
67 {Qt::Key_0, 39},
68 {Qt::Key_P, 40}
69};
70
75#if defined(Q_OS_LINUX)
76 {94, 11},
77 {52, 12},
78 {39, 13},
79 {53, 14},
80 {40, 15},
81 {54, 16},
82 {55, 17},
83 {42, 18},
84 {56, 19},
85 {43, 20},
86 {57, 21},
87 {44, 22},
88 {58, 23},
89 {59, 24},
90 {46, 25},
91 {60, 26},
92 {47, 27},
93 {61, 28},
94
95 {24, 29},
96 {11, 30},
97 {25, 31},
98 {12, 32},
99 {26, 33},
100 {13, 34},
101 {27, 35},
102 {28, 36},
103 {15, 37},
104 {29, 38},
105 {16, 39},
106 {30, 40},
107 {31, 41},
108 {18, 42},
109 {32, 43},
110 {19, 44},
111 {33, 45},
112 {20, 46},
113 {34, 47},
114 {35, 48}
115#endif
116
117#if defined(Q_OS_WIN)
118 {86, 11},
119 {44, 12},
120 {31, 13},
121 {45, 14},
122 {32, 15},
123 {46, 16},
124 {47, 17},
125 {34, 18},
126 {48, 19},
127 {35, 20},
128 {49, 21},
129 {36, 22},
130 {50, 23},
131 {51, 24},
132 {38, 25},
133 {52, 26},
134 {39, 27},
135 {53, 28},
136
137 {16, 29},
138 {3, 30},
139 {17, 31},
140 {4, 32},
141 {18, 33},
142 {5, 34},
143 {19, 35},
144 {20, 36},
145 {7, 37},
146 {21, 38},
147 {8, 39},
148 {22, 40},
149 {23, 41},
150 {10, 42},
151 {24, 43},
152 {11, 44},
153 {25, 45},
154 {12, 46},
155 {26, 47},
156 {27, 48}
157#endif
158
159#if defined(Q_OS_MAC)
160 {50, 11},
161 {6, 12},
162 {1, 13},
163 {7, 14},
164 {2, 15},
165 {8, 16},
166 {9, 17},
167 {5, 18},
168 {11, 19},
169 {4, 20},
170 {45, 21},
171 {38, 22},
172 {46, 23},
173 {43, 24},
174 {37, 25},
175 {47, 26},
176 {41, 27},
177 {44, 28},
178
179 {12, 29},
180 {19, 30},
181 {13, 31},
182 {20, 32},
183 {14, 33},
184 {21, 34},
185 {15, 35},
186 {17, 36},
187 {22, 37},
188 {16, 38},
189 {26, 39},
190 {32, 40},
191 {34, 41},
192 {25, 42},
193 {31, 43},
194 {29, 44},
195 {35, 45},
196 {27, 46},
197 {33, 47},
198 {30, 48}
199#endif
200};
201
202class PianoKeybd::PianoKeybdPrivate {
203public:
204 PianoKeybdPrivate(): m_rotation(0), m_scene(nullptr), m_rawMap(nullptr)
205 { }
206 ~PianoKeybdPrivate() = default;
207
208 int m_rotation;
209 PianoScene *m_scene;
210 KeyboardMap *m_rawMap;
211};
212
220PianoKeybd::PianoKeybd(QWidget *parent)
221 : QGraphicsView(parent), d(new PianoKeybdPrivate())
222{
223 initialize();
225}
226
235PianoKeybd::PianoKeybd(const int baseOctave, const int numKeys, const int startKey, QWidget *parent)
236 : QGraphicsView(parent), d(new PianoKeybdPrivate)
237{
238 initialize();
239 initScene(baseOctave, numKeys, startKey);
240}
241
246{
247 d->m_scene->setRawKeyboardMode(false);
248 setKeyboardMap(nullptr);
249}
250
259{
260 return d->m_scene->getPianoHandler();
261}
262
272{
273 d->m_scene->setPianoHandler(handler);
274}
275
281{
282 return d->m_scene->getHighlightPalette();
283}
284
292{
293 d->m_scene->setHighlightPalette(p);
294}
295
301{
302 return d->m_scene->getBackgroundPalette();
303}
304
310{
311 d->m_scene->setBackgroundPalette(p);
312}
313
320{
321 return d->m_scene->getForegroundPalette();
322}
323
330{
331 d->m_scene->setForegroundPalette(p);
332}
333
339{
340 return d->m_scene->showColorScale();
341}
342
347void PianoKeybd::setShowColorScale(const bool show)
348{
349 d->m_scene->setShowColorScale(show);
350}
351
361void PianoKeybd::useCustomNoteNames(const QStringList &names)
362{
363 d->m_scene->useCustomNoteNames(names);
364}
365
371{
372 d->m_scene->useStandardNoteNames();
373}
374
380{
381 return d->m_scene->customNoteNames();
382}
383
389{
390 return d->m_scene->standardNoteNames();
391}
392
399{
400 d->m_scene->retranslate();
401}
402
410void PianoKeybd::initScene(int base, int num, int strt, const QColor& c)
411{
412 d->m_scene = new PianoScene(base, num, strt, c, this);
413 d->m_scene->setKeyboardMap(&g_DefaultKeyMap);
414 connect(d->m_scene, &PianoScene::noteOn, this, &PianoKeybd::noteOn);
415 connect(d->m_scene, &PianoScene::noteOff, this, &PianoKeybd::noteOff);
416 connect(d->m_scene, &PianoScene::signalName, this, &PianoKeybd::signalName);
417 setScene(d->m_scene);
418}
419
425{
426 setAttribute(Qt::WA_AcceptTouchEvents);
427 setAttribute(Qt::WA_InputMethodEnabled, false);
428 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
429 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
430 setViewportUpdateMode(MinimalViewportUpdate);
431 setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform);
432#if (QT_VERSION < QT_VERSION_CHECK(5,15,0))
433 setOptimizationFlag(DontClipPainter, true);
434#endif
435 setOptimizationFlag(DontSavePainterState, true);
436 setOptimizationFlag(DontAdjustForAntialiasing, true);
437}
438
444void PianoKeybd::resizeEvent(QResizeEvent *event)
445{
446 QGraphicsView::resizeEvent(event);
447 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
448}
449
457{
458#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
459 static const auto touchScreen = QTouchDevice::DeviceType::TouchScreen;
460#else
461 static const auto touchScreen = QInputDevice::DeviceType::TouchScreen;
462#endif
463 switch(ev->type()) {
464 case QEvent::TouchBegin:
465 case QEvent::TouchUpdate:
466 case QEvent::TouchEnd:
467 case QEvent::TouchCancel:
468 {
469 //qDebug() << Q_FUNC_INFO << ev->type();
470 QTouchEvent *touchEvent = static_cast<QTouchEvent*>(ev);
471 if (isTouchEnabled() && (touchEvent->device()->type() == touchScreen)) {
472 return d->m_scene->touchScreenEvent(touchEvent);
473 }
474 break;
475 }
476 default:
477 break;
478 }
479 return QGraphicsView::viewportEvent(ev);
480}
481
488void PianoKeybd::setNumKeys(const int numKeys, const int startKey)
489{
490 //qDebug() << Q_FUNC_INFO << numKeys << startKey;
491 if ( numKeys != d->m_scene->numKeys() || startKey != d->m_scene->startKey() )
492 {
493 QByteArray dataBuffer;
494 int baseOctave = d->m_scene->baseOctave();
495 QColor color = d->m_scene->getKeyPressedColor();
496 PianoHandler* handler = d->m_scene->getPianoHandler();
497 KeyboardMap* keyMap = d->m_scene->getKeyboardMap();
498 d->m_scene->saveData(dataBuffer);
499 delete d->m_scene;
500 initScene(baseOctave, numKeys, startKey, color);
501 d->m_scene->loadData(dataBuffer);
502 d->m_scene->setPianoHandler(handler);
503 d->m_scene->setKeyboardMap(keyMap);
504 d->m_scene->hideOrShowKeys();
505 d->m_scene->refreshKeys();
506 d->m_scene->refreshLabels();
507 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
508 }
509}
510
516{
517 if (r != d->m_rotation) {
518 d->m_rotation = r;
519 resetTransform();
520 rotate(d->m_rotation);
521 fitInView(d->m_scene->sceneRect(), Qt::KeepAspectRatio);
522 }
523}
524
530{
531 return mapFromScene(sceneRect()).boundingRect().size();
532}
533
534// RAWKBD_SUPPORT
536{
537 if (d->m_scene->isKeyboardEnabled() && d->m_rawMap != nullptr && d->m_rawMap->contains(keycode)) {
538 d->m_scene->keyOn(d->m_rawMap->value(keycode));
539 return true;
540 }
541 return false;
542}
543
545{
546 if (d->m_scene->isKeyboardEnabled() && d->m_rawMap != nullptr && d->m_rawMap->contains(keycode)) {
547 d->m_scene->keyOff(d->m_rawMap->value(keycode));
548 return true;
549 }
550 return false;
551}
552
559void PianoKeybd::setKeyPicture(const bool natural, const QPixmap &pix)
560{
561 d->m_scene->setKeyPicture(natural, pix);
562}
563
569QPixmap PianoKeybd::getKeyPicture(const bool natural)
570{
571 return d->m_scene->getKeyPicture(natural);
572}
573
578void PianoKeybd::setUseKeyPictures(const bool enable)
579{
580 d->m_scene->setUseKeyPictures(enable);
581}
582
588{
589 return d->m_scene->getUseKeyPictures();
590}
591
602void PianoKeybd::setUsingNativeFilter(const bool newState)
603{
604 d->m_scene->setUsingNativeFilter( newState );
605}
606
615{
616 return d->m_scene->isUsingNativeFilter();
617}
618
624int PianoKeybd::baseOctave() const
625{
626 return d->m_scene->baseOctave();
627}
628
633void PianoKeybd::setBaseOctave(const int baseOctave)
634{
635 d->m_scene->setBaseOctave(baseOctave);
636}
637
643int PianoKeybd::numKeys() const
644{
645 return d->m_scene->numKeys();
646}
647
653{
654 return d->m_scene->startKey();
655}
656
662{
663 return d->m_rotation;
664}
665
671{
672 return d->m_scene->getKeyPressedColor();
673}
674
682{
683 d->m_scene->setKeyPressedColor(c);
684}
685
690{
691 d->m_scene->resetKeyPressedColor();
692}
693
699LabelVisibility PianoKeybd::showLabels() const
700{
701 return d->m_scene->showLabels();
702}
703
710{
711 d->m_scene->setShowLabels(show);
712}
713
720{
721 return d->m_scene->alterations();
722}
723
730{
731 d->m_scene->setAlterations(use);
732}
733
739LabelOrientation PianoKeybd::labelOrientation() const
740{
741 return d->m_scene->getOrientation();
742}
743
750{
751 d->m_scene->setOrientation(orientation);
752}
753
759LabelCentralOctave PianoKeybd::labelOctave() const
760{
761 return d->m_scene->getOctave();
762}
763
770{
771 d->m_scene->setOctave(octave);
772}
773
780{
781 return d->m_scene->getTranspose();
782}
783
790{
791 d->m_scene->setTranspose(t);
792}
793
799{
800 return d->m_scene->getChannel();
801}
802
807void PianoKeybd::setChannel(const int c)
808{
809 d->m_scene->setChannel(c);
810}
811
818{
819 return d->m_scene->getVelocity();
820}
821
827void PianoKeybd::setVelocity(const int v)
828{
829 d->m_scene->setVelocity(v);
830}
831
837{
838 return d->m_scene->isKeyboardEnabled();
839}
840
845void PianoKeybd::setKeyboardEnabled(const bool enable)
846{
847 d->m_scene->setKeyboardEnabled(enable);
848}
849
855{
856 return d->m_scene->isMouseEnabled();
857}
858
863void PianoKeybd::setMouseEnabled(const bool enable)
864{
865 d->m_scene->setMouseEnabled(enable);
866}
867
873{
874 return d->m_scene->isTouchEnabled();
875}
876
881void PianoKeybd::setTouchEnabled(const bool enable)
882{
883 d->m_scene->setTouchEnabled(enable);
884}
885
891{
892 return d->m_scene->velocityTint();
893}
894
899void PianoKeybd::setVelocityTint(const bool enable)
900{
901 //qDebug() << Q_FUNC_INFO << enable;
902 d->m_scene->setVelocityTint(enable);
903}
904
909{
910 d->m_scene->allKeysOff();
911}
912
918{
919 d->m_scene->setKeyboardMap(m);
920}
921
927{
928 return d->m_scene->getKeyboardMap();
929}
930
935{
936 d->m_rawMap = &g_DefaultRawKeyMap;
937 d->m_scene->setKeyboardMap(&g_DefaultRawKeyMap);
938}
939
945{
946 return d->m_scene->getRawKeyboardMode();
947}
948
954{
955 d->m_scene->setRawKeyboardMode(b);
956}
957
962{
963 d->m_scene->setKeyboardMap(&g_DefaultKeyMap);
964}
965
971{
972 d->m_rawMap = m;
973 d->m_scene->setKeyboardMap(m);
974}
975
981{
982 return d->m_rawMap;
983}
984
991void PianoKeybd::showNoteOn(const int note, QColor color, int vel)
992{
993 d->m_scene->showNoteOn(note, color, vel);
994}
995
1001void PianoKeybd::showNoteOn(const int note, int vel)
1002{
1003 d->m_scene->showNoteOn(note, vel);
1004}
1005
1011void PianoKeybd::showNoteOff(const int note, int vel)
1012{
1013 d->m_scene->showNoteOff(note, vel);
1014}
1015
1020void PianoKeybd::setFont(const QFont &font)
1021{
1022 QWidget::setFont(font);
1023 d->m_scene->setFont(font);
1024 d->m_scene->refreshLabels();
1025}
1026
1027} // namespace widgets
1028} // namespace drumstick
The QEvent class is the base class of all event classes.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
The PianoHandler class callbacks.
Definition: pianokeybd.h:72
void initScene(int base, int num, int ini, const QColor &c=QColor())
Creates and initializes a new PianoScene instance and assigns it to this widget.
Definition: pianokeybd.cpp:410
void allKeysOff()
Forces all active notes to silence.
Definition: pianokeybd.cpp:908
virtual ~PianoKeybd()
Destructor.
Definition: pianokeybd.cpp:245
void resetKeyPressedColor()
Assigns the default highlight palette colors and assigns it to the scene.
Definition: pianokeybd.cpp:689
bool handleKeyReleased(int keycode) override
handleKeyReleased handles low level computer keyboard reelase events
Definition: pianokeybd.cpp:544
void setNumKeys(const int numKeys, const int startKey=DEFAULTSTARTINGKEY)
This method changes the number of displayed keys and the starting key number, keeping the other setti...
Definition: pianokeybd.cpp:488
PianoKeybd(QWidget *parent=nullptr)
Constructor.
Definition: pianokeybd.cpp:220
void setBackgroundPalette(const PianoPalette &p)
Assigns the palette used to paint the keys' background.
Definition: pianokeybd.cpp:309
void setRawKeyboardMode(const bool b)
Enables or disables the low level computer keyboard mode.
Definition: pianokeybd.cpp:953
void setFont(const QFont &font)
Assigns a typographic font for drawing the note labels over the piano keys.
void initialize()
This method is called from the available constructors to initialize some widget attributes,...
Definition: pianokeybd.cpp:424
QSize sizeHint() const override
Overrides QGraphicsView::sizeHint() providing a size value based on the piano scene.
Definition: pianokeybd.cpp:529
void useStandardNoteNames()
Disables the custom note names usage as labels over the keys, and restores the standard note names in...
Definition: pianokeybd.cpp:370
bool isKeyboardEnabled() const
Returns whether the computer keyboard is enabled.
Definition: pianokeybd.cpp:836
void resetKeyboardMap()
Resets the low level computer keyboard note map to the default one.
Definition: pianokeybd.cpp:961
void setKeyPressedColor(const QColor &c)
Assigns a single color for key highlight.
Definition: pianokeybd.cpp:681
void setChannel(const int c)
Assigns the MIDI Channel (0-15).
Definition: pianokeybd.cpp:807
PianoPalette getForegroundPalette() const
Returns the palette used to paint texts over the keys like the note names or custom labels.
Definition: pianokeybd.cpp:319
bool getUseKeyPictures() const
Returns whether pictures are used to paint the keys.
Definition: pianokeybd.cpp:587
void setHighlightPalette(const PianoPalette &p)
Assigns the palette used for highlighting the played keys.
Definition: pianokeybd.cpp:291
void setShowColorScale(const bool show)
Enables or disables the color scale background palette.
Definition: pianokeybd.cpp:347
void setPianoHandler(PianoHandler *handler)
Assigns a PianoHandler pointer for processing note events.
Definition: pianokeybd.cpp:271
void setLabelOctave(const LabelCentralOctave octave)
Assigns the octave label policy.
Definition: pianokeybd.cpp:769
bool showColorScale() const
Returns true if the color scale background palette is assigned and active.
Definition: pianokeybd.cpp:338
void signalName(const QString &name)
signalName is emitted for each note created, and contains a string with the MIDI note number and the ...
void setKeyboardEnabled(const bool enable)
Enables or disables the computer keyboard note input.
Definition: pianokeybd.cpp:845
KeyboardMap * getRawKeyboardMap()
Returns the low level computer keyboard note map.
Definition: pianokeybd.cpp:980
PianoPalette getBackgroundPalette() const
Returns the palette used to paint the keys' background.
Definition: pianokeybd.cpp:300
bool isUsingNativeFilter() const
Returns whether the application is filtering native events.
Definition: pianokeybd.cpp:614
void setRawKeyboardMap(KeyboardMap *m)
Assigns the low level computer keyboard note map.
Definition: pianokeybd.cpp:970
int getChannel() const
Returns the MIDI Channel (0-15).
Definition: pianokeybd.cpp:798
void setBaseOctave(const int baseOctave)
Assigns the base octave number.
Definition: pianokeybd.cpp:633
void setForegroundPalette(const PianoPalette &p)
Assigns the palette used to paint texts over the keys like the note names or custom labels.
Definition: pianokeybd.cpp:329
void setVelocityTint(const bool enable)
Enables or disables the note MIDI velocity influencing the highlight color tint.
Definition: pianokeybd.cpp:899
void setLabelAlterations(const LabelAlteration use)
Assigns the label alterations policy.
Definition: pianokeybd.cpp:729
void setKeyPicture(const bool natural, const QPixmap &pix)
Assigns a custom picture to the white or black keys that will be used as a texture to paint the keys.
Definition: pianokeybd.cpp:559
bool velocityTint() const
Returns whether the note MIDI velocity influences the highlight color tint.
Definition: pianokeybd.cpp:890
void setUsingNativeFilter(const bool newState)
Enables or disables the application level usage of a native event filter.
Definition: pianokeybd.cpp:602
QColor getKeyPressedColor() const
Returns the key highlight color.
Definition: pianokeybd.cpp:670
void resizeEvent(QResizeEvent *event) override
This method overrides QGraphicsView::resizeEvent() to keep the aspect ratio of the keys scene when th...
Definition: pianokeybd.cpp:444
void noteOff(int midiNote, int vel)
This signal is emitted for each Note Off MIDI event created using the computer keyboard,...
bool handleKeyPressed(int keycode) override
handleKeyPressed handles low level computer keyboard press events
Definition: pianokeybd.cpp:535
void setKeyboardMap(KeyboardMap *m)
Assigns the computer keyboard note map.
Definition: pianokeybd.cpp:917
void showNoteOff(const int note, int vel=-1)
Shows inactive one note key with the specified velocity.
void setShowLabels(const LabelVisibility show)
Assigns the label visibility policy.
Definition: pianokeybd.cpp:709
LabelAlteration labelAlterations() const
Returns the label alterations policy.
Definition: pianokeybd.cpp:719
PianoPalette getHighlightPalette() const
Returns the palette used for highlighting the played keys.
Definition: pianokeybd.cpp:280
QStringList standardNoteNames() const
Returns the list of standard note names.
Definition: pianokeybd.cpp:388
void noteOn(int midiNote, int vel)
This signal is emitted for each Note On MIDI event created using the computer keyboard,...
void resetRawKeyboardMap()
Resets the computer keyboard note map to the default one.
Definition: pianokeybd.cpp:934
PianoHandler * getPianoHandler() const
Gets the PianoHandler pointer to the note receiver.
Definition: pianokeybd.cpp:258
void setLabelOrientation(const LabelOrientation orientation)
Assigns the labels orientation policy.
Definition: pianokeybd.cpp:749
bool isMouseEnabled() const
Returns whether the mouse note input is enabled.
Definition: pianokeybd.cpp:854
bool getRawKeyboardMode() const
Returns the low level computer keyboard note map.
Definition: pianokeybd.cpp:944
void showNoteOn(const int note, QColor color, int vel=-1)
Highlights one note key with the specified color and velocity.
Definition: pianokeybd.cpp:991
void setRotation(int r)
Rotates the keyboard view an angle clockwise.
Definition: pianokeybd.cpp:515
QPixmap getKeyPicture(const bool natural)
Returns the custom picture used to paint the corresponding keys.
Definition: pianokeybd.cpp:569
void retranslate()
Updates the standard names of notes according to the currently active program language translation.
Definition: pianokeybd.cpp:398
int startKey() const
Returns the starting key note: C=0, A=9 and so on.
Definition: pianokeybd.cpp:652
void setTouchEnabled(const bool enable)
Enables or disables the touch screen note input.
Definition: pianokeybd.cpp:881
void useCustomNoteNames(const QStringList &names)
Assigns a list of custom text labels to be displayer over the keys.
Definition: pianokeybd.cpp:361
void setMouseEnabled(const bool enable)
Enables or disables the mouse note input.
Definition: pianokeybd.cpp:863
KeyboardMap * getKeyboardMap()
Returns the computer keyboard note map.
Definition: pianokeybd.cpp:926
void setUseKeyPictures(const bool enable)
Enables or disables a picture to paint the keys.
Definition: pianokeybd.cpp:578
int getRotation() const
Returns the rotation angle in degrees, clockwise, of the piano view.
Definition: pianokeybd.cpp:661
void setTranspose(int t)
Assigns the transpose amount in semitones.
Definition: pianokeybd.cpp:789
QStringList customNoteNames() const
Returns the list of custom note names.
Definition: pianokeybd.cpp:379
int getVelocity() const
Returns the MIDI note velocity.
Definition: pianokeybd.cpp:817
void setVelocity(const int v)
Assigns the MIDI note velocity.
Definition: pianokeybd.cpp:827
bool viewportEvent(QEvent *ev) override
This method overrides QGraphicsView::viewportEvent() Only touchscreen events are processed here.
Definition: pianokeybd.cpp:456
bool isTouchEnabled() const
Returns whether the touch screen note input is enabled.
Definition: pianokeybd.cpp:872
int getTranspose() const
Returns the transpose amount in semitones.
Definition: pianokeybd.cpp:779
The PianoPalette class.
Definition: pianopalette.h:61
The PianoScene class is a QGraphicsScene composed by a number of graphics items: the piano keys.
Definition: pianoscene.h:47
void noteOff(int n, int v)
This signal is emitted for each Note Off MIDI event created using the computer keyboard,...
void signalName(const QString &name)
signalName is emitted for each note created, and contains a string with the MIDI note number and the ...
void noteOn(int n, int v)
This signal is emitted for each Note On MIDI event created using the computer keyboard,...
LabelAlteration
Labels for Alterations.
Definition: pianokeybd.h:118
DRUMSTICK_EXPORT KeyboardMap g_DefaultKeyMap
Global Key Map Variable.
Definition: pianokeybd.cpp:39
LabelCentralOctave
Labels Central Octave.
Definition: pianokeybd.h:145
LabelVisibility
Labels Visibility.
Definition: pianokeybd.h:108
const int DEFAULTNUMBEROFKEYS
Default number of piano keys.
Definition: pianokeybd.h:103
LabelOrientation
Labels Orientation.
Definition: pianokeybd.h:127
const int DEFAULTSTARTINGKEY
Default starting key (A)
Definition: pianokeybd.h:101
QHash< int, int > KeyboardMap
KeyboardMap.
Definition: pianokeybd.h:96
DRUMSTICK_EXPORT KeyboardMap g_DefaultRawKeyMap
Global Raw Key Map Variable.
Definition: pianokeybd.cpp:74
const int DEFAULTBASEOCTAVE
Default base octave.
Definition: pianokeybd.h:102
Drumstick common.
Definition: alsaclient.cpp:68
Piano Keyboard Widget.
PianoScene class declaration.