Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
The FourierSpectrumGraphDrawer class. More...
#include <fourierspectrumgraphdrawer.h>
Public Types | |
enum | RoleType { ROLE_GLOBAL = 1, ROLE_CHART = 2, ROLE_PEAK = 4 } |
< Roles of the items used here More... | |
Public Member Functions | |
FourierSpectrumGraphDrawer (GraphicsViewAdapter *graphics) | |
Constructor of a FourierSpectrumGraphDrawer. More... | |
~FourierSpectrumGraphDrawer () | |
Empty destructor. More... | |
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... | |
Public Attributes | |
const double | updateInterval = 1.0 |
Update interval at least 1 sec. More... | |
Protected Member Functions | |
virtual void | draw () overridefinal |
Draw the spectrum. More... | |
virtual void | clear () overridefinal |
Clear the spectrum. More... | |
virtual void | handleMessage (MessagePtr m) override |
Message dispatcher for FourierSpectrumGraphDrawer. More... | |
void | updateSpectrum () |
Function for updating the red curve showing the spectrum. More... | |
Private Attributes | |
double | mConcertPitch |
Target freuqency of A4. More... | |
int | mKeyNumberOfA4 |
Index of A4 key. More... | |
int | mNumberOfKeys |
Total number of keys. More... | |
int | mSamplingRate |
copy of sample rate More... | |
OperationMode | mCurrentOperationMode |
Current mode of operation. More... | |
std::shared_ptr< FFTPolygon > | mPolygon |
Shared pointer to spectral polygon. More... | |
std::shared_ptr< Key > | mKey |
Shared pointer to selected key, holding the peaks. More... | |
Additional Inherited Members | |
Protected Attributes inherited from DrawerBase | |
GraphicsViewAdapter * | mGraphics |
Pointer to the graphics view adapter. More... | |
The FourierSpectrumGraphDrawer class.
This class is drawing the spectrum (the red line) and if available the peak markers on top of it.
The FourierSpectrumGraphDrawer is completely driven by messages.
Definition at line 42 of file fourierspectrumgraphdrawer.h.
< Roles of the items used here
Enumerator | |
---|---|
ROLE_GLOBAL |
Global elements. |
ROLE_CHART |
Chart items (polygons) |
ROLE_PEAK |
Peak markers. |
Definition at line 47 of file fourierspectrumgraphdrawer.h.
FourierSpectrumGraphDrawer::FourierSpectrumGraphDrawer | ( | GraphicsViewAdapter * | graphics | ) |
Constructor of a FourierSpectrumGraphDrawer.
graphics | : Pointer to the graphics adapter |
Definition at line 42 of file fourierspectrumgraphdrawer.cpp.
|
inline |
Empty destructor.
Definition at line 56 of file fourierspectrumgraphdrawer.h.
|
finaloverrideprotectedvirtual |
Clear the spectrum.
Reimplemented from DrawerBase.
Definition at line 177 of file fourierspectrumgraphdrawer.cpp.
|
finaloverrideprotectedvirtual |
Draw the spectrum.
This function first draws the background grid and then calls the function updateSpectrum() which does the actual drawing of the curve.
Implements DrawerBase.
Definition at line 64 of file fourierspectrumgraphdrawer.cpp.
|
overrideprotectedvirtual |
Message dispatcher for FourierSpectrumGraphDrawer.
m | : Message pointer |
Implements MessageListener.
Definition at line 190 of file fourierspectrumgraphdrawer.cpp.
|
protected |
Function for updating the red curve showing the spectrum.
This function actually draws the spectrum. It puts graphic items which are defined by different roles (global,chart,peak). First the old elements are removed (one chart, many peaks). The data used for plotting is held by the shared pointers mKey and mPolygon. Then the peaks are placed and finally the red line is plotted as a polygon.
Definition at line 92 of file fourierspectrumgraphdrawer.cpp.
|
private |
Target freuqency of A4.
Definition at line 66 of file fourierspectrumgraphdrawer.h.
|
private |
Current mode of operation.
Definition at line 70 of file fourierspectrumgraphdrawer.h.
|
private |
Shared pointer to selected key, holding the peaks.
Definition at line 72 of file fourierspectrumgraphdrawer.h.
|
private |
Index of A4 key.
Definition at line 67 of file fourierspectrumgraphdrawer.h.
|
private |
Total number of keys.
Definition at line 68 of file fourierspectrumgraphdrawer.h.
|
private |
Shared pointer to spectral polygon.
Definition at line 71 of file fourierspectrumgraphdrawer.h.
|
private |
copy of sample rate
Definition at line 69 of file fourierspectrumgraphdrawer.h.
const double FourierSpectrumGraphDrawer::updateInterval = 1.0 |
Update interval at least 1 sec.
Definition at line 45 of file fourierspectrumgraphdrawer.h.