# Function Calls

The following Audio folio calls prepare instruments.

## Audio Folio Control

- `CloseAudioFolio()` Closes the Audio folio.
- `OpenAudioFolio()` Opens the Audio folio.

The following calls can be used to open and close and Audio folio:

## Instrument Loading and Creation

- `AllocInstrument()` Allocates an instrument using a template.
- `CreateInsTemplate()` Generic template creation function.
- `CreateInstrument()` Creates an instrument using a template.
- `DefineInsTemplate()` Creates an instrument template from a .dsp file.
- `DeleteInstrument`() Frees an instrument and its resources allocated by `CreateInstrument()`.
- `FreeInstrument()` Frees an instrument and its resources.
- `LoadInsTemplate()` Loads template for creating instruments.
- `LoadInstrument()` Loads instrument by name.
- `UnloadInsTemplate()` Unloads an instrument template.
- `UnloadInstrument()` Frees an instrument and unloads its template.

The following calls can be used to load and create instruments:

## Tuning

The following calls can be used to tune items and instruments:

- `CreateTuning()` Creates a tuning item.
- `DeleteTuning()` Deletes a tuning.
- `TuneInsTemplate()` Applies the specified tuning to an instrument template.
- `TuneInstrument()` Applies the specified tuning to an instrument.

## Loading, Creating, and Attaching Samples

The following calls can be used to handle samples:

- `AttachSample()` Connects sample to instrument's FIFO.
- `CreateSample()` Generic sample creation function.
- `LoadSample()` Loads an AIFF or AIFC sample from file.
- `ScanSample()` Loads a truncated sample file.
- `DebugSample()` Prints sample information for debugging.
- `DetachSample()` Disconnects sample from instrument.
- `UnloadSample()` Deletes a sample and frees its resources.

## Reading and Changing Audio-Item Attributes

The following calls are used to change attributes of audio items:

- `GetAudioItemInfo()` Gets information about an audio item.
- `SetAudioItemInfo()` Sets parameters of an audio item.

## Envelopes

The following calls are used to handle envelopes:

- `AttachEnvelope()` Attaches an envelope to an instrument and creates an attachment item.
- `CreateEnvelope()` Creates an envelope for a sample or cue.
- `DeleteEnvelope()` Deletes an envelope.
- `DetachEnvelope>()` Detaches an envelope from an instrument.

## Linking Attachments

The following call is used to connect attachments:

- `LinkAttachments()`Connects attachments for sequential playback.

## Connecting Instruments

The following calls are used to connect and disconnect instruments:

- `ConnectInstruments()` Patches an output to an input.
- `DisconnectInstruments()` Disconnects one instrument from another.

## Adding Reverberation

The following calls are used to create and delete delay lines:

- `CreateDelayLine()` Creates a delay for echoes and reverberations.
- `DeleteDelayLine()` Deletes a delay line.

## Handling Knobs

The following calls are used to handle knobs:

- `GetKnobName()` Queries name of indexed knob.
- `GrabKnob()` Connects a task to an instrument controller.
- `GetNumKnobs()` Finds how many knobs an instrument has.
- `ReleaseKnob()` Releases a task from a knob it has grabbed.
- `TweakKnob()` Changes the value of a knob.
- `TweakRawKnob()` Changes the value of a knob using a raw value.

## Allocating Amplitude

The following calls are used to allocate and free amplitude:

- `AllocAmplitude()` Allocates amplitude from available system amplitude.
- `FreeAmplitude()` Inverse of `AllocAmplitude()`.