-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MidiInput is missing a method for removeMessageReceivedListener() #90
Comments
Adding the same event handler twice itself is not strictly harmful, but it indeed seems error-prone. And having no way to reset is indeed problematic, as the listener argument is not nullable. We should really switch to add/remove listener style. I kind of avoided that as it is a breaking API change to the entire |
This is strange... I checked the ktmidi code and the listener is never a list, it's a single object being assigned. But still when switching between MIDI inputs I need to recreate the listener, otherwise it doesn't work, but I get the input events 2, 3, 4 times... Even tried making it null before creating a new one, but still get multiple input events
|
Because you didn't |
Thanks, indeed closing en open midiinput before opening a new one, solves the double events! |
Because of race conditions, it seems it is possible to assign a listener twice. It would probably be nice to have a way to remove a listener before assigning a new one, e.g. when change midi inputs.
public interface MidiInput : dev.atsushieno.ktmidi.MidiPort {
public abstract fun setMessageReceivedListener(listener: dev.atsushieno.ktmidi.OnMidiReceivedEventListener): kotlin.Unit
}
The text was updated successfully, but these errors were encountered: