diff options
author | Лu Лinveгa <[email protected]> | 2019-04-03 09:09:50 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2019-04-03 09:09:50 +0900 |
commit | 7b56f9eaf8483cdee513e1c46b1b2a5bd00816d1 (patch) | |
tree | 508b15149bef438b48ed1c6e545b55be8a1d33c6 | |
parent | e0a89edf06cb47f6e964128ac2191347725f8084 (diff) | |
parent | 9cc8ca8ada20ea7d4c6c7d109feeda130a5c19d6 (diff) | |
download | Orca-7b56f9eaf8483cdee513e1c46b1b2a5bd00816d1.tar.gz Orca-7b56f9eaf8483cdee513e1c46b1b2a5bd00816d1.zip |
Merge pull request #66 from frarees/midi_refresh
Add 'Refresh MIDI devices' menu item
-rw-r--r-- | desktop/sources/scripts/io.midi.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/desktop/sources/scripts/io.midi.js b/desktop/sources/scripts/io.midi.js index b97e5cf..271336d 100644 --- a/desktop/sources/scripts/io.midi.js +++ b/desktop/sources/scripts/io.midi.js @@ -67,16 +67,17 @@ function Midi (terminal) { this.update = function () { terminal.controller.clearCat('default', 'Midi') + terminal.controller.add('default', 'Midi', `Refresh Device List`, () => { terminal.io.midi.setup(); terminal.io.midi.update() }, 'CmdOrCtrl+Shift+Alt+M') const devices = terminal.io.midi.list() - for (const id in devices) { - terminal.controller.add('default', 'Midi', `${devices[id].name} ${terminal.io.midi.index === parseInt(id) ? ' — Active' : ''}`, () => { terminal.io.midi.select(id) }, '') - } if (devices.length < 1) { terminal.controller.add('default', 'Midi', `No Device Available`) } if (devices.length > 1) { terminal.controller.add('default', 'Midi', `Next Device`, () => { terminal.io.midi.next(id) }, 'CmdOrCtrl+Shift+M') } + for (const id in devices) { + terminal.controller.add('default', 'Midi', `${devices[id].name} ${terminal.io.midi.index === parseInt(id) ? ' — Active' : ''}`, () => { terminal.io.midi.select(id) }, '') + } terminal.controller.commit() } @@ -106,6 +107,7 @@ function Midi (terminal) { this.setup = function () { if (!navigator.requestMIDIAccess) { return } + this.devices = [] navigator.requestMIDIAccess({ sysex: false }).then(this.access, (err) => { console.warn('No Midi', err) }) |