aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorЛu Лinveгa <[email protected]>2019-04-03 09:09:50 +0900
committerGitHub <[email protected]>2019-04-03 09:09:50 +0900
commit7b56f9eaf8483cdee513e1c46b1b2a5bd00816d1 (patch)
tree508b15149bef438b48ed1c6e545b55be8a1d33c6
parente0a89edf06cb47f6e964128ac2191347725f8084 (diff)
parent9cc8ca8ada20ea7d4c6c7d109feeda130a5c19d6 (diff)
downloadOrca-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.js8
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)
})