# UnloadInsTemplate

Unloads an instrument template.

### Synopsis

`Err UnloadInsTemplate (Item InsTemplate)`

### Description

This function unloads (or deletes) an instrument template created by `CreateInsTemplate()`, `LoadInsTemplate()`, and `DefineInsTemplate()`. It unloads the Template from memory and frees its resources. Any Instruments created using the Template are deleted as well, with the expected side-effects. Any Attachments made to this Template are also deleted.

Unlike `DeleteInstrument()`, any Envelopes or Samples attached to this Template are also deleted, along with the expected side-effects. If you need to protect the Envelopes or Attachments, detach them from the Template first.

### Arguments

InsTemplate
  Item number of Template to delete.

### Return Value

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

### Implementation

Folio call implemented in Audio folio V20.

### Caveats

Ideally there should be a `DeleteInsTemplate()` function, but there isn't one yet. Sorry for any confusion that might arise from pairing `CreateInsTemplate()` or `DefineInsTemplate()` with `UnloadInsTemplate()`.

### Associated Files

audio.h

### See Also

``CreateInsTemplate`(), LoadInsTemplate(), DefineInsTemplate()`