BASS.NET API for the Un4seen BASS Audio Library

MIDI_HEADERPrepare Method

BASS.NET API for the Un4seen BASS Audio Library
Prepares the MIDI_HEADER structure and sets the HeaderPtr member.

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

public bool Prepare(
	bool input,
	IntPtr handle
)

Parameters

input
Type: SystemBoolean
Dealing with a Midi input device? (=input, =output).
handle
Type: SystemIntPtr
The handle to the MIDI device.

Return Value

Type: Boolean
on success (use the HeaderPtr to access the prepared MIDIHDR structure) - else .
Remarks

The returned HeaderPtr can be used e.g. with the MIDI_InAddBuffer(IntPtr, IntPtr) or MIDI_OutLongMsg(IntPtr, IntPtr) methods.

Internally the MIDIHDR (see HeaderPtr) will be prepared using the MIDI_InPrepareHeader(IntPtr, IntPtr) resp. MIDI_OutPrepareHeader(IntPtr, IntPtr) depending on the input parameter.

Note: This method allocates unmanaged memory and copies this MIDI_HEADER structure to that memory. So there is no need to keep a reference to the MIDI_HEADER instance in your application, since you will be notified in a MIDIINPROC or MIDIOUTPROC when the Midi device has finished with the buffer and provides back a pointer to the MIDIHDR structure. You might then use the constructor overload taking a headerPtr to (re)create an instance of this class.

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

See Also

Reference