diff --git a/index.html b/index.html index 8fc8dc2..555b584 100644 --- a/index.html +++ b/index.html @@ -2168,6 +2168,7 @@ function addAllPrimitives(){ } function startExperience(){ + startWebMIDI() if (AFRAME.utils.device.checkHeadsetConnected()) AFRAME.scenes[0].enterVR(); document.querySelector("#snapping-sound").components.sound.playSound(); @@ -2414,15 +2415,17 @@ async function moveMannequinPartExample(mannequin=0){ people[mannequin].head.tilt -= distance } -//doesnt seem to be sufficient to call directly from here, works from the console though. -WebMidi.enable().then(() => webMidiStarted() ).catch(err => alert(err)); -// should work as jxr hopefully +function startWebMIDI(){ + WebMidi.enable().then(() => webMidiStarted() ).catch(err => alert(err)); +} let notesPlaying = {} function webMidiStarted(){ let midiStarted = Date.now() console.log("WebMidi enabled!") - myInput = WebMidi.getInputByName("MPK mini Play mk3:MPK mini Play mk3"); + let myInput = WebMidi.getInputByName("MPK mini Play mk3"); // on Quest 2 + //let myInput = WebMidi.getInputByName("MPK mini Play mk3:MPK mini Play mk3"); // on desktop + WebMidi.inputs.forEach(input => console.log(input.manufacturer, input.name)); myInput.addListener("noteon", e => { let identifierNoOctave = e.note.identifier.slice(0,-1) let b = addBlockCodeExample(identifierNoOctave, ""+ (Date.now()-midiStarted)/10000 + " 1.6 -.5") @@ -2490,29 +2493,8 @@ const notes = {"A":"#f50000", "A#": "#f57a00", "B": "#f5f500", "C": "#7af500", " - - - - - - - - - - + - - - - - - - - - - - -