Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(portName = 'Ableton Push 2 User Port', virtual = false) {
super();
// console.log(`Initializing ${portName}`);
this._input = new easymidi.Input(portName, virtual);
this._output = new easymidi.Output(portName, virtual);
this._input.on('message', (msg) => {
// Emit all messages as 'message' events, plus each individual type separately.
this.emit(msg._type, msg);
this.emit('message', msg);
});
}
/**
deviceName = 'NodeJS MIDI out',
verbose = process.argv.indexOf("--verbose")>-1;
if (process.platform === "win32") {
// find the loopmidi 'NodeJS MIDI out' virtual port
var outputs = easymidi.getOutputs();
outputs.some(name => {
console.log(name, deviceName);
if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
out = new easymidi.Output(name);
return true;
}
return false;
});
} else {
out = new easymidi.Output(deviceName, true);
}
app.use(express.static(path.join(__dirname,'public')));
app.get('/socket.io.js', function(req, res) {
res.sendFile('socket.io.js', {
root: path.join(__dirname, 'node_modules', 'socket.io-client', 'dist')
});
});
var http = require('http'),
server = http.Server(app),
io = socketio(server);
io.sockets.on('connection', function(socket) {
console.log("User Connected");
outputs.some(name => {
console.log(name, deviceName);
if (name.toLowerCase().indexOf(deviceName.toLowerCase()) > -1) {
out = new easymidi.Output(name);
return true;
}
return false;
});
} else {