Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FourierSpectrumGraphDrawer Class Reference

The FourierSpectrumGraphDrawer class. More...

#include <fourierspectrumgraphdrawer.h>

+ Inheritance diagram for FourierSpectrumGraphDrawer:
+ Collaboration diagram for FourierSpectrumGraphDrawer:

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 Member Functions inherited from MessageListener
 MessageListener (bool defaultActivation=true)
 
virtual ~MessageListener ()
 
bool isMessageListenerActive () const
 
void activateMessageListener ()
 
void deactivateMessageListener ()
 

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< FFTPolygonmPolygon
 Shared pointer to spectral polygon. More...
 
std::shared_ptr< KeymKey
 Shared pointer to selected key, holding the peaks. More...
 

Additional Inherited Members

- Protected Attributes inherited from DrawerBase
GraphicsViewAdaptermGraphics
 Pointer to the graphics view adapter. More...
 

Detailed Description

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.

Member Enumeration Documentation

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

Constructor & Destructor Documentation

FourierSpectrumGraphDrawer::FourierSpectrumGraphDrawer ( GraphicsViewAdapter graphics)

Constructor of a FourierSpectrumGraphDrawer.

Parameters
graphics: Pointer to the graphics adapter

Definition at line 42 of file fourierspectrumgraphdrawer.cpp.

FourierSpectrumGraphDrawer::~FourierSpectrumGraphDrawer ( )
inline

Empty destructor.

Definition at line 56 of file fourierspectrumgraphdrawer.h.

Member Function Documentation

void FourierSpectrumGraphDrawer::clear ( )
finaloverrideprotectedvirtual

Clear the spectrum.

Reimplemented from DrawerBase.

Definition at line 177 of file fourierspectrumgraphdrawer.cpp.

+ Here is the call graph for this function:

void FourierSpectrumGraphDrawer::draw ( )
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.

+ Here is the call graph for this function:

void FourierSpectrumGraphDrawer::handleMessage ( MessagePtr  m)
overrideprotectedvirtual

Message dispatcher for FourierSpectrumGraphDrawer.

Parameters
m: Message pointer

Implements MessageListener.

Definition at line 190 of file fourierspectrumgraphdrawer.cpp.

+ Here is the call graph for this function:

void FourierSpectrumGraphDrawer::updateSpectrum ( )
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.

+ Here is the call graph for this function:

Member Data Documentation

double FourierSpectrumGraphDrawer::mConcertPitch
private

Target freuqency of A4.

Definition at line 66 of file fourierspectrumgraphdrawer.h.

OperationMode FourierSpectrumGraphDrawer::mCurrentOperationMode
private

Current mode of operation.

Definition at line 70 of file fourierspectrumgraphdrawer.h.

std::shared_ptr<Key> FourierSpectrumGraphDrawer::mKey
private

Shared pointer to selected key, holding the peaks.

Definition at line 72 of file fourierspectrumgraphdrawer.h.

int FourierSpectrumGraphDrawer::mKeyNumberOfA4
private

Index of A4 key.

Definition at line 67 of file fourierspectrumgraphdrawer.h.

int FourierSpectrumGraphDrawer::mNumberOfKeys
private

Total number of keys.

Definition at line 68 of file fourierspectrumgraphdrawer.h.

std::shared_ptr<FFTPolygon> FourierSpectrumGraphDrawer::mPolygon
private

Shared pointer to spectral polygon.

Definition at line 71 of file fourierspectrumgraphdrawer.h.

int FourierSpectrumGraphDrawer::mSamplingRate
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.


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