My “Noodle Jar” desktop app connects various MIDI source devices to various destination devices. An internal synth is enabled as a destination using MidiPlaybackMBS. This is connected to my input port using:
myInputPort.SetCallback mySynth.Callback, mySynth
(where mySynth is a MidiPlaybackMBS)
Any MIDI data from whatever source devices I have connected to myInputPort are then played through mySynth. This works fine. (I don’t use mySynth to play back any MIDI files).
My problem is finding a way to break this callback connection. There seems to be no way to turn off mySynth, no callback disconnect or MidiPlaybackMBS destructor. I’ve found that I can call myInputPort.Close and then reopen the port without using the callback. This turns off mySynth, but then I have to reconnect any sources I had connected.
I was just hoping there was a more elegant or efficient method like:
mySynth.close
mySynth.callback.disconnect
Am I missing something? Any suggestions? Thanks.