# AllocateEffect<TProcessor, TControl>(in TProcessor, in TControl, AudioFormat?, in CreationParameters)

> Allocate an EffectInstance with the specified processor and control state.

## Definition

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

## AllocateEffect\<T, U>(T, T, AudioFormat?, CreationParameters)

```csharp
public readonly EffectInstance AllocateEffect<TProcessor, TControl>(in TProcessor processorState, in TControl controlState, AudioFormat? nestedFormat = null, in EffectInstance.CreationParameters creationParameters = default) where TProcessor : unmanaged, EffectInstance.IRealtime where TControl : unmanaged, EffectInstance.IControl<TProcessor>
```

### Parameters

**** (T): The initial state available from the realtime thread.**** (T): The initial state available from the control thread.**** (\[AudioFormat?]\(https\://learn.microsoft.com/dotnet/api/system.nullable)): If not null, the returned [EffectInstance](/engine/6000.7/script-reference/unityengine/audio/effectinstance.md) will be treated as nested and use this format.**** (\[CreationParameters]\(/engine/6000.7/script-reference/unityengine/audio/effectinstance/creationparameters)): Additional parameters and initialization state for the processor. This is generally received from [IAudioEffect.CreateInstance](/engine/6000.7/script-reference/unityengine/audio/iaudioeffect/createinstance.md)

### Returns

| Type                                                                                  | Description                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [EffectInstance](/engine/6000.7/script-reference/unityengine/audio/effectinstance.md) | An [EffectInstance](/engine/6000.7/script-reference/unityengine/audio/effectinstance.md) you own and control, that must later be destroyed with [ControlContext.Destroy](/engine/6000.7/script-reference/unityengine/audio/controlcontext/destroy.md). |

### Remarks

This can generally be used to process the audio of an [IAudioEffect](/engine/6000.7/script-reference/unityengine/audio/iaudioeffect.md), potentially from within another processor.

Additional Resources: [IAudioEffect.CreateInstance](/engine/6000.7/script-reference/unityengine/audio/iaudioeffect/createinstance.md)
