/// <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); }
/// <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); }