FreeInstrument

Frees an instrument and its resources allocated by AllocInstrument().

Synopsis

Err FreeInstrument (Item InstrumentItem)

Description

This function frees an instrument allocated by AllocInstrument(), which frees the resources allocated for the instrument. If the instrument is running, it is stopped. All of the Attachments, Knobs, and Probes belonging to this Instrument are also deleted by this function. The Envelopes and Samples at the other end of Attachments are not deleted by this function.

If you delete an instrument Template, all Instruments created using that Template are freed, so you don't need to use DeleteInstrument() on them.

Do not confuse this function with UnloadInstrument(). If you create an Instrument using LoadInstrument(), you shouldn't use DeleteInstrument() to free the instrument because it will leave the instrument's Template loaded and without access to unload the Template. Use UnloadInstrument() instead.

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

Arguments

InstrumentItem
The item number of the instrument to free.

Return Value

The function returns a non-negative value if successful or an error code (a negative value) if an error occurs.

Implementation

Library call implemented in audio.lib V20.

Associated Files

audio.h

See Also

AllocInstrument(), DeleteInstrument(), UnloadInstrument(), UnloadInsTemplate()