drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
PianoScene Class Reference

The PianoScene class is a QGraphicsScene composed by a number of graphics items: the piano keys. More...

#include <pianoscene.h>

Inheritance diagram for PianoScene:

Signals

void noteOn (int n, int v)
 This signal is emitted for each Note On MIDI event created using the computer keyboard, mouse or touch screen. More...
 
void noteOff (int n, int v)
 This signal is emitted for each Note Off MIDI event created using the computer keyboard, mouse or touch screen. More...
 
void signalName (const QString &name)
 signalName is emitted for each note created, and contains a string with the MIDI note number and the note name for each note on event. More...
 

Public Member Functions

 PianoScene (const int baseOctave, const int numKeys, const int startKey, const QColor &keyPressedColor=QColor(), QObject *parent=nullptr)
 Constructor. More...
 
 ~PianoScene ()
 Destructor.
 
QSize sizeHint () const
 Returns the calculated size of the scene. More...
 
void setKeyboardMap (KeyboardMap *map)
 Assigns the computer keyboard note map. More...
 
KeyboardMapgetKeyboardMap () const
 Returns the computer keyboard note map. More...
 
PianoHandlergetPianoHandler () const
 Gets the PianoHandler pointer to the note receiver. More...
 
void setPianoHandler (PianoHandler *handler)
 Assigns a PianoHandler pointer for processing note events. More...
 
PianoPalette getHighlightPalette ()
 Returns the palette used for highlighting the played keys. More...
 
void setHighlightPalette (const PianoPalette &p)
 Assigns the active highlight palette. More...
 
PianoPalette getBackgroundPalette ()
 Returns the background palette. More...
 
void setBackgroundPalette (const PianoPalette &p)
 Assigns the active background palette. More...
 
PianoPalette getForegroundPalette ()
 Returns the active foreground palette. More...
 
void setForegroundPalette (const PianoPalette &p)
 Assigns the active foreground palette. More...
 
bool showColorScale () const
 Returns whether the color scale mode is enabled. More...
 
void setShowColorScale (const bool show)
 Enables or disables the color scale key background mode. More...
 
QColor getKeyPressedColor () const
 Returns the single highlight palette color. More...
 
void setKeyPressedColor (const QColor &color)
 Assigns a single color for key highlight. More...
 
void resetKeyPressedColor ()
 Assigns the default highlight palette colors and assigns it to the scene.
 
int getMinNote () const
 Returns the minimum MIDI note number that will be displayed. More...
 
void setMinNote (const int note)
 Assigns the minimum MIDI note number that will be displayed. More...
 
int getMaxNote () const
 Returns the maximum MIDI note number that will be displayed. More...
 
void setMaxNote (const int note)
 Assigns the maximum MIDI note number that will be displayed. More...
 
int getTranspose () const
 Returns the transpose amount in semitones. More...
 
void setTranspose (const int transpose)
 Assigns the transpose amount in semitones. More...
 
LabelVisibility showLabels () const
 Returns the label visibility policy (display note names over the piano keys). More...
 
void setShowLabels (const LabelVisibility show)
 Assigns the label visibility policy to the piano keys. More...
 
LabelAlteration alterations () const
 Returns the alterations name policy. More...
 
void setAlterations (const LabelAlteration use)
 Assigns the alterations name policy. More...
 
LabelCentralOctave getOctave () const
 Returns the central octave name policy. More...
 
void setOrientation (const LabelOrientation orientation)
 Assigns the label orientation policy. More...
 
void setKeyboardEnabled (const bool enable)
 Enables or disables the computer keyboard note generation. More...
 
bool isMouseEnabled () const
 Returns whether the computer keyboard note generation is enabled. More...
 
void setMouseEnabled (const bool enable)
 Enables or disables the mouse note generation. More...
 
bool isTouchEnabled () const
 Returns whether the touch screen note generation is enabled. More...
 
void setTouchEnabled (const bool enable)
 Enables or disables the touch screen note generation. More...
 
bool velocityTint () const
 Returns whether the velocity parameter of note events is used to influence the highlight key colors. More...
 
void setVelocityTint (const bool enable)
 Enables or disables the velocity parameter of note events to influence the highlight key colors. More...
 
bool isOctaveStart (const int note)
 Returns whether the given note number is a octave startup note. More...
 
void showNoteOn (const int note, QColor color, int vel=-1)
 Displays highlighted the corresponding key for a given MIDI note, with a color and MIDI velocity. More...
 
void showNoteOn (const int note, int vel=-1)
 Displays highlighted the corresponding key for a given MIDI note, with MIDI velocity. More...
 
void showNoteOff (const int note, int vel=-1)
 Displays deactivated the corresponding key for a given MIDI note, with MIDI velocity. More...
 
int baseOctave () const
 Returns the base octave number. More...
 
void setBaseOctave (const int base)
 Assigns the octave base number. More...
 
int numKeys () const
 Returns the number of keys that will be displayed. More...
 
int startKey () const
 Returns the first key number that will be displayed. More...
 
void allKeysOff ()
 Deactivates all keys.
 
void keyOn (const int note)
 Produces a MIDI Note On event and highlights the corresponding key for the given MIDI note number. More...
 
void keyOff (const int note)
 Produces a MIDI Note Off event and deactivates the corresponding key for the given MIDI note number. More...
 
bool getRawKeyboardMode () const
 Returns whether the low level computer keyboard mode is enabled. More...
 
void setRawKeyboardMode (const bool b)
 Assigns the low level computer keyboard mode. More...
 
void useCustomNoteNames (const QStringList &names)
 Assigns the list of custom note names, and enables this mode. More...
 
void useStandardNoteNames ()
 Assigns the standard note names, clearing the list of custom note names.
 
QStringList customNoteNames () const
 Returns the custom note names list. More...
 
QStringList standardNoteNames () const
 Returns the standard note names list. More...
 
int getVelocity ()
 Returns the MIDI note velocity parameter that is assigned to the MIDI OUT notes. More...
 
void setVelocity (const int velocity)
 Assigns the MIDI note velocity parameter that is assigned to the MIDI OUT notes. More...
 
int getChannel () const
 Returns the MIDI channel that is assigned to the output events, or used to filter the input events (unless MIDI OMNI mode is enabled). More...
 
void setChannel (const int channel)
 Assigns the MIDI channel that is included into the output events, or used to filter the input events (unless MIDI OMNI mode is enabled). More...
 
void retranslate ()
 Retranslates the standard note names.
 
void refreshLabels ()
 Refresh the visibility and other attributes of the labels shown over the piano keys.
 
void hideOrShowKeys ()
 Hides or shows keys.
 
void refreshKeys ()
 Refresh the background colors of all the piano keys.
 
bool touchScreenEvent (QTouchEvent *touchEvent)
 Process touch screen events, called by the view. More...
 
void setUsingNativeFilter (const bool newState)
 Enables or disables the application level usage of a native event filter. More...
 
bool isUsingNativeFilter () const
 Returns whether the application is filtering native events. More...
 
void setOctaveSubscript (const bool enable)
 Enables or disables the subscript octave designation. More...
 
bool octaveSubscript () const
 Returns whether the subscript octave designation is enabled. More...
 

Protected Member Functions

void showKeyOn (PianoKey *key, QColor color, int vel)
 Displays highlighted the activated key with the supplied color and note velocity. More...
 
void showKeyOn (PianoKey *key, int vel)
 Displays highlighted the activated key with the supplied note velocity. More...
 
void showKeyOff (PianoKey *key, int vel)
 Displays as deactivated a key. More...
 
void displayKeyOn (PianoKey *key)
 Displays the note label over a highligted key. More...
 
void keyOn (PianoKey *key)
 Produces a MIDI Note On event and highlights the given key. More...
 
void keyOff (PianoKey *key)
 Produces a MIDI Note Off event and deactivates the given key. More...
 
void keyOn (PianoKey *key, qreal pressure)
 Produces a MIDI Note On event and highlights the given key with the given pressure. More...
 
void keyOff (PianoKey *key, qreal pressure)
 Produces a MIDI Note Off event and deactivates the given key with the given pressure. More...
 
PianoKey * getKeyForPos (const QPointF &p) const
 Returns the piano key for the given scene point coordenates. More...
 
PianoKey * getPianoKey (const int key) const
 Returns the piano key object corresponding to the given computer keyboard key. More...
 
QString noteName (PianoKey *key)
 Returns the note name string that will be displayed over a given piano key. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse move events for the scene. More...
 
void mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse press events for the scene. More...
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse release events for the scene. More...
 
void keyPressEvent (QKeyEvent *keyEvent) override
 This event handler, for event keyEvent, is reimplemented to receive keypress events. More...
 
void keyReleaseEvent (QKeyEvent *keyEvent) override
 This event handler, for event keyEvent, is reimplemented to receive key release events. More...
 
bool event (QEvent *event) override
 This method overrides QGraphicsScene::event(). More...
 
void triggerNoteOn (const int note, const int vel)
 Performs a Note On MIDI event for the given MIDI note number and velocity. More...
 
void triggerNoteOff (const int note, const int vel)
 Performs a Note Off MIDI event for the given MIDI note number and velocity. More...
 
int getNoteFromKey (const int key) const
 Returns the note number for the given computer keyboard key code. More...
 
void setHighlightColorFromPolicy (PianoKey *key, const int vel)
 Assigns to the given key the highlight color from the active highlight palette and the given MIDI velocity. More...
 

Detailed Description

The PianoScene class is a QGraphicsScene composed by a number of graphics items: the piano keys.

Definition at line 46 of file pianoscene.h.

Constructor & Destructor Documentation

◆ PianoScene()

PianoScene ( const int  baseOctave,
const int  numKeys,
const int  startKey,
const QColor &  keyPressedColor = QColor(),
QObject parent = nullptr 
)

Constructor.

Parameters
baseOctaveoctave base number
numKeysnumber of keys
startKeystarting key
keyPressedColorhighlight keys color
parentowner object

Definition at line 253 of file pianoscene.cpp.

References PianoScene::getKeyPressedColor(), PianoScene::hideOrShowKeys(), PianoScene::retranslate(), and PianoScene::setKeyPressedColor().

Member Function Documentation

◆ alterations()

LabelAlteration alterations ( ) const

Returns the alterations name policy.

See also
LabelAlteration, setAlterations()
Returns
the alterations name policy

Definition at line 1014 of file pianoscene.cpp.

◆ baseOctave()

int baseOctave ( ) const

Returns the base octave number.

See also
setBaseOctave()
Returns
the base octave number

Definition at line 483 of file pianoscene.cpp.

◆ customNoteNames()

QStringList customNoteNames ( ) const

Returns the custom note names list.

Returns
the custom note names list

Definition at line 1109 of file pianoscene.cpp.

◆ displayKeyOn()

void displayKeyOn ( PianoKey *  key)
protected

Displays the note label over a highligted key.

Parameters
keythe activated key

Definition at line 374 of file pianoscene.cpp.

References drumstick::widgets::ShowActivated, and PianoScene::signalName().

Referenced by PianoScene::showKeyOn().

◆ event()

bool event ( QEvent event)
overrideprotected

This method overrides QGraphicsScene::event().

It does not add new logic, but calls the overrided function.

Parameters
eventThe given event
Returns
true if the event was processed

Definition at line 799 of file pianoscene.cpp.

References PianoScene::event().

Referenced by PianoScene::event().

◆ getBackgroundPalette()

PianoPalette getBackgroundPalette ( )

Returns the background palette.

Returns
the background palette

Definition at line 1325 of file pianoscene.cpp.

◆ getChannel()

int getChannel ( ) const

Returns the MIDI channel that is assigned to the output events, or used to filter the input events (unless MIDI OMNI mode is enabled).

Returns
the MIDI channel

Definition at line 1146 of file pianoscene.cpp.

◆ getForegroundPalette()

PianoPalette getForegroundPalette ( )

Returns the active foreground palette.

Returns
the active foreground palette

Definition at line 1347 of file pianoscene.cpp.

◆ getHighlightPalette()

PianoPalette getHighlightPalette ( )

Returns the palette used for highlighting the played keys.

Returns
The PianoPalette used to highlight the played keys

Definition at line 365 of file pianoscene.cpp.

◆ getKeyboardMap()

KeyboardMap * getKeyboardMap ( ) const

Returns the computer keyboard note map.

Returns
the computer keyboard note map

Definition at line 331 of file pianoscene.cpp.

◆ getKeyForPos()

PianoKey * getKeyForPos ( const QPointF &  p) const
protected

Returns the piano key for the given scene point coordenates.

Parameters
pThe given scene point coordenates
Returns

Definition at line 641 of file pianoscene.cpp.

Referenced by PianoScene::mouseMoveEvent(), PianoScene::mousePressEvent(), PianoScene::mouseReleaseEvent(), and PianoScene::touchScreenEvent().

◆ getKeyPressedColor()

QColor getKeyPressedColor ( ) const

Returns the single highlight palette color.

Returns
the single highlight palette color

Definition at line 1303 of file pianoscene.cpp.

Referenced by PianoScene::PianoScene(), and PianoScene::resetKeyPressedColor().

◆ getMaxNote()

int getMaxNote ( ) const

Returns the maximum MIDI note number that will be displayed.

Returns
the maximum MIDI note number

Definition at line 881 of file pianoscene.cpp.

◆ getMinNote()

int getMinNote ( ) const

Returns the minimum MIDI note number that will be displayed.

Returns
the minimum MIDI note number

Definition at line 848 of file pianoscene.cpp.

◆ getNoteFromKey()

int getNoteFromKey ( const int  key) const
protected

Returns the note number for the given computer keyboard key code.

Parameters
keyThe given computer keyboard key code
Returns
The note number

Definition at line 714 of file pianoscene.cpp.

Referenced by PianoScene::getPianoKey(), PianoScene::keyPressEvent(), and PianoScene::keyReleaseEvent().

◆ getOctave()

LabelCentralOctave getOctave ( ) const

Returns the central octave name policy.

Returns
the central octave name policy

Definition at line 1036 of file pianoscene.cpp.

◆ getPianoHandler()

PianoHandler * getPianoHandler ( ) const

Gets the PianoHandler pointer to the note receiver.

If this method returns null, then there is not a PianoHandler class assigned, and then the signals noteOn() and noteOff() are emitted instead.

Returns
pointer to the PianoHandler class, if there is one assigned

Definition at line 343 of file pianoscene.cpp.

◆ getPianoKey()

PianoKey * getPianoKey ( const int  key) const
protected

Returns the piano key object corresponding to the given computer keyboard key.

Parameters
keyThe given computer keyboard key
Returns
The Piano Key object pointer

Definition at line 731 of file pianoscene.cpp.

References PianoScene::getNoteFromKey().

◆ getRawKeyboardMode()

bool getRawKeyboardMode ( ) const

Returns whether the low level computer keyboard mode is enabled.

Returns
true if the low level computer keyboard mode is enabled

Definition at line 631 of file pianoscene.cpp.

◆ getTranspose()

int getTranspose ( ) const

Returns the transpose amount in semitones.

Returns
the transpose amount in semitones

Definition at line 902 of file pianoscene.cpp.

◆ getVelocity()

int getVelocity ( )

Returns the MIDI note velocity parameter that is assigned to the MIDI OUT notes.

Returns
the MIDI note velocity

Definition at line 1127 of file pianoscene.cpp.

◆ isMouseEnabled()

bool isMouseEnabled ( ) const

Returns whether the computer keyboard note generation is enabled.

Returns
true if the computer keyboard note generation is enabled

Definition at line 1197 of file pianoscene.cpp.

◆ isOctaveStart()

bool isOctaveStart ( const int  note)

Returns whether the given note number is a octave startup note.

Parameters
noteThe given note number
Returns
true if the given note number is a octave startup note

Definition at line 943 of file pianoscene.cpp.

Referenced by PianoScene::refreshLabels().

◆ isTouchEnabled()

bool isTouchEnabled ( ) const

Returns whether the touch screen note generation is enabled.

Returns
true if the touch screen note generation is enabled

Definition at line 1217 of file pianoscene.cpp.

◆ isUsingNativeFilter()

bool isUsingNativeFilter ( ) const

Returns whether the application is filtering native events.

Returns
true if the application is filtering native events

Definition at line 1564 of file pianoscene.cpp.

◆ keyOff() [1/3]

void keyOff ( const int  note)

Produces a MIDI Note Off event and deactivates the corresponding key for the given MIDI note number.

Parameters
noteThe given MIDI note number

Definition at line 619 of file pianoscene.cpp.

References PianoScene::keyOff(), and PianoScene::triggerNoteOff().

Referenced by PianoScene::keyOff(), PianoScene::keyReleaseEvent(), PianoScene::mouseMoveEvent(), PianoScene::mouseReleaseEvent(), and PianoScene::touchScreenEvent().

◆ keyOff() [2/3]

void keyOff ( PianoKey *  key)
protected

Produces a MIDI Note Off event and deactivates the given key.

Parameters
keyThe given key

Definition at line 573 of file pianoscene.cpp.

References PianoScene::showKeyOff(), and PianoScene::triggerNoteOff().

◆ keyOff() [3/3]

void keyOff ( PianoKey *  key,
qreal  pressure 
)
protected

Produces a MIDI Note Off event and deactivates the given key with the given pressure.

Parameters
keyThe given key
pressureThe applied pressure

Definition at line 596 of file pianoscene.cpp.

References PianoScene::showKeyOff(), and PianoScene::triggerNoteOff().

◆ keyOn() [1/3]

void keyOn ( const int  note)

Produces a MIDI Note On event and highlights the corresponding key for the given MIDI note number.

Parameters
noteThe given MIDI note number

Definition at line 607 of file pianoscene.cpp.

References PianoScene::keyOn(), and PianoScene::triggerNoteOn().

Referenced by PianoScene::keyOn(), PianoScene::keyPressEvent(), PianoScene::mouseMoveEvent(), PianoScene::mousePressEvent(), and PianoScene::touchScreenEvent().

◆ keyOn() [2/3]

void keyOn ( PianoKey *  key)
protected

Produces a MIDI Note On event and highlights the given key.

Parameters
keyThe given key

Definition at line 563 of file pianoscene.cpp.

References PianoScene::showKeyOn(), and PianoScene::triggerNoteOn().

◆ keyOn() [3/3]

void keyOn ( PianoKey *  key,
qreal  pressure 
)
protected

Produces a MIDI Note On event and highlights the given key with the given pressure.

Parameters
keyThe given key
pressureThe applied pressure

Definition at line 584 of file pianoscene.cpp.

References PianoScene::showKeyOn(), and PianoScene::triggerNoteOn().

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  keyEvent)
overrideprotected

This event handler, for event keyEvent, is reimplemented to receive keypress events.

Parameters
keyEventThe computer keyboard pressed event

Definition at line 743 of file pianoscene.cpp.

References PianoScene::getNoteFromKey(), and PianoScene::keyOn().

◆ keyReleaseEvent()

void keyReleaseEvent ( QKeyEvent *  keyEvent)
overrideprotected

This event handler, for event keyEvent, is reimplemented to receive key release events.

Parameters
keyEventThe computer keyboard released event

Definition at line 770 of file pianoscene.cpp.

References PianoScene::getNoteFromKey(), and PianoScene::keyOff().

◆ mouseMoveEvent()

void mouseMoveEvent ( QGraphicsSceneMouseEvent *  mouseEvent)
overrideprotected

This event handler, for event mouseEvent, is reimplemented to receive mouse move events for the scene.

Parameters
mouseEventThe mouse move event object pointer

Definition at line 657 of file pianoscene.cpp.

References PianoScene::getKeyForPos(), PianoScene::keyOff(), and PianoScene::keyOn().

◆ mousePressEvent()

void mousePressEvent ( QGraphicsSceneMouseEvent *  mouseEvent)
overrideprotected

This event handler, for event mouseEvent, is reimplemented to receive mouse press events for the scene.

Parameters
mouseEventThe mouse press event object pointer

Definition at line 679 of file pianoscene.cpp.

References PianoScene::getKeyForPos(), and PianoScene::keyOn().

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QGraphicsSceneMouseEvent *  mouseEvent)
overrideprotected

This event handler, for event mouseEvent, is reimplemented to receive mouse release events for the scene.

Parameters
mouseEventThe mouse release event object pointer

Definition at line 696 of file pianoscene.cpp.

References PianoScene::getKeyForPos(), and PianoScene::keyOff().

◆ noteName()

QString noteName ( PianoKey *  key)
protected

Returns the note name string that will be displayed over a given piano key.

Parameters
keyThe given piano key
Returns
the note name string

Definition at line 953 of file pianoscene.cpp.

◆ noteOff

void noteOff ( int  n,
int  v 
)
signal

This signal is emitted for each Note Off MIDI event created using the computer keyboard, mouse or touch screen.

It is not emitted if a PianoHandler has been assigned using setPianoHandler().

Parameters
nthe MIDI note number
vthe MIDI velocity

Referenced by PianoKeybd::initScene(), and PianoScene::triggerNoteOff().

◆ noteOn

void noteOn ( int  n,
int  v 
)
signal

This signal is emitted for each Note On MIDI event created using the computer keyboard, mouse or touch screen.

It is not emitted if a PianoHandler has been assigned using setPianoHandler().

Parameters
nthe MIDI note number
vthe MIDI velocity

Referenced by PianoKeybd::initScene(), and PianoScene::triggerNoteOn().

◆ numKeys()

int numKeys ( ) const

Returns the number of keys that will be displayed.

Returns
the number of keys

Definition at line 924 of file pianoscene.cpp.

◆ octaveSubscript()

bool octaveSubscript ( ) const

Returns whether the subscript octave designation is enabled.

Returns
true if the subscript octave designation is enabled

Definition at line 1585 of file pianoscene.cpp.

◆ setAlterations()

void setAlterations ( const LabelAlteration  use)

Assigns the alterations name policy.

See also
LabelAlteration, alterations()
Parameters
usethe new alterations name policy

Definition at line 1024 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ setBackgroundPalette()

void setBackgroundPalette ( const PianoPalette p)

Assigns the active background palette.

Parameters
pthe active background palette

Definition at line 1334 of file pianoscene.cpp.

References PianoScene::refreshKeys().

◆ setBaseOctave()

void setBaseOctave ( const int  base)

Assigns the octave base number.

Parameters
basethe octave base number

Definition at line 911 of file pianoscene.cpp.

References PianoScene::hideOrShowKeys(), and PianoScene::refreshLabels().

◆ setChannel()

void setChannel ( const int  channel)

Assigns the MIDI channel that is included into the output events, or used to filter the input events (unless MIDI OMNI mode is enabled).

Parameters
channelthe MIDI channel

Definition at line 1156 of file pianoscene.cpp.

◆ setForegroundPalette()

void setForegroundPalette ( const PianoPalette p)

Assigns the active foreground palette.

Parameters
pthe foreground palette

Definition at line 1356 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ setHighlightColorFromPolicy()

void setHighlightColorFromPolicy ( PianoKey *  key,
const int  vel 
)
protected

Assigns to the given key the highlight color from the active highlight palette and the given MIDI velocity.

Parameters
keyThe given piano key
velThe MIDI note velocity

Definition at line 529 of file pianoscene.cpp.

References drumstick::widgets::PAL_CHANNELS, drumstick::widgets::PAL_DOUBLE, drumstick::widgets::PAL_HISCALE, and drumstick::widgets::PAL_SINGLE.

Referenced by PianoScene::showKeyOn().

◆ setHighlightPalette()

void setHighlightPalette ( const PianoPalette p)

Assigns the active highlight palette.

Parameters
pthe active highlight palette

Definition at line 1312 of file pianoscene.cpp.

References PianoScene::refreshKeys().

◆ setKeyboardEnabled()

void setKeyboardEnabled ( const bool  enable)

Enables or disables the computer keyboard note generation.

Parameters
enablethe computer keyboard note generation

Definition at line 1186 of file pianoscene.cpp.

◆ setKeyboardMap()

void setKeyboardMap ( KeyboardMap map)

Assigns the computer keyboard note map.

Parameters
mapthe computer keyboard note map.

Definition at line 322 of file pianoscene.cpp.

◆ setKeyPressedColor()

void setKeyPressedColor ( const QColor &  color)

Assigns a single color for key highlight.

This is an alternative to creating a highlight palette with a single color and assigning it.

See also
setHighlightPalette()
Parameters
colorColor for key highlight

Definition at line 820 of file pianoscene.cpp.

References drumstick::widgets::PAL_SINGLE.

Referenced by PianoScene::PianoScene().

◆ setMaxNote()

void setMaxNote ( const int  note)

Assigns the maximum MIDI note number that will be displayed.

Parameters
notethe maximum MIDI note number

Definition at line 890 of file pianoscene.cpp.

References PianoScene::hideOrShowKeys().

◆ setMinNote()

void setMinNote ( const int  note)

Assigns the minimum MIDI note number that will be displayed.

Parameters
notethe minimum MIDI note number

Definition at line 869 of file pianoscene.cpp.

References PianoScene::hideOrShowKeys().

◆ setMouseEnabled()

void setMouseEnabled ( const bool  enable)

Enables or disables the mouse note generation.

Parameters
enablethe mouse note generation

Definition at line 1206 of file pianoscene.cpp.

◆ setOctaveSubscript()

void setOctaveSubscript ( const bool  enable)

Enables or disables the subscript octave designation.

Parameters
enablethe subscript octave designation

Definition at line 1573 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ setOrientation()

void setOrientation ( const LabelOrientation  orientation)

Assigns the label orientation policy.

Parameters
orientationthe label orientation policy

Definition at line 1045 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ setPianoHandler()

void setPianoHandler ( PianoHandler handler)

Assigns a PianoHandler pointer for processing note events.

When this member is used to assign a PianoHandler instance, then the methods in that instance are called instead of emitting the signals noteOn() and noteOff().

Parameters
handlerpointer to a PianoHandler instance

Definition at line 356 of file pianoscene.cpp.

◆ setRawKeyboardMode()

void setRawKeyboardMode ( const bool  b)

Assigns the low level computer keyboard mode.

Parameters
bthe low level computer keyboard mode

Definition at line 1098 of file pianoscene.cpp.

◆ setShowColorScale()

void setShowColorScale ( const bool  show)

Enables or disables the color scale key background mode.

Parameters
showthe color scale key background mode

Definition at line 1290 of file pianoscene.cpp.

References PianoScene::refreshKeys().

◆ setShowLabels()

void setShowLabels ( const LabelVisibility  show)

Assigns the label visibility policy to the piano keys.

See also
LabelVisibility
Parameters
showthe new label visibility policy

Definition at line 1000 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ setTouchEnabled()

void setTouchEnabled ( const bool  enable)

Enables or disables the touch screen note generation.

Parameters
enablethe touch screen note generation

Definition at line 1226 of file pianoscene.cpp.

◆ setTranspose()

void setTranspose ( const int  transpose)

Assigns the transpose amount in semitones.

Parameters
transposethe transpose amount in semitones

Definition at line 1075 of file pianoscene.cpp.

References PianoScene::hideOrShowKeys(), and PianoScene::refreshLabels().

◆ setUsingNativeFilter()

void setUsingNativeFilter ( const bool  newState)

Enables or disables the application level usage of a native event filter.

Parameters
newStateof the application level usage of a native event filter

Definition at line 1553 of file pianoscene.cpp.

◆ setVelocity()

void setVelocity ( const int  velocity)

Assigns the MIDI note velocity parameter that is assigned to the MIDI OUT notes.

Parameters
velocitythe MIDI note velocity

Definition at line 1136 of file pianoscene.cpp.

◆ setVelocityTint()

void setVelocityTint ( const bool  enable)

Enables or disables the velocity parameter of note events to influence the highlight key colors.

Parameters
enablethe velocity parameter of note events to influence the highlight key colors

Definition at line 1246 of file pianoscene.cpp.

◆ showColorScale()

bool showColorScale ( ) const

Returns whether the color scale mode is enabled.

Returns
true if the color scale mode is enabled

Definition at line 1369 of file pianoscene.cpp.

◆ showKeyOff()

void showKeyOff ( PianoKey *  key,
int  vel 
)
protected

Displays as deactivated a key.

Parameters
keythe deactivated key
velthe MIDI note velocity

Definition at line 423 of file pianoscene.cpp.

References drumstick::widgets::ShowActivated, and PianoScene::signalName().

Referenced by PianoScene::keyOff(), and PianoScene::showNoteOff().

◆ showKeyOn() [1/2]

void showKeyOn ( PianoKey *  key,
int  vel 
)
protected

Displays highlighted the activated key with the supplied note velocity.

Parameters
keythe activated key
velthe MIDI note velocity

Definition at line 412 of file pianoscene.cpp.

References PianoScene::displayKeyOn(), and PianoScene::setHighlightColorFromPolicy().

◆ showKeyOn() [2/2]

void showKeyOn ( PianoKey *  key,
QColor  color,
int  vel 
)
protected

Displays highlighted the activated key with the supplied color and note velocity.

Parameters
keythe activated key
colorthe highlight color
velthe MIDI note velocity

Definition at line 395 of file pianoscene.cpp.

References PianoScene::displayKeyOn().

Referenced by PianoScene::keyOn(), and PianoScene::showNoteOn().

◆ showLabels()

LabelVisibility showLabels ( ) const

Returns the label visibility policy (display note names over the piano keys).

See also
LabelVisibility, setShowLabels()
Returns
the label visibility policy

Definition at line 1089 of file pianoscene.cpp.

◆ showNoteOff()

void showNoteOff ( const int  note,
int  vel = -1 
)

Displays deactivated the corresponding key for a given MIDI note, with MIDI velocity.

Parameters
noteThe MIDI note number
velThe MIDI note velocity

Definition at line 470 of file pianoscene.cpp.

References PianoScene::showKeyOff().

◆ showNoteOn() [1/2]

void showNoteOn ( const int  note,
int  vel = -1 
)

Displays highlighted the corresponding key for a given MIDI note, with MIDI velocity.

Parameters
noteThe MIDI note number
velThe MIDI note velocity

Definition at line 456 of file pianoscene.cpp.

References PianoScene::showKeyOn().

◆ showNoteOn() [2/2]

void showNoteOn ( const int  note,
QColor  color,
int  vel = -1 
)

Displays highlighted the corresponding key for a given MIDI note, with a color and MIDI velocity.

Parameters
noteThe MIDI note number
colorThe highlight color
velThe MIDI note velocity

Definition at line 443 of file pianoscene.cpp.

References PianoScene::showKeyOn().

◆ signalName

void signalName ( const QString &  name)
signal

signalName is emitted for each note created, and contains a string with the MIDI note number and the note name for each note on event.

Parameters
namethe MIDI note number and name

Referenced by PianoScene::displayKeyOn(), PianoKeybd::initScene(), and PianoScene::showKeyOff().

◆ sizeHint()

QSize sizeHint ( ) const

Returns the calculated size of the scene.

Returns
the calculated size of the scene

Definition at line 313 of file pianoscene.cpp.

◆ standardNoteNames()

QStringList standardNoteNames ( ) const

Returns the standard note names list.

Returns
the standard note names list

Definition at line 1118 of file pianoscene.cpp.

◆ startKey()

int startKey ( ) const

Returns the first key number that will be displayed.

Returns
the first key number

Definition at line 933 of file pianoscene.cpp.

◆ touchScreenEvent()

bool touchScreenEvent ( QTouchEvent *  touchEvent)

Process touch screen events, called by the view.

Parameters
touchEventThe given QTouchEvent*
Returns
true if the event was consumed, false otherwise.

Definition at line 1417 of file pianoscene.cpp.

References PianoScene::getKeyForPos(), PianoScene::keyOff(), and PianoScene::keyOn().

◆ triggerNoteOff()

void triggerNoteOff ( const int  note,
const int  vel 
)
protected

Performs a Note Off MIDI event for the given MIDI note number and velocity.

If a PianoHandler instance is assigned, its PianoHandler::noteOff() method is called, otherwise the noteOff() signal is triggered.

Parameters
noteThe MIDI note number
velThe MIDI velocity

Definition at line 511 of file pianoscene.cpp.

References PianoScene::noteOff().

Referenced by PianoScene::keyOff().

◆ triggerNoteOn()

void triggerNoteOn ( const int  note,
const int  vel 
)
protected

Performs a Note On MIDI event for the given MIDI note number and velocity.

If a PianoHandler instance is assigned, its PianoHandler::noteOn() method is called, otherwise the noteOn() signal is triggered.

Parameters
noteThe MIDI note number
velThe MIDI velocity

Definition at line 492 of file pianoscene.cpp.

References PianoScene::noteOn().

Referenced by PianoScene::keyOn().

◆ useCustomNoteNames()

void useCustomNoteNames ( const QStringList &  names)

Assigns the list of custom note names, and enables this mode.

Parameters
namesthe list of custom note names

Definition at line 1165 of file pianoscene.cpp.

References PianoScene::refreshLabels().

◆ velocityTint()

bool velocityTint ( ) const

Returns whether the velocity parameter of note events is used to influence the highlight key colors.

Returns
whether the velocity parameter of note events is used to influence the highlight key colors

Definition at line 1237 of file pianoscene.cpp.


The documentation for this class was generated from the following files: