예제 #1
0
        /// <summary>
        /// Un-prepares the <paramref name="buffer"/> for the Midi In Port.
        /// </summary>
        /// <param name="buffer">Must not be null.</param>
        /// <remarks>This method is not intended to be called by client code.</remarks>
        protected override void OnUnprepareBuffer(MidiBufferStream buffer)
        {
            Check.IfArgumentNull(buffer, "buffer");

            int result = NativeMethods.midiInUnprepareHeader(
                MidiPort.MidiSafeHandle,
                buffer.ToIntPtr(),
                (uint)MemoryUtil.SizeOfMidiHeader);

            MidiInPort.ThrowIfError(result);
        }
예제 #2
0
        /// <summary>
        /// Adds the <paramref name="buffer"/> to the midi port.
        /// </summary>
        /// <param name="buffer">Must not be null.</param>
        private void AddBufferToPort(MidiBufferStream buffer)
        {
            Check.IfArgumentNull(buffer, "buffer");

            // make sure the stream is rewound.
            buffer.Position = 0;

            int result = NativeMethods.midiInAddBuffer(
                MidiPort.MidiSafeHandle,
                buffer.ToIntPtr(),
                (uint)MemoryUtil.SizeOfMidiHeader);

            MidiInPort.ThrowIfError(result);
        }