Miles Sound System SDK 7.2a

AIL_MIDI_to_XMI

The function AIL_MIDI_to_XMI converts Standard MIDI Format 0 and Format 1 sequence files to the Extended MIDI (XMIDI) format.

S32 AIL_MIDI_to_XMI(
  void const * MIDI,
  U32 MIDI_size,
  void * *XMI,
  U32 *XMI_size,
  S32 flags
);

In Parameters

MIDI
points to a file image containing standard MIDI data.
MIDI_size
is the length of the MIDI data.
flags
is zero, or one or more of the MILES_MIDI_TO_XMI_FLAGS.

Out Parameters

XMI
should be the address of a " void* " pointer that will return with the pointer to the new XMIDI file image. This parameter can be NULL if you don't need it.
XMI_size
should be the address of an unsigned 32-bit integer that will return with the size of the new XMIDI file image. This parameter can be NULL if you don't need it.

Returns

1, if the call was successful, or 0 if the call failed.

Discussion

You must free the pointer returned in XMI with AIL_mem_free_lock.

This function will convert Standard MIDI Format 0 and Format 1 sequence files to the Extended MIDI (XMIDI) format used by the Miles Sound System's Version 2.0 and Version 3.0 drivers. This conversion preserves all of the information needed to faithfully reproduce the sequence's original sound, while discarding elements of the MIDI storage format that are redundant, inefficient, or otherwise unnecessary for real-time playback.

An XMIDI file containing a single translated MIDI sequence often requires from 10% to 30% less storage space, and can be performed with substantially less background processing time. The MIDI data track is compressed mostly by the elimination of all Note Off messages, which is made possible by appending each note's duration in quantization intervals to its original Note On event. Track-specific MIDI meta-events (such as Sequence/Track Name, Instrument Name, and End of Track events) are stripped from the data stream, while a single End of Track meta-event (FF 2F 00) is placed at the end of the XMIDI sequence.

In addition to the prequantized MIDI event stream, the XMIDI sequence format also includes information such as master lists of Global Timbre Library entries needed by the sequence and target offsets for any Sequence Branch Index controllers present in the sequence. To aid developers with specialized needs, XMIDI files are stored in accordance with Electronic Arts' Interchange File Format (EA IFF 85) standard. For example, using conventional IFF access routines, MSS applications may load and interpret XMIDI timbre list (TIMB) chunks manually, using the data to prepare the synthesizer for immediate playback of sequences at a later time.

Refer to the Extended MIDI (XMIDI) Specification Section for a detailed description of the XMIDI IFF structure.


Group: Utility Services
Related Sections: Extended MIDI IFF (.XMI) Structure
Related Functions: AIL_init_sequence, AIL_mem_free_lock, AIL_sequence_position
Related Basic Types: MILES_MIDI_TO_XMI_FLAGS, MILES_PREFERENCES, S32, U32, void *, void const *
Related FAQs: How do I play an XMIDI or MIDI file?

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.