com.rngtng.launchpad
Class Launchpad

java.lang.Object
  extended by com.rngtng.launchpad.Launchpad
All Implemented Interfaces:
LMidiCodes, themidibus.MidiListener, themidibus.StandardMidiListener

public class Launchpad
extends java.lang.Object
implements LMidiCodes, themidibus.StandardMidiListener

This is the Main class to control your Launchpad. Please the Docs and Examples for usage

Author:
rngtng - Tobias Bielohlawek
+Example
import com.rngtng.launchpad.*;

Launchpad launchpad;

void setup() {
  size(400,400);
  launchpad = new Launchpad(this);
}

void draw() {
  background(0);   
  for(int y = 0; y < launchpad.height; y++) {
    for(int x = 0; x < launchpad.width; x++) {    
      launchpad.changeGrid(x, y, LColor.RED_HIGH);
      delay(100);  
    }  
  }
}

Field Summary
static int height
           
 java.lang.String VERSION
           
static int width
           
 
Fields inherited from interface com.rngtng.launchpad.LMidiCodes
BUFFER0, BUFFER1, GRIDLAYOUT_DRUM_RACK, GRIDLAYOUT_XY, MODE_COPY, MODE_FLASHING, STATUS_CC, STATUS_MULTI, STATUS_NIL, STATUS_OFF, STATUS_ON, VELOCITY_TEST_LEDS
 
Constructor Summary
Launchpad(processing.core.PApplet _app)
           
Launchpad(processing.core.PApplet _app, java.lang.String inputName, java.lang.String outputName)
          a Constructor, usually called in the setup() method in your sketch to initialize and start the library.
 
Method Summary
 boolean addListener(LaunchpadListener listener)
          Adds a listener who will be notified each time a new MIDI message is received from a MIDI input device.
 void bufferingMode(int display_buffer, int update_buffer)
          Controls the two buffers.
 void bufferingMode(int display_buffer, int update_buffer, int flags)
          Controls the two buffers.
 void changeAll(int[] colors)
          Changes all buttons in batch mode.
 void changeAll(LColor[] colors)
          Changes all buttons in batch mode.
 void changeAll(processing.core.PImage image)
          Changes all buttons in batch mode.
 void changeButton(int button, int color)
          Changes a single Control or Scene Button.
 void changeButton(int button, LColor c)
          Changes a single Control or Scene Button.
 void changeGrid(int x, int y, int color)
          Changes a single Button on the Grid.
 void changeGrid(int x, int y, LColor c)
          Changes a single Button on the Grid.
 void changeSceneButton(int button, int color)
          Changes a single Control or Scene Button.
 void changeSceneButton(int button, LColor c)
          Changes a single Control or Scene Button.
 boolean connected()
           
 void dispose()
           
 void flashingAuto()
          Starts flashing LEDs marked as flashing automatically.
 void flashingOff()
          Switches LEDs marked as flashing off when using custom timer for flashing.
 void flashingOn()
          Switches LEDs marked as flashing on when using custom timer for flashing.
 void midiMessage(javax.sound.midi.MidiMessage message, long timestamp)
          Reads user actions (button presses/releases) that haven't been handled yet and invokes a button or grid event
 boolean removeListener(LaunchpadListener listener)
          Removes a given listener.
 void reset()
          Resets the launchpad - all settings are reset and all LEDs are switched off.
 void testLeds()
          Lights all LEDs (for testing purposes).
 void testLeds(int brightness)
          Lights all LEDs (for testing purposes).
 java.lang.String version()
          return the version of the library.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

public static int width

height

public static int height

VERSION

public final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

Launchpad

public Launchpad(processing.core.PApplet _app)

Launchpad

public Launchpad(processing.core.PApplet _app,
                 java.lang.String inputName,
                 java.lang.String outputName)
a Constructor, usually called in the setup() method in your sketch to initialize and start the library.

Parameters:
_app - parent Applet
inputName - name of MIDI input Device
outputName - name of MIDI output Device
+Example
import com.rngtng.launchpad.*;

Launchpad launchpad;

void setup() {
  size(400,400);
  launchpad = new Launchpad(this);
}

void draw() {
  background(0);   
  for(int y = 0; y < launchpad.height; y++) {
    for(int x = 0; x < launchpad.width; x++) {    
      launchpad.changeGrid(x, y, LColor.RED_HIGH);
      delay(100);  
    }  
  }
}
Method Detail

dispose

public void dispose()

version

public java.lang.String version()
return the version of the library.

Returns:
String version number

connected

public boolean connected()
Returns:
wheter launchpad is connected

addListener

public boolean addListener(LaunchpadListener listener)
Adds a listener who will be notified each time a new MIDI message is received from a MIDI input device. If the listener has already been added, it will not be added again.

Parameters:
listener - the listener to add.
Returns:
true if and only the listener was successfully added.
See Also:
removeListener(LaunchpadListener listener)

removeListener

public boolean removeListener(LaunchpadListener listener)
Removes a given listener.

Parameters:
listener - the listener to remove.
Returns:
true if and only the listener was successfully removed.
See Also:
addListener(LaunchpadListener listener)

reset

public void reset()
Resets the launchpad - all settings are reset and all LEDs are switched off. Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled


testLeds

public void testLeds()
Lights all LEDs (for testing purposes). Parameters (see Launchpad for values): Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled


testLeds

public void testLeds(int brightness)
Lights all LEDs (for testing purposes). Parameters (see Launchpad for values):

Parameters:
brightness - brightness of both LEDs for all buttons Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled

changeButton

public void changeButton(int button,
                         int color)
Changes a single Control or Scene Button. Specify the Button by its name

Parameters:
button - value of the button (number or code)
color - color value Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeButton

public void changeButton(int button,
                         LColor c)
Changes a single Control or Scene Button. Specify the Button by its name

Parameters:
button - value of the button (number or code)
c - LColor object Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeSceneButton

public void changeSceneButton(int button,
                              int color)
Changes a single Control or Scene Button. Specify the Button by its name

Parameters:
button - value of the button (number or code)
color - color value Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeSceneButton

public void changeSceneButton(int button,
                              LColor c)
Changes a single Control or Scene Button. Specify the Button by its name

Parameters:
button - value of the button (number or code)
c - LColor object Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeGrid

public void changeGrid(int x,
                       int y,
                       int color)
Changes a single Button on the Grid. Specify the Button by its x & y coordinates

Parameters:
x - x coordinate
y - y coordinate
color - color value Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeGrid

public void changeGrid(int x,
                       int y,
                       LColor c)
Changes a single Button on the Grid. Specify the Button by its x & y coordinates

Parameters:
x - x coordinate
y - y coordinate
c - LColor object Errors raised: [Launchpad::NoValidGridCoordinatesError] when coordinates aren't within the valid range [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeAll

public void changeAll(LColor[] colors)
Changes all buttons in batch mode. First 64 are the buttons on the grid, then the scene buttons (top to bottom) followed by the control buttons (left to right). Maximum 80 values - excessive values will be ignored, missing values will be filled with 0

Parameters:
colors - an array of Colors
See Also:
Errors raised: [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeAll

public void changeAll(int[] colors)
Changes all buttons in batch mode. First 64 are the buttons on the grid, then the scene buttons (top to bottom) followed by the control buttons (left to right). Maximum 80 values - excessive values will be ignored, missing values will be filled with 0

Parameters:
colors - an array of integers Errors raised: [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

changeAll

public void changeAll(processing.core.PImage image)
Changes all buttons in batch mode. Using the pixel data of an PImage

Parameters:
image - an PImage object Errors raised: [Launchpad::NoValidBrightnessError] when brightness values aren't within the valid range [Launchpad::NoOutputAllowedError] when output is not enabled

flashingOn

public void flashingOn()
Switches LEDs marked as flashing on when using custom timer for flashing. Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled


flashingOff

public void flashingOff()
Switches LEDs marked as flashing off when using custom timer for flashing. Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled


flashingAuto

public void flashingAuto()
Starts flashing LEDs marked as flashing automatically. Stop flashing by calling flashing_on or flashing_off. Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled


bufferingMode

public void bufferingMode(int display_buffer,
                          int update_buffer)
Controls the two buffers.

Parameters:
display_buffer - which buffer to use for display, defaults to +0+
update_buffer - which buffer to use for updates when :mode is set to :buffering, defaults to +0+ (see change) Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled

bufferingMode

public void bufferingMode(int display_buffer,
                          int update_buffer,
                          int flags)
Controls the two buffers.

Parameters:
display_buffer - which buffer to use for display, defaults to +0+
update_buffer - which buffer to use for updates when :mode is set to :buffering, defaults to +0+ (see change)
flags - values to control FLASHING and COPY Errors raised: [Launchpad::NoOutputAllowedError] when output is not enabled

midiMessage

public void midiMessage(javax.sound.midi.MidiMessage message,
                        long timestamp)
Reads user actions (button presses/releases) that haven't been handled yet and invokes a button or grid event

Specified by:
midiMessage in interface themidibus.StandardMidiListener
Parameters:
message - the MIDI message Errors raised: [Launchpad::NoInputAllowedError] when input is not enabled


processing library launchpad by rngtng - Tobias Bielohlawek. (c) 2011