Пример #1
0
        public bool Close()
        {
            if (this._device == IntPtr.Zero)
            {
                return(true);
            }
            this._closing = true;
            bool started = this._started;

            this._lastError = Midi.MIDI_InReset(this._device);
            if (this._lastError == MIDIError.MIDI_OK)
            {
                this._started = false;
                if (started)
                {
                    this.RaiseMessageReceived(MidiMessageEventType.Stopped, null);
                }
            }
            this._lastError = Midi.MIDI_InClose(this._device);
            if (this._lastError == MIDIError.MIDI_OK)
            {
                this._device = IntPtr.Zero;
            }
            this._closing = false;
            return(this._device == IntPtr.Zero);
        }
Пример #2
0
 public bool Start()
 {
     if (this._disposing)
     {
         return(false);
     }
     if (this._started)
     {
         return(true);
     }
     this.AddSysExBuffer();
     this.AddSysExBuffer();
     this._lastError = Midi.MIDI_InStart(this._device);
     if (this._lastError == MIDIError.MIDI_OK)
     {
         this._started = true;
         this.RaiseMessageReceived(MidiMessageEventType.Started, null);
     }
     else
     {
         Midi.MIDI_InReset(this._device);
     }
     return(this._started);
 }