-
Notifications
You must be signed in to change notification settings - Fork 0
This page describes the public API of LaunchpadJS. To see it in use, look at the example
The launchpad
namespace is used to expose all the functionality that LaunchpadJS offers.
The connect
method is used to create a connection with a Launchpad. Per default it tries to connect to a Launchpad Mini
. You override the default by providing an options hash as argument with a key name
and value the name of the corresponding Launchpad.
connect
returns a promise. If the promise resolves correctly it returns a Launchpad
.
If you do not know the name of your Launchpad you can list all connected midi devices with the following code.
navigator
.requestMIDIAccess({sysex: false})
.then(function(midiAccess){
for(var input of midiAccess.inputs.values()){
console.log(input.name)
};
});
Object that interfaces with the physical Launchpad. You can use it to either lookup buttons or register press
and release
events.
Turns off all the buttons of the Launchpad.
-
id the
id
for the button or -
x, y the
x
andy
coordinates for the button
Returns a Button
from the Launchpad. Each button has an id
that can be found from the x
and y
coordinates in the following fashion.
var id = 16 * y + x;
The allowed x
values are [0, 1, 2, 3, 4, 5, 6, 7, 8]
and the allowed y
values are [0, 1, 2, 3, 4, 5, 6, 7]
.
-
id the
id
for the button
Returns a control button, i.e. a button in the top row. The allowed values for id
are [0, 1, 2, 3, 4, 5, 6, 7]
.
- 'press', callback register a callbacks for when a button is pressed or
- 'release', callback register a callback for when a button is released.
The callbacks are functions that accept one Button
argument.
An object to interact with a physical button.
- 'color' the color the button should turn in to.
The allowed colors are 'off', 'red', 'green', 'orange'
. To change or add color names, alter launchpad.defaults.paintNames
.
- hash a hash of paint values
The hash
arguments should have the keys red
and green
and values in the range [0, 1, 2, 3]
.
Return true
if the button is a control button, false
otherwise.