drumstick 2.0.0
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.
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.
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.

Public Member Functions

 PianoScene (const int baseOctave, const int numKeys, const int startKey, const QColor &keyPressedColor=QColor(), QObject *parent=nullptr)
 Constructor.
 ~PianoScene ()
 Destructor.
QSize sizeHint () const
 Returns the calculated size of the scene.
void setKeyboardMap (KeyboardMap *map)
 Assigns the computer keyboard note map.
KeyboardMapgetKeyboardMap () const
 Returns the computer keyboard note map.
PianoHandlergetPianoHandler () const
 Gets the PianoHandler pointer to the note receiver.
void setPianoHandler (PianoHandler *handler)
 Assigns a PianoHandler pointer for processing note events.
PianoPalette getHighlightPalette ()
 Returns the palette used for highlighting the played keys.
void setHighlightPalette (const PianoPalette &p)
 Assigns the active highlight palette.
PianoPalette getBackgroundPalette ()
 Returns the background palette.
void setBackgroundPalette (const PianoPalette &p)
 Assigns the active background palette.
PianoPalette getForegroundPalette ()
 Returns the active foreground palette.
void setForegroundPalette (const PianoPalette &p)
 Assigns the active foreground palette.
bool showColorScale () const
 Returns whether the color scale mode is enabled.
void setShowColorScale (const bool show)
 Enables or disables the color scale key background mode.
QColor getKeyPressedColor () const
 Returns the single highlight palette color.
void setKeyPressedColor (const QColor &color)
 Assigns a single color for key highlight.
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.
void setMinNote (const int note)
 Assigns the minimum MIDI note number that will be displayed.
int getMaxNote () const
 Returns the maximum MIDI note number that will be displayed.
void setMaxNote (const int note)
 Assigns the maximum MIDI note number that will be displayed.
int getTranspose () const
 Returns the transpose amount in semitones.
void setTranspose (const int transpose)
 Assigns the transpose amount in semitones.
LabelVisibility showLabels () const
 Returns the label visibility policy (display note names over the piano keys).
void setShowLabels (const LabelVisibility show)
 Assigns the label visibility policy to the piano keys.
LabelAlteration alterations () const
 Returns the alterations name policy.
void setAlterations (const LabelAlteration use)
 Assigns the alterations name policy.
LabelCentralOctave getOctave () const
 Returns the central octave name policy.
void setOrientation (const LabelOrientation orientation)
 Assigns the label orientation policy.
void setKeyboardEnabled (const bool enable)
 Enables or disables the computer keyboard note generation.
bool isMouseEnabled () const
 Returns whether the computer keyboard note generation is enabled.
void setMouseEnabled (const bool enable)
 Enables or disables the mouse note generation.
bool isTouchEnabled () const
 Returns whether the touch screen note generation is enabled.
void setTouchEnabled (const bool enable)
 Enables or disables the touch screen note generation.
bool velocityTint () const
 Returns whether the velocity parameter of note events is used to influence the highlight key colors.
void setVelocityTint (const bool enable)
 Enables or disables the velocity parameter of note events to influence the highlight key colors.
bool isOctaveStart (const int note)
 Returns whether the given note number is a octave startup note.
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.
void showNoteOn (const int note, int vel=-1)
 Displays highlighted the corresponding key for a given MIDI note, with MIDI velocity.
void showNoteOff (const int note, int vel=-1)
 Displays deactivated the corresponding key for a given MIDI note, with MIDI velocity.
int baseOctave () const
 Returns the base octave number.
void setBaseOctave (const int base)
 Assigns the octave base number.
int numKeys () const
 Returns the number of keys that will be displayed.
int startKey () const
 Returns the first key number that will be displayed.
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.
void keyOff (const int note)
 Produces a MIDI Note Off event and deactivates the corresponding key for the given MIDI note number.
bool getRawKeyboardMode () const
 Returns whether the low level computer keyboard mode is enabled.
void setRawKeyboardMode (const bool b)
 Assigns the low level computer keyboard mode.
void useCustomNoteNames (const QStringList &names)
 Assigns the list of custom note names, and enables this mode.
void useStandardNoteNames ()
 Assigns the standard note names, clearing the list of custom note names.
QStringList customNoteNames () const
 Returns the custom note names list.
QStringList standardNoteNames () const
 Returns the standard note names list.
int getVelocity ()
 Returns the MIDI note velocity parameter that is assigned to the MIDI OUT notes.
void setVelocity (const int velocity)
 Assigns the MIDI note velocity parameter that is assigned to the MIDI OUT notes.
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).
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).
void retranslate ()
 Retranslates the standard note names.
void refreshLabels ()
 Refresh the visibility and other attributes of the labels shown over the piano keys.

Protected Member Functions

void showKeyOn (PianoKey *key, QColor color, int vel)
 Displays highlighted the activated key with the supplied color and note velocity.
void showKeyOn (PianoKey *key, int vel)
 Displays highlighted the activated key with the supplied note velocity.
void showKeyOff (PianoKey *key, int vel)
 Displays as deactivated a key.
void displayKeyOn (PianoKey *key)
 Displays the note label over a highligted key.
void keyOn (PianoKey *key)
 Produces a MIDI Note On event and highlights the given key.
void keyOff (PianoKey *key)
 Produces a MIDI Note Off event and deactivates the given key.
void keyOn (PianoKey *key, qreal pressure)
 Produces a MIDI Note On event and highlights the given key with the given pressure.
void keyOff (PianoKey *key, qreal pressure)
 Produces a MIDI Note Off event and deactivates the given key with the given pressure.
PianoKey * getKeyForPos (const QPointF &p) const
 Returns the piano key for the given scene point coordenates.
PianoKey * getPianoKey (const int key) const
 Returns the piano key object corresponding to the given computer keyboard key.
QString noteName (PianoKey *key)
 Returns the note name string that will be displayed over a given piano key.
void mouseMoveEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse move events for the scene.
void mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse press events for the scene.
void mouseReleaseEvent (QGraphicsSceneMouseEvent *mouseEvent) override
 This event handler, for event mouseEvent, is reimplemented to receive mouse release events for the scene.
void keyPressEvent (QKeyEvent *keyEvent) override
 This event handler, for event keyEvent, is reimplemented to receive keypress events.
void keyReleaseEvent (QKeyEvent *keyEvent) override
 This event handler, for event keyEvent, is reimplemented to receive key release events.
bool event (QEvent *event) override
 Processes touch screen events.
void triggerNoteOn (const int note, const int vel)
 Performs a Note On MIDI event for the given MIDI note number and velocity.
void triggerNoteOff (const int note, const int vel)
 Performs a Note Off MIDI event for the given MIDI note number and velocity.
int getNoteFromKey (const int key) const
 Returns the note number for the given computer keyboard key code.
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.
void hideOrShowKeys ()
 Hides or shows keys.
void refreshKeys ()
 Refresh the background colors of all the piano keys.

Detailed Description

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

Definition at line 45 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 117 of file pianoscene.cpp.

References baseOctave(), getKeyPressedColor(), numKeys(), and startKey().

Member Function Documentation

◆ alterations()

LabelAlteration alterations ( ) const

Returns the alterations name policy.

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

Definition at line 948 of file pianoscene.cpp.

References alterations().

Referenced by alterations().

◆ baseOctave()

int baseOctave ( ) const

Returns the base octave number.

See also
setBaseOctave()
Returns
the base octave number

Definition at line 342 of file pianoscene.cpp.

References baseOctave().

Referenced by baseOctave(), and PianoScene().

◆ customNoteNames()

QStringList customNoteNames ( ) const

Returns the custom note names list.

Returns
the custom note names list

Definition at line 1043 of file pianoscene.cpp.

References customNoteNames().

Referenced by customNoteNames().

◆ displayKeyOn()

void displayKeyOn ( PianoKey * key)
protected

Displays the note label over a highligted key.

Parameters
keythe activated key

Definition at line 238 of file pianoscene.cpp.

References displayKeyOn(), noteName(), drumstick::widgets::ShowActivated, and signalName().

Referenced by displayKeyOn(), showKeyOn(), showKeyOn(), and signalName().

◆ event()

bool event ( QEvent * event)
overrideprotected

Processes touch screen events.

Parameters
eventThe given event
Returns
true if the event was processed

Definition at line 635 of file pianoscene.cpp.

References event(), getKeyForPos(), keyOff(), and keyOn().

Referenced by event(), and signalName().

◆ getBackgroundPalette()

PianoPalette getBackgroundPalette ( )

Returns the background palette.

Returns
the background palette

Definition at line 1258 of file pianoscene.cpp.

References getBackgroundPalette().

Referenced by getBackgroundPalette().

◆ 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 1080 of file pianoscene.cpp.

References getChannel().

Referenced by getChannel().

◆ getForegroundPalette()

PianoPalette getForegroundPalette ( )

Returns the active foreground palette.

Returns
the active foreground palette

Definition at line 1280 of file pianoscene.cpp.

References getForegroundPalette().

Referenced by getForegroundPalette().

◆ getHighlightPalette()

PianoPalette getHighlightPalette ( )

Returns the palette used for highlighting the played keys.

Returns
The PianoPalette used to highlight the played keys

Definition at line 229 of file pianoscene.cpp.

References getHighlightPalette().

Referenced by getHighlightPalette().

◆ getKeyboardMap()

KeyboardMap * getKeyboardMap ( ) const

Returns the computer keyboard note map.

Returns
the computer keyboard note map

Definition at line 195 of file pianoscene.cpp.

References getKeyboardMap().

Referenced by getKeyboardMap().

◆ 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 496 of file pianoscene.cpp.

References getKeyForPos().

Referenced by event(), getKeyForPos(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and signalName().

◆ getKeyPressedColor()

QColor getKeyPressedColor ( ) const

Returns the single highlight palette color.

Returns
the single highlight palette color

Definition at line 1236 of file pianoscene.cpp.

References getKeyPressedColor().

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

◆ getMaxNote()

int getMaxNote ( ) const

Returns the maximum MIDI note number that will be displayed.

Returns
the maximum MIDI note number

Definition at line 771 of file pianoscene.cpp.

References getMaxNote().

Referenced by getMaxNote().

◆ getMinNote()

int getMinNote ( ) const

Returns the minimum MIDI note number that will be displayed.

Returns
the minimum MIDI note number

Definition at line 738 of file pianoscene.cpp.

References getMinNote().

Referenced by getMinNote().

◆ 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 569 of file pianoscene.cpp.

References getNoteFromKey().

Referenced by getNoteFromKey(), getPianoKey(), keyPressEvent(), keyReleaseEvent(), and signalName().

◆ getOctave()

LabelCentralOctave getOctave ( ) const

Returns the central octave name policy.

Returns
the central octave name policy

Definition at line 970 of file pianoscene.cpp.

References getOctave().

Referenced by getOctave().

◆ 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 207 of file pianoscene.cpp.

References getPianoHandler().

Referenced by getPianoHandler().

◆ 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 586 of file pianoscene.cpp.

References getNoteFromKey(), and getPianoKey().

Referenced by getPianoKey(), and signalName().

◆ 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 486 of file pianoscene.cpp.

References getRawKeyboardMode().

Referenced by getRawKeyboardMode().

◆ getTranspose()

int getTranspose ( ) const

Returns the transpose amount in semitones.

Returns
the transpose amount in semitones

Definition at line 792 of file pianoscene.cpp.

References getTranspose().

Referenced by getTranspose().

◆ 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 1061 of file pianoscene.cpp.

References getVelocity().

Referenced by getVelocity().

◆ 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 1131 of file pianoscene.cpp.

References isMouseEnabled().

Referenced by isMouseEnabled().

◆ 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 833 of file pianoscene.cpp.

References isOctaveStart().

Referenced by isOctaveStart(), and 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 1151 of file pianoscene.cpp.

References isTouchEnabled().

Referenced by isTouchEnabled().

◆ 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 474 of file pianoscene.cpp.

References keyOff(), and triggerNoteOff().

Referenced by event(), keyOff(), keyOff(), keyOff(), keyReleaseEvent(), mouseMoveEvent(), mouseReleaseEvent(), and signalName().

◆ 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 428 of file pianoscene.cpp.

References keyOff(), showKeyOff(), and 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 451 of file pianoscene.cpp.

References keyOff(), showKeyOff(), and 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 462 of file pianoscene.cpp.

References keyOn(), and triggerNoteOn().

Referenced by event(), keyOn(), keyOn(), keyOn(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), and signalName().

◆ 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 418 of file pianoscene.cpp.

References keyOn(), showKeyOn(), and 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 439 of file pianoscene.cpp.

References keyOn(), showKeyOn(), and 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 598 of file pianoscene.cpp.

References getNoteFromKey(), keyOn(), and keyPressEvent().

Referenced by keyPressEvent(), and signalName().

◆ 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 616 of file pianoscene.cpp.

References getNoteFromKey(), keyOff(), and keyReleaseEvent().

Referenced by keyReleaseEvent(), and signalName().

◆ 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 512 of file pianoscene.cpp.

References getKeyForPos(), keyOff(), keyOn(), and mouseMoveEvent().

Referenced by mouseMoveEvent(), and signalName().

◆ 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 534 of file pianoscene.cpp.

References getKeyForPos(), keyOn(), and mousePressEvent().

Referenced by mousePressEvent(), and signalName().

◆ 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 551 of file pianoscene.cpp.

References getKeyForPos(), keyOff(), and mouseReleaseEvent().

Referenced by mouseReleaseEvent(), and signalName().

◆ 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 843 of file pianoscene.cpp.

References noteName(), drumstick::widgets::OctaveNothing, drumstick::widgets::ShowFlats, drumstick::widgets::ShowNothing, and drumstick::widgets::ShowSharps.

Referenced by displayKeyOn(), noteName(), refreshLabels(), and signalName().

◆ 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 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 triggerNoteOn().

◆ numKeys()

int numKeys ( ) const

Returns the number of keys that will be displayed.

Returns
the number of keys

Definition at line 814 of file pianoscene.cpp.

References numKeys().

Referenced by numKeys(), and PianoScene().

◆ setAlterations()

void setAlterations ( const LabelAlteration use)

Assigns the alterations name policy.

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

Definition at line 958 of file pianoscene.cpp.

References refreshLabels(), and setAlterations().

Referenced by setAlterations().

◆ setBackgroundPalette()

void setBackgroundPalette ( const PianoPalette & p)

Assigns the active background palette.

Parameters
pthe active background palette

Definition at line 1267 of file pianoscene.cpp.

References refreshKeys(), and setBackgroundPalette().

Referenced by setBackgroundPalette().

◆ setBaseOctave()

void setBaseOctave ( const int base)

Assigns the octave base number.

Parameters
basethe octave base number

Definition at line 801 of file pianoscene.cpp.

References hideOrShowKeys(), refreshLabels(), and setBaseOctave().

Referenced by setBaseOctave().

◆ 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 1090 of file pianoscene.cpp.

References setChannel().

Referenced by setChannel().

◆ setForegroundPalette()

void setForegroundPalette ( const PianoPalette & p)

Assigns the active foreground palette.

Parameters
pthe foreground palette

Definition at line 1289 of file pianoscene.cpp.

References refreshLabels(), and setForegroundPalette().

Referenced by setForegroundPalette().

◆ 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 388 of file pianoscene.cpp.

References drumstick::widgets::PAL_CHANNELS, drumstick::widgets::PAL_DOUBLE, drumstick::widgets::PAL_SINGLE, and setHighlightColorFromPolicy().

Referenced by setHighlightColorFromPolicy(), showKeyOn(), and signalName().

◆ setHighlightPalette()

void setHighlightPalette ( const PianoPalette & p)

Assigns the active highlight palette.

Parameters
pthe active highlight palette

Definition at line 1245 of file pianoscene.cpp.

References refreshKeys(), and setHighlightPalette().

Referenced by setHighlightPalette().

◆ setKeyboardEnabled()

void setKeyboardEnabled ( const bool enable)

Enables or disables the computer keyboard note generation.

Parameters
enablethe computer keyboard note generation

Definition at line 1120 of file pianoscene.cpp.

References setKeyboardEnabled().

Referenced by setKeyboardEnabled().

◆ setKeyboardMap()

void setKeyboardMap ( KeyboardMap * map)

Assigns the computer keyboard note map.

Parameters
mapthe computer keyboard note map.

Definition at line 186 of file pianoscene.cpp.

References setKeyboardMap().

Referenced by setKeyboardMap().

◆ 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 710 of file pianoscene.cpp.

References drumstick::widgets::PAL_SINGLE, and setKeyPressedColor().

Referenced by setKeyPressedColor().

◆ 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 780 of file pianoscene.cpp.

References hideOrShowKeys(), and setMaxNote().

Referenced by setMaxNote().

◆ 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 759 of file pianoscene.cpp.

References hideOrShowKeys(), and setMinNote().

Referenced by setMinNote().

◆ setMouseEnabled()

void setMouseEnabled ( const bool enable)

Enables or disables the mouse note generation.

Parameters
enablethe mouse note generation

Definition at line 1140 of file pianoscene.cpp.

References setMouseEnabled().

Referenced by setMouseEnabled().

◆ setOrientation()

void setOrientation ( const LabelOrientation orientation)

Assigns the label orientation policy.

Parameters
orientationthe label orientation policy

Definition at line 979 of file pianoscene.cpp.

References refreshLabels(), and setOrientation().

Referenced by setOrientation().

◆ 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 220 of file pianoscene.cpp.

References setPianoHandler().

Referenced by setPianoHandler().

◆ setRawKeyboardMode()

void setRawKeyboardMode ( const bool b)

Assigns the low level computer keyboard mode.

Parameters
bthe low level computer keyboard mode

Definition at line 1032 of file pianoscene.cpp.

References setRawKeyboardMode().

Referenced by setRawKeyboardMode().

◆ 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 1223 of file pianoscene.cpp.

References refreshKeys(), and setShowColorScale().

Referenced by setShowColorScale().

◆ 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 934 of file pianoscene.cpp.

References refreshLabels(), and setShowLabels().

Referenced by setShowLabels().

◆ setTouchEnabled()

void setTouchEnabled ( const bool enable)

Enables or disables the touch screen note generation.

Parameters
enablethe touch screen note generation

Definition at line 1160 of file pianoscene.cpp.

References setTouchEnabled().

Referenced by setTouchEnabled().

◆ setTranspose()

void setTranspose ( const int transpose)

Assigns the transpose amount in semitones.

Parameters
transposethe transpose amount in semitones

Definition at line 1009 of file pianoscene.cpp.

References hideOrShowKeys(), refreshLabels(), and setTranspose().

Referenced by setTranspose().

◆ 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 1070 of file pianoscene.cpp.

References setVelocity().

Referenced by setVelocity().

◆ 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 1180 of file pianoscene.cpp.

References setVelocityTint().

Referenced by setVelocityTint().

◆ showColorScale()

bool showColorScale ( ) const

Returns whether the color scale mode is enabled.

Returns
true if the color scale mode is enabled

Definition at line 1302 of file pianoscene.cpp.

References showColorScale().

Referenced by showColorScale().

◆ showKeyOff()

void showKeyOff ( PianoKey * key,
int vel )
protected

Displays as deactivated a key.

Parameters
keythe deactivated key
velthe MIDI note velocity

Definition at line 284 of file pianoscene.cpp.

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

Referenced by keyOff(), keyOff(), showKeyOff(), showNoteOff(), and signalName().

◆ 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 273 of file pianoscene.cpp.

References displayKeyOn(), setHighlightColorFromPolicy(), and showKeyOn().

◆ 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 259 of file pianoscene.cpp.

References displayKeyOn(), and showKeyOn().

Referenced by keyOn(), keyOn(), showKeyOn(), showKeyOn(), showNoteOn(), showNoteOn(), and signalName().

◆ 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 1023 of file pianoscene.cpp.

References showLabels().

Referenced by showLabels().

◆ 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 329 of file pianoscene.cpp.

References showKeyOff(), and showNoteOff().

Referenced by showNoteOff().

◆ 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 316 of file pianoscene.cpp.

References showKeyOn(), and showNoteOn().

◆ 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 304 of file pianoscene.cpp.

References showKeyOn(), and showNoteOn().

Referenced by showNoteOn(), and showNoteOn().

◆ 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

References displayKeyOn(), event(), getKeyForPos(), getNoteFromKey(), getPianoKey(), hideOrShowKeys(), keyOff(), keyOn(), keyPressEvent(), keyReleaseEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), noteName(), refreshKeys(), setHighlightColorFromPolicy(), showKeyOff(), showKeyOn(), triggerNoteOff(), and triggerNoteOn().

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

◆ sizeHint()

QSize sizeHint ( ) const

Returns the calculated size of the scene.

Returns
the calculated size of the scene

Definition at line 177 of file pianoscene.cpp.

References sizeHint().

Referenced by sizeHint().

◆ standardNoteNames()

QStringList standardNoteNames ( ) const

Returns the standard note names list.

Returns
the standard note names list

Definition at line 1052 of file pianoscene.cpp.

References standardNoteNames().

Referenced by standardNoteNames().

◆ startKey()

int startKey ( ) const

Returns the first key number that will be displayed.

Returns
the first key number

Definition at line 823 of file pianoscene.cpp.

References startKey().

Referenced by PianoScene(), and startKey().

◆ 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 370 of file pianoscene.cpp.

References noteOff(), and triggerNoteOff().

Referenced by keyOff(), keyOff(), keyOff(), signalName(), and triggerNoteOff().

◆ 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 351 of file pianoscene.cpp.

References noteOn(), and triggerNoteOn().

Referenced by keyOn(), keyOn(), keyOn(), signalName(), and triggerNoteOn().

◆ 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 1099 of file pianoscene.cpp.

References refreshLabels(), and useCustomNoteNames().

Referenced by useCustomNoteNames().

◆ 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 1171 of file pianoscene.cpp.

References velocityTint().

Referenced by velocityTint().


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