Esempio n. 1
0
        void IOutputPort.WriteByte(int port, byte value)
        {
            switch (port)
            {
            case DataPort:
                if (this.midiMapper == null)
                {
                    this.midiMapper = this.UseMT32 && !string.IsNullOrWhiteSpace(this.Mt32RomsPath) ? new Mt32MidiDevice(this.Mt32RomsPath) : new WindowsMidiMapper();
                }
                this.midiMapper.SendByte(value);
                break;

            case StatusPort:
                switch (value)
                {
                case ResetCommand:
                    State = GeneralMidiState.NormalMode;
                    this.dataBytes.Clear();
                    this.dataBytes.Enqueue(CommandAcknowledge);
                    if (this.midiMapper != null)
                    {
                        this.midiMapper.Dispose();
                        this.midiMapper = null;
                    }
                    break;

                case EnterUartModeCommand:
                    this.State = GeneralMidiState.UartMode;
                    this.dataBytes.Enqueue(CommandAcknowledge);
                    break;
                }
                break;
            }
        }
Esempio n. 2
0
 public void Dispose()
 {
     this.midiMapper?.Dispose();
     this.midiMapper = null;
 }