|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groovemanager.gui.custom.CustomComposite
com.groovemanager.gui.custom.mc909.Mc909KeyComposite
A Mc909KeyComposite contains a number of Mc909Keys aligned as on the MC-909 itself. It can send and receive MIDI note on/off events
| Nested Class Summary | |
|---|---|
private class |
Mc909KeyComposite.NumCanvas
This class is used drawing the pad numbers above the Mc909Keys |
| Field Summary | |
|---|---|
private static int[] |
ACCEPT_TYPES
Array of MIDI message types accepted |
private int |
channel
The channel to send the MIDI data to |
private int |
firstKey
Note value of the first key to be displayed in this composite from 0 to 127 |
protected static int |
KEY_HEIGHT
Constant for the width of one key in pixels |
protected static int |
KEY_WIDTH
Constant for the width of one key in pixels |
protected Mc909Key[] |
keys
The Mc909Keys contained in this Composite |
private int |
lastKey
Note value of the last key to be displayed in this composite from 0 to 127 |
private java.util.ArrayList |
listeners
List of KeyboardKeyListeners registered with this Composite |
private MIDIManager |
midiManager
The MIDIManager used for sending and receiving MIDI events |
private long[] |
noteOnIds
The note on ids from the last sent note on events for each key |
private boolean |
receiveMIDI
Indicates whether this Composite should react to incoming MIDI messages or not |
private java.lang.Runnable |
receiver
Runnable for thread-safe reaction to incoming MIDI events |
private boolean |
sendMIDI
Indicates whether this Composite should send MIDI events when the keys are being pressed or not |
private javax.sound.midi.ShortMessage |
sm
Last received ShortMessage |
private int |
velocity
The velocity used for sending MIDI note on events |
| Constructor Summary | |
|---|---|
Mc909KeyComposite(org.eclipse.swt.widgets.Composite parent,
int lowKey,
int highKey)
Construct a new Mc909KeyComposite using the default MIDIManager |
|
Mc909KeyComposite(org.eclipse.swt.widgets.Composite parent,
int lowKey,
int highKey,
MIDIManager manager)
Construct a new Mc909KeyComposite using the specified MIDIManager |
|
| Method Summary | |
|---|---|
void |
addKeyListener(KeyboardKeyListener listener)
Add a KeyboardKeyListener that will be notified when one this composite´s keys is pressed. |
protected org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
int style)
This method is to be overwritten by concrete subclasses to create the real contents of this CustomComposite |
protected Mc909Key[] |
createKeys(org.eclipse.swt.widgets.Composite parent,
int firstKey,
int lastKey)
Internal method for creating the Mc909Keys |
protected org.eclipse.swt.widgets.Composite |
createPadComp(org.eclipse.swt.widgets.Composite parent)
Internal method for creating the composite containing the keys |
protected org.eclipse.swt.widgets.Composite |
createTopComp(org.eclipse.swt.widgets.Composite parent)
Internal method for creating the top method which contains the pad numbers for the keys 59 to 74 |
int |
getChannel()
Get the channel used for sending MIDI events |
protected int[] |
getListenerTypes()
For all types of listeners that should be possible to add to this Composite directly, the corresponding SWT.* constant should be contained in the returned Array. |
protected int |
getPossibleStyles()
Get a combination of all allowed SWT.* style constants |
int |
getVelocity()
Gete the velocity value used for sending MIDI notes |
void |
keyPressed(int key)
Notification that a KeyboardKey has been pressed |
void |
keyReleased(int key)
Notification that a KeyboardKey has been released |
void |
processMessage(javax.sound.midi.MidiMessage m)
Notification about an incoming MIDI event |
void |
removeKeyListener(KeyboardKeyListener listener)
Remove a registered KeyboardKeyListener from this composite |
void |
setChannel(int channel)
Set the channel used for sending MIDI events |
void |
setHold(boolean hold)
Set the hold behaviour for all keys |
void |
setNotesVisible(boolean visible)
Set the visibility of the note name on all keys |
void |
setReceiveMidi(boolean receive)
Set, if this composite should react to incoming MIDI note on/off events |
void |
setSendMIDI(boolean send)
Set, if this compopsite´s keys should send MIDI events when pressed or released |
void |
setVelocity(int vel)
Set the velocity for sending MIDI notes |
| Methods inherited from class com.groovemanager.gui.custom.CustomComposite |
|---|
addListener, checkStyle, getComposite, getData, getListeners, getParent, removeListener, setData, setLayoutData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int[] ACCEPT_TYPES
private int channel
private final int firstKey
protected static final int KEY_HEIGHT
protected static final int KEY_WIDTH
protected Mc909Key[] keys
private final int lastKey
private java.util.ArrayList listeners
private MIDIManager midiManager
private long[] noteOnIds
private boolean receiveMIDI
private java.lang.Runnable receiver
private boolean sendMIDI
private javax.sound.midi.ShortMessage sm
private int velocity
| Constructor Detail |
|---|
public Mc909KeyComposite(org.eclipse.swt.widgets.Composite parent,
int lowKey,
int highKey)
parent - The parent compositelowKey - The note value of the lowest key to display from 0 to 127highKey - The note value of the highest key to display from 0 to 127
public Mc909KeyComposite(org.eclipse.swt.widgets.Composite parent,
int lowKey,
int highKey,
MIDIManager manager)
parent - The parent compositelowKey - The note value of the lowest key to display from 0 to 127highKey - The note value of the highest key to display from 0 to 127manager - The MIDIManager to use for in- and output| Method Detail |
|---|
public void addKeyListener(KeyboardKeyListener listener)
listener - The KeyboardKeyListener to add
protected org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent,
int style)
CustomComposite
createComposite in class CustomCompositeparent - The parent Composite under which this Composite should
be createdstyle - Combination of valid SWT.* style constants
CustomComposite.createComposite(org.eclipse.swt.widgets.Composite, int)
protected Mc909Key[] createKeys(org.eclipse.swt.widgets.Composite parent,
int firstKey,
int lastKey)
parent - The parent CompositefirstKey - Note value of the lowest key from 0 to 127lastKey - Note value of the highest key from 0 to 127
protected org.eclipse.swt.widgets.Composite createPadComp(org.eclipse.swt.widgets.Composite parent)
protected org.eclipse.swt.widgets.Composite createTopComp(org.eclipse.swt.widgets.Composite parent)
parent - The parent composite
public int getChannel()
protected int[] getListenerTypes()
CustomComposite
getListenerTypes in class CustomCompositeCustomComposite.getListenerTypes()protected int getPossibleStyles()
CustomComposite
getPossibleStyles in class CustomCompositeSWT.BORDER | SWT.LEFT | SWT.BORDERCustomComposite.getPossibleStyles()public int getVelocity()
public void keyPressed(int key)
KeyboardKeyListener
keyPressed in interface KeyboardKeyListenerkey - The note value of the key that has been pressed in the range
from 0 to 127KeyboardKeyListener.keyPressed(int)public void keyReleased(int key)
KeyboardKeyListener
keyReleased in interface KeyboardKeyListenerkey - The note value of the key that has been released in the range
from 0 to 127KeyboardKeyListener.keyReleased(int)public void processMessage(javax.sound.midi.MidiMessage m)
MIDIListener
processMessage in interface MIDIListenerm - The MidiMessage that just came inMIDIListener.processMessage(javax.sound.midi.MidiMessage)public void removeKeyListener(KeyboardKeyListener listener)
listener - The KeyboardKeyListener to removepublic void setChannel(int channel)
channel - The channel to send MIDI messages on between 0 and 15public void setHold(boolean hold)
hold - The new hold behaviourpublic void setNotesVisible(boolean visible)
visible - true, if the note name and octave should be displayed on
each key, false otherwisepublic void setReceiveMidi(boolean receive)
receive - true, if incoming MIDI events should be handled, false
otherwisepublic void setSendMIDI(boolean send)
send - true, if the keys should send MIDI, false otherwisepublic void setVelocity(int vel)
vel - The new velocity form 0 to 127
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||