# DefineInsTemplate

Creates an instrument template from a .dsp file.

### Synopsis

`Item DefineInsTemplate (uint8 *Definition, int32 NumBytes, Item Device, char *Name)`

### Description

This function defines an instrument template from a .dsp file image that has been loaded into RAM. The function is intended for use with streaming data applications, or any other application where calling `LoadInsTemplate()`, which reads DSP files off disc, at instrument template creation time is impractical.

When you are finished with the template, you should call `UnloadInsTemplate()` to deallocate the resources. After you have called `DefineInsTemplate()`, the image that you have read is no longer needed and can be freed.

See `CreateInsTemplate()` for a more general solution to creating instrument templates.

### Arguments

Definition
  A pointer to the DSP instrument template file image in memory. This memory does not need to remain valid after the Template has been created.

NumBytes
  The length of the file image pointed to by Definition.

Device
  The item number of the device on which you want to play instruments created with the template. 0 indicates the default audio device, the DSP, which is the only valid audio device item at the present time.

Name
  The name of the instrument template file image. Ignored.

### Return Value

This returns the Item number of the Template (a positive value) 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 `DefineInsTemplate()` with `UnloadInsTemplate()`.

The name argument is ignored.

### Associated Files

audio.h

### See Also

``UnloadInsTemplate`(), CreateInsTemplate(), LoadInsTemplate(), DefineSampleHere()`