aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornjanssen <[email protected]>2020-09-24 22:31:07 +0200
committernjanssen <[email protected]>2020-09-24 22:31:07 +0200
commit6fc79035f4440be8b218a0ff91c3e6848a478dc4 (patch)
tree7a557edbd0814d5c538011ed93678e36271b02ca
parent8f3ca413a44ef05db8abd1b829b752537ffc78d0 (diff)
downloadOrca-6fc79035f4440be8b218a0ff91c3e6848a478dc4.tar.gz
Orca-6fc79035f4440be8b218a0ff91c3e6848a478dc4.zip
Set input index to -1 (no input device) instead of wrapping to 0 when we've reached the end of the `Midi.inputs` array.
Now relying on `midi.selectInput` to do all the work, including setting `Midi.inputIndex` - this make sure an existing MIDI message handler is removed from the previous input device before we switch to the next one (or no input device in case of index -1)
-rw-r--r--desktop/sources/scripts/core/io/midi.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/desktop/sources/scripts/core/io/midi.js b/desktop/sources/scripts/core/io/midi.js
index a0574dd..0cdb100 100644
--- a/desktop/sources/scripts/core/io/midi.js
+++ b/desktop/sources/scripts/core/io/midi.js
@@ -176,8 +176,8 @@ function Midi (client) {
}
this.selectNextInput = () => {
- this.inputIndex = this.inputIndex < this.inputs.length ? this.inputIndex + 1 : 0
- this.selectInput(this.inputIndex)
+ const id = this.inputIndex < this.inputs.length-1 ? this.inputIndex + 1 : -1
+ this.selectInput(id)
client.update()
}