示例#1
0
        public OutputDevice(int deviceId) : base(deviceId)
        {
            _lockObject           = new object();
            _bufferCount          = 0;
            _headerBuilder        = new MidiHeaderBuilder();
            Handle                = 0;
            _runningStatusEnabled = false;
            _runningStatus        = 0;
            _midiOutProcIstance   = HandleMessage;
            var result = WindowsMultimediaDevice.midiOutOpen(ref Handle, deviceId, _midiOutProcIstance, 0, 0x30000);

            if (result != (int)EDeviceException.MmsyserrNoerror)
            {
                OnError(new ErrorEventArgs(new OutputDeviceException(result)));
            }
        }
示例#2
0
        public InputDevice(int deviceId) : base(deviceId)
        {
            _bufferCount     = 0;
            _lockObject      = new object();
            _recording       = false;
            _headerBuilder   = new MidiHeaderBuilder();
            Handle           = 0;
            _resetting       = false;
            _sysExBufferSize = 0x1000;
            _midiInProc      = HandleMessage;
            var result = WindowsMultimediaDevice.midiInOpen(ref Handle, deviceId, _midiInProc, 0, 0x30000);

            if (result != (int)EDeviceException.MmsyserrNoerror)
            {
                throw new InputDeviceException(result);
            }
        }