public class Launchpad extends Object
Launchpad provides access to a Launchpad via the midi-device. To
create an instance provide the device-file as a File or
String with the path. As this requires a read-thread, you need to
start() the Launchpad after you created it.
To get a notication when a button is pressed on the Launchpad you can add a
LaunchpadHandler with addHandler(LaunchpadHandler) (see
LaunchpadHandler on more information on building a
LaunchpadHandler.| Constructor and Description |
|---|
Launchpad(File device)
The communication with the device uses a character-device.
|
Launchpad(String device)
The communication with the device uses a character-device.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(LaunchpadHandler handler)
Adds a
LaunchpadHandler to the Launchpad instance. |
boolean |
isAlive()
Verify if the asynchronous
Thread to read is alive. |
boolean |
isInterrupted()
Verify if the asynchronous
Thread to read is interrupted. |
void |
off(int x,
int y)
Switch a LED at a coordinates to off.
|
void |
send(MidiCommand command)
Send a
MidiCommand to the Launchpad. |
void |
set(int x,
int y,
Color c)
Switch a LED at a coordinates to a
Color. |
void |
start()
Start the asynchronous
Thread to read events of the Launchpad. |
public Launchpad(File device) throws FileNotFoundException
device - File pointing to the blockdevice of a midi controller.FileNotFoundException - This exception is raised, when the device can not be found or
accessedpublic Launchpad(String device) throws FileNotFoundException
device - String of the path pointing to the blockdevice of a midi
controller.FileNotFoundException - This exception is raised, when the device can not be found or
accessedpublic void start()
Thread to read events of the Launchpad.public boolean isAlive()
Thread to read is alive.Thread to read is alive.public boolean isInterrupted()
Thread to read is interrupted.Thread to read is interrupted.public void addHandler(LaunchpadHandler handler)
LaunchpadHandler to the Launchpad instance. The
LaunchpadHandler is now notified whenever a event is sent from
the Launchpad.handler - The LaunchpadHandler to be informed of events from the
Launchpad.public void send(MidiCommand command) throws IOException
MidiCommand to the Launchpad.command - The MidiCommand to be sent to the Launchpad.IOException - Information on why a MidiCommand could not be sent.public void off(int x,
int y)
throws IOException
x - The x-coordinate of the LED to be switched off (0-16).y - The y-coordinate of the LED to be switched off (0-16).IOException - Information on why a MidiCommand could not be sent.public void set(int x,
int y,
Color c)
throws IOException
Color.x - The x-coordinate of the LED to be switched off (0-16).y - The y-coordinate of the LED to be switched off (0-16).IOException - Information on why a MidiCommand could not be sent.Copyright © 2016. All Rights Reserved.