# MFDefineCollection

Creates a Juggler collection from a MIDI file image in RAM.

### Synopsis

`Err MFDefineCollection( MIDIFileParser *mfpptr, char *Image, int32 NumBytes, Collection *ColPtr)`

### Description

This function creates a Juggler collection from a MIDI file image imported into RAM as part of a data streaming process. The MIDI file in the image may be a Format 0 or a Format 1 MIDI file. To use this function, you must first create a Juggler collection using `CreateObject()`. The function then creates an appropriate number of Juggler sequences to contain the sequences found in the MIDI file image.

The function translates the MIDI messages in each file sequence into MIDI events in an appropriate Juggler sequences within the collection. To work, the function must have a MIDIFileParser data structure to keep track of the MIDI sequence's original settings.

Note that this function treats Format 0 MIDI files as one-track Format 1 MIDI files.

### Arguments

mfpptr
  Pointer to a MIDIFileParser data structure.

Image
  Pointer to a MIDI file image in RAM (a string of bytes).

NumBytes
  The size of the MIDI file image in bytes.

ColPtr
  Pointer to a Juggler collection in which to store the converted MIDI sequences.

### Return Value

This function returns 0 if successful or an error code (a negative value) if an error occurs.

### Implementation

Library call implemented in music.lib V20.

### Associated Files

score.h, music.lib

### See Also

``CreateObject`(), MFLoadCollection(), MFLoadSequence(), MFUnloadCollection()`