Disable MidiPlaybackMBS callback connection

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:


Am I missing something? Any suggestions? Thanks.

You can call SetCallback again with 0 as callback to clear it.

Thanks Christian. Why didn’t I think of that? I should have just asked you directly but I hate to keep bothering you.


asking on the forum is great, so it gets publicly archived and everyone else can find it.