openpiano.piano
Class Piano

java.lang.Object
  extended by openpiano.piano.Piano

public class Piano
extends Object

The Piano class loads a 3D-piano and handles the animations of keys

Version:
1.0, 07/30/08
Author:
Sascha Westermann

Constructor Summary
Piano(Controller controller, javax.media.opengl.GL gl)
          Constructs a 3D-piano with 88 keys
 
Method Summary
 Boolean isKeyMarked(int key)
          Return true if the key is marked
 void releaseAllKeys()
          Release all keys
 void sendKey(int key, int velocity, Boolean autoPlayed)
          Sends played notes to the piano and shows them
 void setKeyMarker(int key, int color, float factor)
          Sets the depth of the color of a key
 void setKeyMarkerOff(int key)
          Sets the key's color off
 void showPiano()
          Draws the piano
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Piano

public Piano(Controller controller,
             javax.media.opengl.GL gl)
Constructs a 3D-piano with 88 keys

Parameters:
controller - the main controller of the application
gl - the relevant GL context
Method Detail

isKeyMarked

public Boolean isKeyMarked(int key)
Return true if the key is marked

Parameters:
key - the affected key
Returns:
true if key is marked

releaseAllKeys

public void releaseAllKeys()
Release all keys


sendKey

public void sendKey(int key,
                    int velocity,
                    Boolean autoPlayed)
Sends played notes to the piano and shows them

Parameters:
key - the affected key
velocity - the velocity of the key, a velocity of 0 means release key
autoPlayed - true if the application, false if the user activated the key

setKeyMarker

public void setKeyMarker(int key,
                         int color,
                         float factor)
Sets the depth of the color of a key

Parameters:
key - the affected key
color - the color of the affected key
factor - the depth factor of the color (0.0 - 1.0)

setKeyMarkerOff

public void setKeyMarkerOff(int key)
Sets the key's color off

Parameters:
key - the affected key

showPiano

public void showPiano()
Draws the piano