Class AudioMixerEffectLoopCreator
Editor-only service that performs the actual AudioMixer modification for an "effect loop" group. Contains NO UI code — it takes a CreateAudioMixerEffectLoopInput and returns a CreateAudioMixerEffectLoopOutput, so it can be unit-driven or reused independently of the EditorWindow.
What it builds. Under the chosen parent group it creates one new group whose effect chain is, in order:
- Receive — the routing destination (added at index 0).
- the user's selected effects, in the exact requested order.
- Attenuation — the group's wet/output volume stage. This is created automatically by
Unity's
CreateNewGroupflow and is intentionally LEFT as the final stage; a second Attenuation is never added.
Routing usage (Receive side only). This tool builds only the RECEIVE side of a Send/Receive loop. It never modifies any group other than the new loop group and its parent link. To route audio into the loop, the user must afterwards select a source group (e.g. SFX or Voice) in the Audio Mixer window, add a Send effect to it, and point that Send at this loop group's Receive. The source Send's wet level controls how much signal is routed in; this loop's trailing Attenuation controls the overall returned wet level. Automatic Send wiring is deliberately out of scope (a possible future feature).
Failure policy. Never throws to the caller: all errors (including internal-API reflection failures) are returned as a failed CreateAudioMixerEffectLoopOutput so the UI can show a clear message. Nothing fails silently. A failure that hits after the loop group was already created rolls that group back (see Create(CreateAudioMixerEffectLoopInput)), so a mid-run failure never leaves a half-built group behind.
Inherited Members
Namespace: Serenity.SoundMixer.Infrastructure.AudioMixerEffectLoop.Editor
Assembly: Serenity.UnitySoundMixer.Infrastructure.Editor.dll
Syntax
public static class AudioMixerEffectLoopCreator
Fields
SafeNameRegex
Allowed characters for a loop group name (safe for Unity group/asset naming).
Declaration
public static readonly Regex SafeNameRegex
Field Value
| Type | Description |
|---|---|
| Regex |
Methods
Create(CreateAudioMixerEffectLoopInput)
Creates the effect-loop group described by input.
Declaration
public static CreateAudioMixerEffectLoopOutput Create(CreateAudioMixerEffectLoopInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateAudioMixerEffectLoopInput | input |
Returns
| Type | Description |
|---|---|
| CreateAudioMixerEffectLoopOutput |
RemoveLoopGroup(AudioMixer, string)
Removes the loop group named loopGroupName from mixer again — the
undo step a run registers with its transaction once Create(CreateAudioMixerEffectLoopInput) succeeded, so a failure later in
the same run takes the group with it. Looked up by name when the undo runs rather than held by reference:
Create(CreateAudioMixerEffectLoopInput)'s own persist reimports the mixer, which can leave an earlier group reference
fake-null. Goes through the same internal group removal Serenity.SoundMixer.Infrastructure.AudioMixerEffectLoop.Editor.AudioMixerEffectLoopCreator.RollBackPartialGroup(UnityEngine.Audio.AudioMixer,Serenity.SoundMixer.Infrastructure.AudioMixerEffectLoop.Editor.AudioMixerEffectLoopReflectionAdapter,UnityEngine.Audio.AudioMixerGroup) uses. Null when
the group is gone (or was never there), otherwise the reason it could not be removed.
Declaration
public static string RemoveLoopGroup(AudioMixer mixer, string loopGroupName)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioMixer | mixer | |
| string | loopGroupName |
Returns
| Type | Description |
|---|---|
| string |
Validate(CreateAudioMixerEffectLoopInput)
Validates an input. Returns the first failing rule's message, or null when the input is valid. Shared by the service and reusable by the UI to keep validation in one place.
The last rule is Serenity.Global.Infrastructure.Editor.ShippedContentWriteGate's: a mixer the package ships is refused HERE,
before Create(CreateAudioMixerEffectLoopInput) creates a single group on it. The adapter's own
Persist guard would catch the write at the very end, but only after the group and its whole
effect chain already existed on the shipped mixer in memory, leaving it dirty for whatever flushes
the asset database next and relying on the rollback path to undo work that never needed doing.
Declaration
public static string Validate(CreateAudioMixerEffectLoopInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateAudioMixerEffectLoopInput | input |
Returns
| Type | Description |
|---|---|
| string |