Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions launchpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var midi = require('midi');
* Launchpad
* Represents the launchpad as a whole
*/
var Launchpad = function(port, initAnimation) {
var Launchpad = function(inputPort, outputPort, initAnimation) {
if (initAnimation === undefined) initAnimation = true;
var name = 0;
var row = 0;
Expand Down Expand Up @@ -197,20 +197,20 @@ var Launchpad = function(port, initAnimation) {
this.createButtons();

// Open the first available output port.
this.output.openPort(port);
this.input.openPort(port);
this.output.openPort(outputPort);
this.input.openPort(inputPort);

// Configure a callback.
this.input.on('message', function(deltaTime, message) {
that.receiveMessage(deltaTime, message);
});

console.log("running launchpad: "+this.output.getPortName(port));
console.log("running launchpad: "+this.output.getPortName(outputPort));

this.initialize();
};

console.log("setting up Launchpad on port:"+port);
console.log("setting up Launchpad on port:"+inputPort+"/"+outputPort);
this.init();

};
Expand Down Expand Up @@ -367,6 +367,6 @@ exports.colors = Launchpad.prototype.colors = {

exports.Launchpad = Launchpad;

exports.connect = function(port, initAnimation) {
return new Launchpad(port, initAnimation);
};
exports.connect = function(inputPort, outputPort, initAnimation) {
return new Launchpad(inputPort, outputPort, initAnimation);
};