private midiInUnprepareHeader ( HMIDIIN hMidiIn, |
||
hMidiIn | HMIDIIN | |
headerPtr | ||
cbMidiInHdr | ||
return | MMRESULT |
private IntPtr RecycleLongMsgBuffer(UIntPtr ptr) { IntPtr newPtr = unchecked ((IntPtr)(long)(ulong)ptr); UInt32 size = (UInt32)Marshal.SizeOf <Win32API.MIDIHDR>(); CheckReturnCode(Win32API.midiInUnprepareHeader(handle, newPtr, size)); CheckReturnCode(Win32API.midiInPrepareHeader(handle, newPtr, size)); CheckReturnCode(Win32API.midiInAddBuffer(handle, newPtr, size)); //return unchecked((UIntPtr)(ulong)(long)newPtr); return(newPtr); }
private IntPtr RecycleLongMsgBuffer(UIntPtr ptr) { IntPtr newPtr = unchecked ((IntPtr)(long)(ulong)ptr); UInt32 size = (UInt32)System.Runtime.InteropServices.Marshal.SizeOf(typeof(Win32API.MIDIHDR)); CheckReturnCode(Win32API.midiInUnprepareHeader(handle, newPtr, size)); CheckReturnCode(Win32API.midiInPrepareHeader(handle, newPtr, size)); CheckReturnCode(Win32API.midiInAddBuffer(handle, newPtr, size)); //return unchecked((UIntPtr)(ulong)(long)newPtr); return(newPtr); }
/// <summary> /// Releases the resources associated with the specified MidiHeader pointer. /// </summary> /// <param name="ptr"> /// The pointer to MIDIHDR buffer. /// </param> private bool DestroyLongMsgBuffer(UIntPtr ptr) { IntPtr newPtr = unchecked ((IntPtr)(long)(ulong)ptr); UInt32 size = (UInt32)Marshal.SizeOf <Win32API.MIDIHDR>(); CheckReturnCode(Win32API.midiInUnprepareHeader(handle, newPtr, size)); Win32API.MIDIHDR header = Marshal.PtrToStructure <Win32API.MIDIHDR>(newPtr); System.Runtime.InteropServices.Marshal.FreeHGlobal(header.lpData); System.Runtime.InteropServices.Marshal.FreeHGlobal(newPtr); LongMsgBuffers.Remove(newPtr); return(true); }