Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Class describing the piano keyboard, holding a collection of keys. More...
#include <keyboard.h>
Public Types | |
using | Keys = std::vector< Key > |
Public Member Functions | |
Keyboard (size_t initialSize) | |
Keyboard constructor. More... | |
~Keyboard () | |
size_t | size () const |
void | resize (size_t newSize) |
void | changeKeyboardConfiguration (int numberOfKeys, int keyNumberOfA) |
Change keyboard configuration. More... | |
void | clearAllKeys () |
Clear all keys completely. More... | |
void | clearComputedPitches () |
Set all computed pitches to zero. More... | |
void | clearTunedPitches () |
Set all tuned pitches to zero. More... | |
void | clearOverpulls () |
Set all overpull markers to zero. More... | |
const Key & | operator[] (size_t i) const |
Key & | operator[] (size_t i) |
const Key & | at (size_t i) const |
Key & | at (size_t i) |
const Key * | getKeyPtr (int i) const |
Get pointer to a key with a given number, returning nullptr if the number is out of range (read-only version). More... | |
Key * | getKeyPtr (int i) |
Get pointer to a key with a given number, returning nullptr if the number is out of range (read-write version). More... | |
Keys & | getKeys () |
int | getNumberOfKeys () const |
int | getKeyNumberOfA4 () const |
int & | getKeyNumberOfA4 () |
int | getNumberOfBassKeys () const |
int & | getNumberOfBassKeys () |
void | setNumberOfBassKeys (int keys) |
std::string | getNoteName (int keynumber) const |
Get the name of the key as a string. More... | |
piano::KeyColor | getKeyColor (int keynumber) const |
Get the color of the key (black / white) More... | |
Private Attributes | |
Keys | mKeys |
Vector holding the keys. More... | |
int | mKeyNumberOfA4 |
Index of the key A4 (440Hz) More... | |
int | mNumberOfBassKeys |
Number of keys on bass bridge. More... | |
Class describing the piano keyboard, holding a collection of keys.
This class describes all data related to the keyboard of the piano. The most important data is a vector of keys. In addition, this class tells us where the key A4 is located and how many of the keys belong to the bass bridge.
Definition at line 39 of file keyboard.h.
using Keyboard::Keys = std::vector<Key> |
Definition at line 42 of file keyboard.h.
Keyboard::Keyboard | ( | size_t | initialSize | ) |
Keyboard constructor.
initialSize | : Initial size of the keyboard (standard = 88) |
Definition at line 33 of file keyboard.cpp.
|
inline |
Definition at line 46 of file keyboard.h.
|
inline |
Definition at line 61 of file keyboard.h.
|
inline |
Definition at line 62 of file keyboard.h.
void Keyboard::changeKeyboardConfiguration | ( | int | numberOfKeys, |
int | keyNumberOfA | ||
) |
Change keyboard configuration.
This function allows the configuration (size and location of A4) to be changed while the application is running. Keys for which data is available are automatically shifted to the new component.
numberOfKeys | : new number of piano keys (standard 88). |
keyNumberOfA | : New index of A4 key (standard 48, counting from 0) |
Definition at line 73 of file keyboard.cpp.
void Keyboard::clearAllKeys | ( | ) |
Clear all keys completely.
Definition at line 45 of file keyboard.cpp.
void Keyboard::clearComputedPitches | ( | ) |
Set all computed pitches to zero.
Definition at line 48 of file keyboard.cpp.
void Keyboard::clearOverpulls | ( | ) |
Set all overpull markers to zero.
Definition at line 54 of file keyboard.cpp.
void Keyboard::clearTunedPitches | ( | ) |
Set all tuned pitches to zero.
Definition at line 51 of file keyboard.cpp.
piano::KeyColor Keyboard::getKeyColor | ( | int | keynumber | ) | const |
Get the color of the key (black / white)
keynumber | : Number of the key |
Definition at line 160 of file keyboard.cpp.
|
inline |
Definition at line 73 of file keyboard.h.
|
inline |
Definition at line 74 of file keyboard.h.
const Key * Keyboard::getKeyPtr | ( | int | i | ) | const |
Get pointer to a key with a given number, returning nullptr if the number is out of range (read-only version).
i | : Number of the key |
Definition at line 104 of file keyboard.cpp.
Key * Keyboard::getKeyPtr | ( | int | i | ) |
Get pointer to a key with a given number, returning nullptr if the number is out of range (read-write version).
i | : Number of the key |
Definition at line 117 of file keyboard.cpp.
|
inline |
Definition at line 69 of file keyboard.h.
std::string Keyboard::getNoteName | ( | int | keynumber | ) | const |
Get the name of the key as a string.
keynumber | : Number of the key |
Definition at line 135 of file keyboard.cpp.
|
inline |
Definition at line 75 of file keyboard.h.
|
inline |
Definition at line 76 of file keyboard.h.
|
inline |
|
inline |
Definition at line 59 of file keyboard.h.
|
inline |
Definition at line 60 of file keyboard.h.
|
inline |
Definition at line 49 of file keyboard.h.
|
inline |
Definition at line 77 of file keyboard.h.
|
inline |
Definition at line 48 of file keyboard.h.
|
private |
Index of the key A4 (440Hz)
Definition at line 86 of file keyboard.h.
|
private |
Vector holding the keys.
Definition at line 85 of file keyboard.h.
|
private |
Number of keys on bass bridge.
Definition at line 87 of file keyboard.h.