Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupPush () {
const push = this;
push.output = WebMidi.getOutputByName('Ableton Push 2 User Port');
push.input = WebMidi.getInputByName('Ableton Push 2 User Port');
if (!push.input || !push.output) {
log('push not connected');
push.emit('push:failed');
return;
}
push.input.addListener('sysex', 'all', (e) => {
log('sysex', e);
});
// Listen to control change message on all channels
push.input.addListener('controlchange', 'all', (e) => {
log('Received \'controlchange\' message.', e);
if (e.controller) {
const name = e.controller.name;
function midiOutOnChange(ev) {
if (this.value !== 'No Output') {
Instruments.mute(true, useChordsInstrument);
midiOut = WebMidi.getOutputByName(this.value);
}
else {
Instruments.mute(false, useChordsInstrument);
midiOut = dummyMidiOut;
}
log.info('Selected MIDI out: ' + this.value);
};
this._magenta.instances().forEach((instance) => {
this._magenta.updatePort(WebMidi.getOutputByName(instance.portName()))
})