Merge pull request #1 from jxzhe/main

2 bug fixes
This commit is contained in:
Wiwi Kuan 2023-04-03 19:16:50 +08:00 committed by GitHub
commit 2d26894452
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,12 +58,16 @@ WebMidi.enable(function (err) { //check if WebMidi.js is enabled
} }
midiSelectSlider = select("#slider"); midiSelectSlider = select("#slider");
midiSelectSlider.attribute("max", WebMidi.inputs.length - 1); midiSelectSlider.attribute("max", WebMidi.inputs.length - 1);
midiSelectSlider.changed(inputChanged); midiSelectSlider.input(inputChanged);
midiIn = WebMidi.inputs[midiSelectSlider.value()] midiIn = WebMidi.inputs[midiSelectSlider.value()]
inputChanged(); inputChanged();
}); });
function inputChanged() { function inputChanged() {
isKeyOn.fill(0);
controllerChange(64, 0);
controllerChange(67, 0);
midiIn.removeListener(); midiIn.removeListener();
midiIn = WebMidi.inputs[midiSelectSlider.value()]; midiIn = WebMidi.inputs[midiSelectSlider.value()];
midiIn.addListener('noteon', "all", function (e) { midiIn.addListener('noteon', "all", function (e) {