AllocInstrument

Allocates an instrument using a template.

Synopsis

Item AllocInstrument (Item InsTemplate, uint8 Priority)

Description

This function allocates an Instrument based on an instrument Template, previously loaded using LoadInsTemplate() or similar call, and allocates the DSP resources necessary for the Instrument. See also the convenience function LoadInstrument() combines these two steps.

Call FreeInstrument() when you're finished with the Instrument to deallocate its resources.

AllocInstrument() and FreeInstrument() are special cases of the more CreateInstrument() and DeleteInstrument(), which offer greater flexibility.

Arguments

InsTemplate
Item number of a loaded instrument template used to allocate the instrument.
Priority
Determines order of execution in DSP. Set from 0 to 200. A typical value would be 100. This value also determines the priority over other instruments when voices are stolen for dynamic voice allocation.

Return Value

The function returns the Item number for the Instrument (a positive value) or an error code (a negative value) if an error occurs.

Implementation

Folio call implemented in Audio folio V20.

Associated Files

audio.h

See Also

FreeInstrument(), CreateInstrument(), LoadInsTemplate(), LoadInstrument()