class Fl_Piano

Include Files

#include "Fl_Piano.h"


This piano keyboard widget is a subclass of Fl_Group.

Fl_Piano image


Fl_Piano::Fl_Piano(int x, int y, int w, int h)

Creates a new Fl_Piano widget using the given position and size.

void setKey (int n)

Set a key on, turning all other keys off.

void addKey (int n, int val=1)

Set a key to value, leaving other keys unchanged.

bool isSet (int n)

Returns 1 if key n is selected, 0 if it is not.

void setAllOff ()

Unselects all keys.

int value()

Get the number of the last key pressed.

void setBounds (int lo, int hi)
int lowNote()
int highNote()

Get and set the lowest and highest notes on the keyboard. Notes are integers: zero is middle C, 12 is an octave higher, -12 is an octave lower, etc.

int direction()
void setDirection (int x)

Get and set the direction the piano faces:
north = 0, west = 1, south = 2, east = 3

int allowMultiple()
void setAllowMultiple (int x)

Set and get the flag allowing multiple keys to be selected at once. Calling addKey() automatically sets this flag.