Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
The QGraphicsView to display the tuning curve and the inharmonicity. More...
#include <tuningcurvegraph.h>
Public Member Functions | |
TuningCurveGraph (QWidget *parent) | |
Constructor, linking AutoScaledToKeyboardGraphicsView with the TuningCurveGraphDrawer. More... | |
virtual | ~TuningCurveGraph () |
Empty virtual destructor. More... | |
Public Member Functions inherited from AutoScaledToKeyboardGraphicsView | |
AutoScaledToKeyboardGraphicsView (QWidget *parent, DrawerBase *drawer) | |
Constructor. More... | |
~AutoScaledToKeyboardGraphicsView () | |
Destructor. More... | |
void | setKeyboard (KeyboardGraphicsView *keyboardgraphicsview) |
Setter function for the keyboard. More... | |
void | highlightKey (int key) |
Function that will highlight the given key. More... | |
Public Member Functions inherited from GraphicsViewAdapterForQt | |
GraphicsViewAdapterForQt (QWidget *parent, DrawerBase *drawer, QRectF sceneRect) | |
Constructor. More... | |
~GraphicsViewAdapterForQt () | |
Destructor, removing all graphics items from the list. More... | |
void | setSceneRect (const QRectF &rect) |
Setter function for the scene rectangle. More... | |
QPointF | convertRelToAbs (const QPointF &p) const |
Converting from relative to absolute coordinates. More... | |
QSizeF | convertRelToAbs (const QSizeF &s) const |
Converting from relative to absolute coordinates. More... | |
QLineF | convertRelToAbsLine (qreal x1, qreal y1, qreal x2, qreal y2) const |
Converting of a line from relative to absolute coordinates. More... | |
QPointF | convertAbsToRel (const QPointF &p) const |
Converting from absolute to relative coordinates. More... | |
Public Member Functions inherited from GraphicsViewAdapter | |
GraphicsViewAdapter () | |
Empty constructor. More... | |
~GraphicsViewAdapter () | |
Destructor clearing the view. More... | |
GraphicItemsList & | getGraphicItems () |
Get the list of the graphic items. More... | |
const GraphicItemsList & | getGraphicItems () const |
Get a constant list of the graphic items. More... | |
GraphicsItem * | getGraphicItem (int keyIndex, RoleType role) |
Get a single graphics element specified by its index and its role. More... | |
GraphicsItem * | getGraphicItemByRole (RoleType role) |
Get the first of all graphics elements with a given role. More... | |
GraphicItemsList | getGraphicItems (int keyIndex) |
Get a list of graphic items that match with the keyIndex. More... | |
GraphicItemsList | getGraphicItemsByRole (RoleType role) |
Get a list of graphic items that match with the given role. More... | |
GraphicItemsList | getGraphicItems (int keyIndex, RoleType role) |
Get the list of all graphics elements of a given key and role. More... | |
Public Member Functions inherited from TuningCurveGraphDrawer | |
TuningCurveGraphDrawer (GraphicsViewAdapter *graphics) | |
Constructor, calls the DrawerBase constructor and resets variables. More... | |
~TuningCurveGraphDrawer () | |
Empty destructor. More... | |
void | manuallyEditTuningCurveByClick (double relX, double relY) |
Manually edit tuning curve by mouse click. More... | |
OperationMode | getOperationMode () const |
Public Member Functions inherited from DrawerBase | |
DrawerBase (GraphicsViewAdapter *graphics, double intervall=1.0/24.0) | |
Constructor of a drawer. More... | |
~DrawerBase () | |
void | redraw (bool force=false) |
Function to completely redraw the scene. More... | |
bool | requestRedraw (bool force=false) |
Check whether the content has to be redrawn. More... | |
Protected Member Functions | |
virtual QSize | sizeHint () const overridefinal |
virtual QSize | minimumSizeHint () const overridefinal |
void | mousePressEvent (QMouseEvent *event) override |
Function handling a mouse click. The mouse press event is used to manually edit the tuning curve. More... | |
void | mouseMoveEvent (QMouseEvent *event) override |
Function for handling mouse moves. Moving the mouse will continuously change the tuning curve by dragging the green marker. More... | |
void | mouseReleaseEvent (QMouseEvent *event) override |
Mouse release event to stop the change of the tuning curve. More... | |
void | handleMouseInteraction (double relX, double relY) |
TuningCurveGraph::handleMouseInteraction. More... | |
Protected Member Functions inherited from AutoScaledToKeyboardGraphicsView | |
void | showEvent (QShowEvent *event) override |
Reimplemented to keep the visible view with the KeyboardGraphicsView. More... | |
void | resizeEvent (QResizeEvent *event) override |
Reimplemented to keep the visible view with the KeyboardGraphicsView. More... | |
Protected Member Functions inherited from GraphicsViewAdapterForQt | |
void | showEvent (QShowEvent *event) override |
Show the scene (reimplemented show event). More... | |
void | resizeEvent (QResizeEvent *event) override |
Resize the scene (reimplemented resize event). More... | |
virtual void | clear () override |
Clear the scene. More... | |
virtual GraphicsItem * | drawLine (double x1, double y1, double x2, double y2, PenType pen) override |
Abstract function: Draw a line. More... | |
virtual GraphicsItem * | drawChart (const std::vector< Point > &points, PenType pen) override |
Abstract function: Draw a chart (polygon). More... | |
virtual GraphicsItem * | drawFilledRect (double x, double y, double w, double h, PenType pen, FillTypes fill) override |
Abstract function: Draw a filled rectangle. More... | |
virtual void | drawStroboscope (const ComplexVector &data) override |
Protected Member Functions inherited from TuningCurveGraphDrawer | |
virtual void | draw () final |
Main drawing function. More... | |
virtual void | handleMessage (MessagePtr m) override |
Message listener and dispatcher. More... | |
double | convertCentsToY (double cents) |
Convert cents to y-coordinate between 0 and 1. More... | |
double | getMarkerPosition (int keyindex, RoleType role) |
Compute the position of a marker. More... | |
void | drawMarkers (int8_t key) |
Draw the tuning markers in the tuning curve panel. More... | |
void | drawGrid () |
Draw the background grid in the tuning curve panel. More... | |
PenType | getMarkerPenType (RoleType role) |
Get the pen type of a marker with a given role. More... | |
void | updateMarkerPosition (int keyindex, RoleType role) |
Protected Member Functions inherited from DrawerBase | |
virtual void | clear () |
Clear the whole view. More... | |
Private Attributes | |
bool | mPressed |
Is the mouse pressed? More... | |
float | mPressedX |
The x coordinate where the mouse was pressed in first instance. More... | |
The QGraphicsView to display the tuning curve and the inharmonicity.
This is the Qt implementation of the TuningCurveGraphDrawer. It forwards the drawings of TuningCurveGraphDrawer to a AutoScaledToKeyboardGraphicsView.
The user can change the computed tuning curve with a mouse click on the bars. This class is basically managing these mouse clicks. A click selects the corresponding key on the keyboard by sending a MSG_KEY_SELECTION_CHANGED message.
Definition at line 48 of file tuningcurvegraph.h.
|
explicit |
Constructor, linking AutoScaledToKeyboardGraphicsView with the TuningCurveGraphDrawer.
parent | : The parent widget. |
Definition at line 44 of file tuningcurvegraph.cpp.
|
inlinevirtual |
Empty virtual destructor.
Definition at line 53 of file tuningcurvegraph.h.
|
protected |
TuningCurveGraph::handleMouseInteraction.
If the mouse is within the valid range the function computes the corresponding key index. In the calculation mode the coordinates are used to manually edit the tuning curve while in all other modes a message is sent to select the corresponding key.
relX | : Relative x coordinate of the mouse pointer. |
relY | : Relative y coordinate of the mouse pointer. |
Definition at line 142 of file tuningcurvegraph.cpp.
|
inlinefinaloverrideprotectedvirtual |
Definition at line 57 of file tuningcurvegraph.h.
|
overrideprotected |
Function for handling mouse moves. Moving the mouse will continuously change the tuning curve by dragging the green marker.
The function is only active if mPressed is true. It will use mPressedX as x value and the actual QMouseEvent's y coordinate. These coordinates are passed to the function handleMouseInteraction.
event | : The QMouseEvent |
Definition at line 92 of file tuningcurvegraph.cpp.
|
overrideprotected |
Function handling a mouse click. The mouse press event is used to manually edit the tuning curve.
If the a mouse button is pressed this function sets mPressed to true and stores the mouse x position in the member variable mPressedX. It also passes the actual coordinates to the function handleMouseInteraction.
event | : The QMouseEvent |
Definition at line 68 of file tuningcurvegraph.cpp.
|
overrideprotected |
Mouse release event to stop the change of the tuning curve.
A mouse release event will set mPressed to false. The final coordinates are passed to the function handleMouseInteraction.
event | : The QMouseEvent |
Definition at line 115 of file tuningcurvegraph.cpp.
|
inlinefinaloverrideprotectedvirtual |
Definition at line 56 of file tuningcurvegraph.h.
|
private |
Is the mouse pressed?
Definition at line 69 of file tuningcurvegraph.h.
|
private |
The x coordinate where the mouse was pressed in first instance.
Definition at line 72 of file tuningcurvegraph.h.