class NoteChooser


Include Files

Description

This widget displays a NoteChooser.   Notes can be chosen on the piano keyboard or with the slider.  A readout shows the frequency of the chosen note.


Methods


NoteChooser::NoteChooser(int x, int y, int w, int h, const char *label = 0)

Creates a new NoteChooser widget using the given position, size, and label string.

virtual NoteChooser::~NoteChooser()

Destroys the NoteChooser widget and all of its data.

void notes (int n0, int n1)
int n0()
int n1()

Get and set the lowest and highest notes on the keyboard.  Notes are integers; zero is middle C, 12 is an octave above middle C, -12 is an octave below middle C.  If the values passed are black keys they will be changed to the adjacent white key.

double value()
void value (double x)

Get and set the value.

static double f2n (double f)
static double n2f (double n)

Convert between note numbers and frequencies.

static double nOE (double n)


Returns the octave-equivalent value for the note number, always >=0 and <12.  For example, nOE(24.5) = .5.

static const char * notename (int n)

Returns a 3-character string representing the closest note name.  The symbols '+' and '-' are used to indicate sharp or flat relative to the given note name; for example, C#+ means sharper than a true C#, but closer to C# than to D.