BOOL WINAPI MidiFreeBuffer ( LPVOID lpBuffer );
This function deallocates a buffer created by MidiFilterTrackEvents or a buffer returned by MidiGet, MidiTrackGet and MidiEventGet when these functions are requested for buffers.
Returns TRUE
if the buffer was deallocated or FALSE
if not. After the deallocation, do not make calls using that buffer.
MidiFilterTrackEvents always requires a call to this function. Some data returned by MidiGet, MidiTrackGet and MidiEventGet require this call as well.
The following example shows common situations when MidiFreeBuffer is necessary:
HANDLE Sequence; LPBRELS_MIDI_HEADER lpbmh; LPBRELS_TRACK_HEADER lpbth; LPBYTE lpEventData; LPBYTE lpTrackData; // Open the sequence MidiOpen("test1.mid", NO_DEVICE, &Sequence); // Midi header lpbmh = (LPBRELS_MIDI_HEADER) MidiGet(Sequence, MIDI_HEADER); // Track data lpTrackData = (LPBYTE) MidiTrackGet(Sequence, 0, TRACK_DATA); // Track header lpbth = (LPBRELS_TRACK_HEADER) MidiTrackGet(Sequence, 0, TRACK_HEADER); // Event data lpEventData = (LPBYTE) MidiEventGet(Sequence, 0, 0, EVENT_DATA); // Deallocate the created buffers MidiFreeBuffer(lpbmh); MidiFreeBuffer(lpTrackData); MidiFreeBuffer(lpbth); MidiFreeBuffer(lpEventData); // Close the sequence MidiClose(Sequence);
Released in November 19th, 2003
Updated in April 29th, 2004
Property of Breno de Lima Sarmento
Home page: http://www27.brinkster.com/brels
E-mail: [email protected]
ICQ: 78977999 ()