BASS.NET API for the Un4seen BASS Audio LibraryMIDI_HEADER ClassBASS.NET API for the Un4seen BASS Audio Library
Represents a wrapper for the Windows Multimedia MIDIHDR structure.
Inheritance Hierarchy


Namespace: radio42.Multimedia.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version:

public sealed class MIDI_HEADER

The MIDI_HEADER type exposes the following members.


Public methodMIDI_HEADER(Byte)
Initializes a new instance of the MIDI_HEADER with the given data buffer.
Public methodMIDI_HEADER(Int32)
Initializes a new instance of the MIDI_HEADER with an empty data buffer of the given size.
Public methodMIDI_HEADER(IntPtr)
Initializes a new instance of the MIDI_HEADER from a given Midi header pointer.
Public methodMIDI_HEADER(String)
Initializes a new instance of the MIDI_HEADER with the string as the data buffer.

Public propertyData
The MIDI data buffer.
Public propertyFlags
Gets the flags giving information about the buffer (see MIDIHeader for more information).
Public propertyHeaderPtr
Gets the pointer to the prepared MIDIHDR structure (or Zero if the header was not prepared).
Public propertyIsDone
Indicates if the device driver is finished with the buffer and is returning it to the application.
Public propertyIsPrepared
Indicates if the buffer has been prepared by using the Prepare(Boolean, IntPtr) method.
Public propertyIsStreamBuffer
Indicates if the buffer is a stream buffer.
Public propertyUser
Custom user data.

Public methodPrepare
Prepares the MIDI_HEADER structure and sets the HeaderPtr member.
Public methodToString
Returns the Data buffer as a string.
(Overrides ObjectToString.)
Public methodUnprepare
Unprepares the MIDI_HEADER structure and frees all used resources.

In order to use the MIDI_HEADER with a Midi function (e.g. MIDI_InAddBuffer(IntPtr, IntPtr) or MIDI_OutLongMsg(IntPtr, IntPtr)) you must first call the Prepare(Boolean, IntPtr) method which provides a HeaderPtr to be used.

After you send a system-exclusive data block, you must wait until the device driver is finished with the data block before freeing it. If you are sending multiple data blocks, you must monitor the completion of each data block so you know when to send additional blocks.

Once the MIDI_HEADER is used, your application will be notified with a callback procedure (see MIDIINPROC or MIDIOUTPROC) when a system-exclusive buffer has been filled with data and is being returned to the application. The MIM_LONGDATA message is sent to a MIDI input callback function - the MOM_DONE message is sent to a MIDI output callback function in such case. The param1 parameter of the callback will give you the pointer to the MIDI_HEADER structure identifying the input buffer. Use the constructor taking a headerPtr to create a MIDI_HEADER from such pointer!

Make sure, that you always call Unprepare(Boolean, IntPtr) once you prepared the header with the Prepare(Boolean, IntPtr) method in order to release all unmanaged recourses (this is at best done within the callback procedure)!

Internally the Prepare(Boolean, IntPtr) and Unprepare(Boolean, IntPtr) methods will use the MIDI_InPrepareHeader(IntPtr, IntPtr), MIDI_OutPrepareHeader(IntPtr, IntPtr) resp. MIDI_InUnprepareHeader(IntPtr, IntPtr), MIDI_OutUnprepareHeader(IntPtr, IntPtr).

See Also