millerpeterson / js-launchpad

Node.js module for working with the Novation Launchpad MIDI controller.
7 stars 0 forks source link

Double-triggering when using a custom device name #1

Open johnwright opened 9 years ago

johnwright commented 9 years ago

Firstly, thanks for this library, it's helped me get up and running with a Launchpad Mini in just an afternoon!

I followed the instructions in the README to configure a custom device name, since the Mini uses /Lauchpad Mini/ instead of the default.

When setting up the input alone, it's fine. However, after the output is set up, every press event results in double-triggering listeners on the input (i.e. two events per press instead of one).

Looking at the source, it wasn't immediately obvious to me what's causing this, but I suspect it's related to sharing the same MIDI interface object between the input and output objects. My current workaround is to create two separate MIDI interface objects and pass them to the input and output init() methods respectively, like this:

var launchpad = require('phi-launchpad');
var MidiInterface = require('phi-launchpad/lib/node_midi_interface').midi;

var lin = new launchpad.input();
lin.init(new MidiInterface(/Launchpad Mini/));

var lout = new launchpad.output();
lout.init(new MidiInterface(/Launchpad Mini/));
millerpeterson commented 8 years ago

Hm that's interesting. I'm gonna do some rethinking of the arguments you pass to the constructor / init - maybe the whole thing of passing in a midi interface is overkill. It should just be the device name.