Listener for controlchange on All Channels #343
Unanswered
KungFuHaiku
asked this question in
Migration
Replies: 1 comment 1 reply
-
As you can read about in the Migration documentation, you have stumbled upon one of the key changes in version 3. To achieve the same behaviour, you just need to use this syntax: midiInput.addListener("controlchange", e => {}); As you can see, the method signature has changed. The two first mandatory parameters are the event type and the callback function. If you do need to specify additional options, you can add a third argument (an object) with whichever options suit you ( Hope this helps. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello there,
I've just made the switch from 2.5.3 to 3.1.4 and my console is throwing a few errors. I was previously listening for controlchange messages on all channels, using the following code:
midiInput.addListener('controlchange', "all", function(e){...})
midiInput is just an alias for the selected input device. I'm calling the code after a user selects their MIDI input/output device.
The error being thrown is
TypeError: this.channels[r] is undefined
. I'm wondering if this is due to controlchange now having a channel-specific scope, whereas previously it could be listened to globally (i.e. input-wide).Without adding an array containing all channels (e.g. [1,2,3,4,6...], is there another way I could achieve the same result?
Just to add, within my existing function, I'm checking to see what the incoming controller number is, for example, to check for a fader movement from my DAW, I'm using the following:
Many thanks.
Beta Was this translation helpful? Give feedback.
All reactions