# ControlContext

> Control data communication, scripting-, creation-, destruction- and data query of ProcessorInstance s in an audio system.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.Audio](/engine/6000.6/script-reference/unityengine/audio.md)
* **Assembly:** UnityEngine.AudioModule

```csharp
public struct ControlContext
```

## Remarks

A [ControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext.md) effectively represents an instance of an audio system, and is responsible for synchronizing efficient and deterministic data communication between a controlling thread and a realtime audio rendering thread. Use [\_builtIn](/engine/6000.6/script-reference/unityengine/audio/controlcontext/builtin.md) for scripting the shared audio system Unity uses, or use [ControlContext.CreateManualControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext/createmanualcontrolcontext.md) for exercising your own auxillary system.

## Properties

| Property                                                                                                                   | Description                                                                             |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [IsSystemWideReconfiguring](/engine/6000.6/script-reference/unityengine/audio/controlcontext/issystemwidereconfiguring.md) | Returns true if the audio system is currently performing a system-wide reconfiguration. |

## Static Properties

| Property                                                                               | Description                                                                                                                                                                        |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [builtIn](/engine/6000.6/script-reference/unityengine/audio/controlcontext/builtin.md) | The default provided [ControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext.md) which is used and updated in tandem with Unity's built-in audio system. |

## Methods

| Method                                                                                                       | Description                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AllocateGenerator](/engine/6000.6/script-reference/unityengine/audio/controlcontext/allocategenerator.md)   | Allocate a [GeneratorInstance](/engine/6000.6/script-reference/unityengine/audio/generatorinstance.md) with the specified realtime and control state.                                                                                                      |
| [AllocateRootOutput](/engine/6000.6/script-reference/unityengine/audio/controlcontext/allocaterootoutput.md) | Allocate a [RootOutputInstance](/engine/6000.6/script-reference/unityengine/audio/rootoutputinstance.md) with the specified processor and control state.                                                                                                   |
| [Configure](/engine/6000.6/script-reference/unityengine/audio/controlcontext/configure.md)                   | Manually reconfigure this [GeneratorInstance](/engine/6000.6/script-reference/unityengine/audio/generatorinstance.md) with the given `format`.                                                                                                             |
| [Destroy](/engine/6000.6/script-reference/unityengine/audio/controlcontext/destroy.md)                       | Destroy a [GeneratorInstance](/engine/6000.6/script-reference/unityengine/audio/generatorinstance.md) previously allocated with [ControlContext.AllocateGenerator](/engine/6000.6/script-reference/unityengine/audio/controlcontext/allocategenerator.md). |
| [Exists](/engine/6000.6/script-reference/unityengine/audio/controlcontext/exists.md)                         | Test whether `processorInstance` is valid and belongs to this [ControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext.md).                                                                                                       |
| [GetConfiguration](/engine/6000.6/script-reference/unityengine/audio/controlcontext/getconfiguration.md)     | Get the declared configuration `generatorInstance` runs in.                                                                                                                                                                                                |
| [IsGenerator](/engine/6000.6/script-reference/unityengine/audio/controlcontext/isgenerator.md)               | Test whether `processorInstance` is a [GeneratorInstance](/engine/6000.6/script-reference/unityengine/audio/generatorinstance.md) built from a `TRealtime` and `TControl`.                                                                                 |
| [IsRootOutput](/engine/6000.6/script-reference/unityengine/audio/controlcontext/isrootoutput.md)             | Test whether `processorInstance` is a [RootOutputInstance](/engine/6000.6/script-reference/unityengine/audio/rootoutputinstance.md) built from a `TRealtime` and `TControl`.                                                                               |
| [SendMessage](/engine/6000.6/script-reference/unityengine/audio/controlcontext/sendmessage.md)               | Send a message with a piece of data to be immediately evaluated by the [ProcessorInstance.IControl\<TRealtime>.OnMessage](/engine/6000.6/script-reference/unityengine/audio/processorinstance/icontrol1/onmessage.md).                                     |
| [Update](/engine/6000.6/script-reference/unityengine/audio/controlcontext/update.md)                         | Manually update this [GeneratorInstance](/engine/6000.6/script-reference/unityengine/audio/generatorinstance.md).                                                                                                                                          |

## Static Methods

| Method                                                                                                                       | Description                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CreateManualControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext/createmanualcontrolcontext.md) | Create a new [ControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext.md) with additional functionality you can drive manually.                                |
| [WaitForBuiltInQueueFlush](/engine/6000.6/script-reference/unityengine/audio/controlcontext/waitforbuiltinqueueflush.md)     | Forcefully wait for any commands created on [\_builtIn](/engine/6000.6/script-reference/unityengine/audio/controlcontext/builtin.md) or on any derivative objects to have taken effect. |

## Structs

| Struct                                                                                              | Description                                                                                                                                                                               |
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ControlContext.Manual](/engine/6000.6/script-reference/unityengine/audio/controlcontext/manual.md) | A manually-managed [ControlContext](/engine/6000.6/script-reference/unityengine/audio/controlcontext.md) for usage outside of the normal Unity audio system (tests, custom audio system). |
