コード例 #1
0
        private void ReleaseBuffer(IntPtr headerPtr)
        {
            int result = WindowsMultimediaDevice.midiInUnprepareHeader(Handle, headerPtr, SizeOfMidiHeader);

            if (result != (int)EDeviceException.MmsyserrNoerror)
            {
                OnError(new ErrorEventArgs(new InputDeviceException(result)));
            }
            _headerBuilder.Destroy(headerPtr);
            _bufferCount--;
        }
コード例 #2
0
        public int AddSysExBuffer()
        {
            _headerBuilder.BufferLength = _sysExBufferSize;
            _headerBuilder.Build();
            var headerPtr = _headerBuilder.Result;
            var result    = WindowsMultimediaDevice.midiInPrepareHeader(Handle, headerPtr, SizeOfMidiHeader);

            if (result == 0)
            {
                _bufferCount++;
                result = WindowsMultimediaDevice.midiInAddBuffer(Handle, headerPtr, SizeOfMidiHeader);
                if (result != 0)
                {
                    WindowsMultimediaDevice.midiInUnprepareHeader(Handle, headerPtr, SizeOfMidiHeader);
                    _bufferCount--;
                    _headerBuilder.Destroy();
                }
                return(result);
            }
            _headerBuilder.Destroy();
            return(result);
        }