midiInUnprepareHeader() private méthode

private midiInUnprepareHeader ( HMIDIIN hMidiIn, IntPtr headerPtr, UInt32 cbMidiInHdr ) : MMRESULT
hMidiIn HMIDIIN
headerPtr System.IntPtr
cbMidiInHdr System.UInt32
Résultat MMRESULT
Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        /// <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);
        }