midi-dial-example.js

total 0
used 0
limit 0
/* title: MIDI Actions. categories: midi files: head pointlist point stage stroke mouse dragging ../point_src/random.js ../theatre/midi-tools.js ../theatre/midi-tracks.js ../point_src/screenwrap.js --- */ var waitMidi; var stage; window.addEventListener('midiAccess', (e)=>{ if(stage){ stage.setMidiAccess(e.detail); } else { waitMidi = e.detail } }); class MainStage extends Stage { canvas='playspace' mounted(){ this.hasMidi = undefined this.setupDevice() this.dials = PointList.generate.grid(16, 8) } requestAccess(f){ console.log('Requesting for access') navigator.requestMIDIAccess().then(f, (m)=>{ console.error(`Failed to get MIDI access - ${m}`); } ); } setupDevice(){ this.midiAccess = waitMidi if(waitMidi) { this.setMidiAccess(waitMidi) } else { this.requestAccess(e=>{ stage.setMidiAccess(e); }) } window.addEventListener('dialpressdown', (e) => { console.log(e.detail, e) }) window.addEventListener('dialpressup', (e) => { console.log(e.detail, e) }) window.addEventListener('dialvaluechange', (e) => { console.log(e.detail) let d = e.detail let dial =this.dials[d.index-1] if(dial){ dial.rotation = (d.valuePercent * .01) * 360 } }) // window.addEventListener('keyboardnotedown', (e) => { // console.log(e.detail.direction, e.detail) // this.renderKey(e.detail) // }) // window.addEventListener('keyboardnoteup', (e) => { // // console.log(e.detail.direction, e.detail) // this.unRenderKey(e.detail) // }) } setMidiAccess(midiAccess) { console.log('midi set') this.midiAccess = midiAccess listInputsAndOutputs(midiAccess) startLoggingMIDIInput(midiAccess) } isPlaying(i) { return this.points[i].isDown } draw(ctx) { this.clear(ctx) this.dials.pen.indicators(ctx) } } ;stage = MainStage.go();
Run
Meta Data
title MIDI Actions.
imports ()
files ('head', 'pointlist', 'point', 'stage', 'stroke', 'mouse', 'dragging', '../point_src/random.js', '../theatre/midi-tools.js', '../theatre/midi-tracks.js', '../point_src/screenwrap.js')
unused_keys ()
unknown_keys ('categories',)
categories ['midi']
filepath_exists True
path midi-dial-example.js
filepath midi-dial-example.js
clean_files ('../point_src/core/head.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/pointpen.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointdraw.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/setunset.js', '../point_src/stroke.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/functions/clamp.js', '../point_src/distances.js', '../point_src/protractor.js', '../point_src/text/beta.js', '../point_src/dragging.js', '../point_src/random.js', '../theatre/midi-tools.js', '../theatre/midi-tracks.js', '../point_src/screenwrap.js')
markdown {'html': '', 'content': 'title: MIDI Actions.\ncategories: midi\nfiles:\n head\n pointlist\n point\n stage\n stroke\n mouse\n dragging\n ../point_src/random.js\n ../theatre/midi-tools.js\n ../theatre/midi-tracks.js\n ../point_src/screenwrap.js\n---'}