Commit 384e08f7 authored by TJ Horner's avatar TJ Horner

sysex I think

parent 51c2b68d
......@@ -28,6 +28,11 @@ function Button(launchpad, note){
launchpad._output.sendMessage([144, self.toNote(), color]);
}
// rgb values 0-63 I think
this.setRgbColor = function(r, g, b){
launchpad._output.sendMessage([240, 0, 32, 41, 2, 16, 11, self.toNote(), r, g, b, 247]);
}
this.getColor = function(){
return self.color;
}
......
......@@ -60,8 +60,19 @@ function Launchpad(params){
});
}
this.forceBootloader = function(){
self._output.sendMessage([240, 0, 32, 41, 2, 16, 0, 105, 247]);
// defunct for now
this.sendSysEx = function(bytes){
// sysex header
var message = [240, 0, 32, 41, 2, 16];
// sysex message
message.concat(bytes);
// sysex terminator
message.push(247);
self._output.sendMessage(message);
}
this.toLayout = function(layout){
self._output.sendMessage([240, 0, 32, 41, 2, 16, 44, layout, 247]);
}
return this;
......@@ -72,5 +83,11 @@ util.inherits(Launchpad, EventEmitter);
module.exports = {
connect: Launchpad,
types: types,
getColor: color.getLaunchpadColor
getColor: color.getLaunchpadColor,
layouts: {
NOTE: 0,
DRUM: 1,
FADE: 2,
PROGRAMMER: 3
}
};
{
"name": "launchpad-mk2",
"version": "1.0.3",
"version": "1.0.4",
"description": "Node module for interfacing with the Launchpad MK2 and Launchpad Pro",
"repository": "https://github.com/tjhorner/node-launchpad-mk2",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
......
// TODO: actual tests
var Launchpad = require('..'),
launchpad = new Launchpad.connect({
in: 0,
out: 1,
in: 1,
out: 2,
type: Launchpad.types.PRO
});
launchpad.toLayout(Launchpad.layouts.PROGRAMMER);
launchpad.darkAll();
// launchpad.getButton(8, 1).setColor(Launchpad.getColor(255, 0, 0));
......@@ -16,6 +18,6 @@ launchpad.darkAll();
launchpad.on("press", function(button, velocity){
console.log("Button", button.x, button.y, "pressed with velocity", velocity);
button.setColor(Math.floor((Math.random() * 127) + 1));
// button.setRgbColor(30, 10, 0);
if(button.x === 1 && button.y === 0) launchpad.darkAll();
launchpad.forceBootloader();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment