public static void UnregisterConsumer(IMidiConsumer consumer) { if (!MidiConsumers.Contains(consumer)) { return; } foreach (var midiIn in MidiInsWithDevices.Keys) { midiIn.MessageReceived -= consumer.MessageReceivedHandler; midiIn.ErrorReceived -= consumer.ErrorReceivedHandler; } MidiConsumers.Remove(consumer); if (MidiConsumers.Count == 0) { CloseMidiDevices(); } }
public static void RegisterConsumer(IMidiConsumer consumer) { CloseMidiDevices(); MidiConsumers.Add(consumer); ScanAndRegisterToMidiDevices(); }