/// <summary>
        /// Init midi stuff.
        /// </summary>
        bool InitMidi()
        {
            bool valid = true;

            if (_settings.MidiIn != "")
            {
                _midiIn = new NpMidiInput();
                if (_midiIn.Init(_settings.MidiIn))
                {
                    _midiIn.InputEvent += MidiIn_InputEvent;
                }
                else
                {
                    _logger.Error(_midiIn.ErrorInfo);
                    _midiIn = null;
                    valid   = false;
                }
            }

            if (_settings.MidiOut != "")
            {
                _midiOut = new NpMidiOutput();
                if (_midiOut.Init(_settings.MidiOut))
                {
                }
                else
                {
                    _logger.Error(_midiOut.ErrorInfo);
                    _midiOut = null;
                    valid    = false;
                }
            }

            if (_settings.Vkey)
            {
                CreatePiano();
            }

            return(valid);
        }
        /// <summary>
        /// Resource clean up.
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                _mmtimer?.Stop();
                _mmtimer?.Dispose();
                _mmtimer = null;

                _midiIn?.Dispose();
                _midiIn = null;

                _midiOut?.Dispose();
                _midiOut = null;

                _piano?.Dispose();
                _piano = null;

                components?.Dispose();
            }

            base.Dispose(disposing);
        }