drumstick 2.10.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.
 
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.
 
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.
 
void setUsingNativeFilter (const bool newState)
 Enables or disables the application level usage of a native event filter.
 
bool isUsingNativeFilter () const
 Returns whether the application is filtering native events.
 
void setOctaveSubscript (const bool enable)
 Enables or disables the subscript octave designation.
 
bool octaveSubscript () const
 Returns whether the subscript octave designation is enabled.
 

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
 This method overrides QGraphicsScene::event().
 
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.
 

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 baseOctave(), getKeyPressedColor(), numKeys(), PianoKeybd::setFont(), 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 1014 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 483 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 1109 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 374 of file pianoscene.cpp.

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

Referenced by displayKeyOn(), showKeyOn(), and 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 event().

Referenced by event(), and signalName().

◆ getBackgroundPalette()

PianoPalette getBackgroundPalette ( )

Returns the background palette.

Returns
the background palette

Definition at line 1325 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 1146 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 1347 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 365 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 331 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 641 of file pianoscene.cpp.

References getKeyForPos().

Referenced by getKeyForPos(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and 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.

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 881 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 848 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 714 of file pianoscene.cpp.

References getNoteFromKey().

Referenced by getNoteFromKey(), getPianoKey(), keyPressEvent(), and 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.

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 343 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 731 of file pianoscene.cpp.

References getNoteFromKey(), and getPianoKey().

Referenced by getPianoKey().

◆ 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.

References getRawKeyboardMode().

Referenced by getRawKeyboardMode().

◆ getTranspose()

int getTranspose ( ) const

Returns the transpose amount in semitones.

Returns
the transpose amount in semitones

Definition at line 902 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 1127 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 1197 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 943 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 1217 of file pianoscene.cpp.

References isTouchEnabled().

Referenced by isTouchEnabled().

◆ 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.

References isUsingNativeFilter().

Referenced by isUsingNativeFilter().

◆ 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 keyOff(), and triggerNoteOff().

Referenced by keyOff(), keyOff(), keyOff(), keyReleaseEvent(), mouseMoveEvent(), mouseReleaseEvent(), and 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 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 596 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 607 of file pianoscene.cpp.

References keyOn(), and triggerNoteOn().

Referenced by keyOn(), keyOn(), keyOn(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), and 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 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 584 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 743 of file pianoscene.cpp.

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

Referenced by keyPressEvent().

◆ 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 getNoteFromKey(), keyOff(), and keyReleaseEvent().

Referenced by keyReleaseEvent().

◆ 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 getKeyForPos(), keyOff(), keyOn(), and mouseMoveEvent().

Referenced by mouseMoveEvent().

◆ 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 getKeyForPos(), keyOn(), and mousePressEvent().

Referenced by mousePressEvent().

◆ 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 getKeyForPos(), keyOff(), and mouseReleaseEvent().

Referenced by mouseReleaseEvent().

◆ 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.

References noteName().

Referenced by noteName().

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

References numKeys().

Referenced by numKeys(), and PianoScene().

◆ 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.

References octaveSubscript().

Referenced by octaveSubscript().

◆ 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 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 1334 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 911 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 1156 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 1356 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 529 of file pianoscene.cpp.

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

Referenced by setHighlightColorFromPolicy(), and 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 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 1186 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 322 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 820 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 890 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 869 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 1206 of file pianoscene.cpp.

References setMouseEnabled().

Referenced by setMouseEnabled().

◆ 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 refreshLabels(), and setOctaveSubscript().

Referenced by setOctaveSubscript().

◆ 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 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 356 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 1098 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 1290 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 1000 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 1226 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 1075 of file pianoscene.cpp.

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

Referenced by setTranspose().

◆ 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.

References setUsingNativeFilter().

Referenced by setUsingNativeFilter().

◆ 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.

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 1246 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 1369 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 423 of file pianoscene.cpp.

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

Referenced by keyOff(), keyOff(), showKeyOff(), and 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 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 395 of file pianoscene.cpp.

References displayKeyOn(), and showKeyOn().

Referenced by keyOn(), keyOn(), showKeyOn(), showKeyOn(), showNoteOn(), and 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.

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 470 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 456 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 443 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 event().

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 313 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 1118 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 933 of file pianoscene.cpp.

References startKey().

Referenced by PianoScene(), and startKey().

◆ 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 getKeyForPos(), keyOff(), keyOn(), and touchScreenEvent().

Referenced by touchScreenEvent().

◆ 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 noteOff(), and triggerNoteOff().

Referenced by keyOff(), keyOff(), keyOff(), 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 492 of file pianoscene.cpp.

References noteOn(), and triggerNoteOn().

Referenced by keyOn(), keyOn(), keyOn(), 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 1165 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 1237 of file pianoscene.cpp.

References velocityTint().

Referenced by velocityTint().


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