Exemplo n.º 1
0
        public void Update(IObservable <IMidiMessage> messages, IObservable <IMidiMessage> messagesDefaultHack, MidiOutputDevice device, out bool isOpen)
        {
            if (device.IsValid())
            {
                if (device.Value != FDeviceName)
                {
                    var deviceID = (int)device.Tag;
                    FDeviceName = device.Value;

                    ReleaseDevice();
                    OutputEventSink = new MidiOutEventSink(deviceID);
                }
            }
            else
            {
                FDeviceName = null;
                ReleaseDevice();
            }

            if (OutputEventSink != null)
            {
                OutputEventSink.SetObservable(messages, messagesDefaultHack);
            }

            isOpen = OutputEventSink?.IsOpen ?? false;
        }
Exemplo n.º 2
0
 private void ReleaseDevice()
 {
     if (OutputEventSink != null)
     {
         OutputEventSink.Dispose();
         OutputEventSink = null;
     }
 }