Class AudityMessaging
Sends control messages to the Audity instance playing on an AudioSource. Shared by DarkEffekt.Audity.AuditySource and the editor’s audition tooling so both exercise exactly the same runtime path.
Assembly: DarkEffekt.Audity.Runtime
Section titled “Assembly: DarkEffekt.Audity.Runtime”public static class AudityMessagingMethods
Section titled “Methods”Send<T>(AudioSource, ref T)
Section titled “Send<T>(AudioSource, ref T)”Sends a raw control message to the Audity instance playing on source.
public static bool Send<T>(AudioSource source, ref T message) where T : unmanagedReturns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name | Description |
|---|---|---|
UnityEngine.AudioSource |
source | The AudioSource whose generator instance should receive the message. |
<T> |
message | The unmanaged message payload. |
Type Parameters
Section titled “Type Parameters”T
SetParameter(AudioSource, AudityParameterId, float, float, int)
Section titled “SetParameter(AudioSource, AudityParameterId, float, float, int)”Sets a live parameter’s value on the instance playing on source.
The local value takes precedence over subsequent global parameter mirroring for that
instance’s lifetime.
public static bool SetParameter(AudioSource source, AudityParameterId id, float value, float smoothSeconds = -1, int elementIndex = 0)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name | Description |
|---|---|---|
UnityEngine.AudioSource |
source | |
| DarkEffekt.Audity.AudityParameterId | id | |
System.Single |
value | New value, clamped to the parameter’s authored range. |
System.Single |
smoothSeconds | Glide time override; negative uses the parameter’s authored default. |
System.Int32 |
elementIndex | Array element; 0 for scalars. |
TryGetFloat(AudioSource, AudityParameterId, out float, int)
Section titled “TryGetFloat(AudioSource, AudityParameterId, out float, int)”Reads back a member the GRAPH writes (Direction = Out) on the instance
playing on source - an Envelope Follower’s level, a
Compressor’s gain reduction, anything a Parameter Out node feeds.
public static bool TryGetFloat(AudioSource source, AudityParameterId id, out float value, int element = 0)Returns
Section titled “Returns”System.Boolean: False when the source is not playing an Audity instance, the member is not
marked Out, or the engine has not reported it yet (the first frame of
playback). The value is a snapshot as of the engine’s last report, roughly a
frame old - see DarkEffekt.Audity.AudityReadback for why it cannot be live.
Parameters
Section titled “Parameters”| Type | Name | Description |
|---|---|---|
UnityEngine.AudioSource |
source | |
| DarkEffekt.Audity.AudityParameterId | id | |
System.Single |
value | |
System.Int32 |
element | Array/vector element; 0 for scalars. |
TryGetFloat(AudioSource, string, out float, int)
Section titled “TryGetFloat(AudioSource, string, out float, int)”Reads back a member the GRAPH writes (Direction = Out) on the instance
playing on source - an Envelope Follower’s level, a
Compressor’s gain reduction, anything a Parameter Out node feeds.
public static bool TryGetFloat(AudioSource source, string name, out float value, int element = 0)Returns
Section titled “Returns”System.Boolean: False when the source is not playing an Audity instance, the member is not
marked Out, or the engine has not reported it yet (the first frame of
playback). The value is a snapshot as of the engine’s last report, roughly a
frame old - see DarkEffekt.Audity.AudityReadback for why it cannot be live.
Parameters
Section titled “Parameters”| Type | Name | Description |
|---|---|---|
UnityEngine.AudioSource |
source | |
System.String |
name | |
System.Single |
value | |
System.Int32 |
element | Array/vector element; 0 for scalars. |
GetFloats(AudioSource, AudityParameterId, Span<float>)
Section titled “GetFloats(AudioSource, AudityParameterId, Span<float>)”Reads a Float ARRAY member a playing graph writes into
destination, element 0 first. Stops at the first element
the engine has not reported. See
DarkEffekt.Audity.AuditySource.GetFloats(DarkEffekt.Audity.AudityParameterId%2cSystem.Span%7bSystem.Single%7d).
public static int GetFloats(AudioSource source, AudityParameterId id, Span<float> destination)Returns
Section titled “Returns”System.Int32: How many elements were filled.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
System.Span<System.Single> |
destination |
GetFloats(AudioSource, string, Span<float>)
Section titled “GetFloats(AudioSource, string, Span<float>)”Reads a Float ARRAY member a playing graph writes into
destination, element 0 first. Stops at the first element
the engine has not reported. See
DarkEffekt.Audity.AuditySource.GetFloats(DarkEffekt.Audity.AudityParameterId%2cSystem.Span%7bSystem.Single%7d).
public static int GetFloats(AudioSource source, string name, Span<float> destination)Returns
Section titled “Returns”System.Int32: How many elements were filled.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.String |
name |
System.Span<System.Single> |
destination |
SetFloat(AudioSource, AudityParameterId, float, float, int)
Section titled “SetFloat(AudioSource, AudityParameterId, float, float, int)”public static bool SetFloat(AudioSource source, AudityParameterId id, float value, float smoothSeconds = -1, int elementIndex = 0)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
System.Single |
value |
System.Single |
smoothSeconds |
System.Int32 |
elementIndex |
SetBool(AudioSource, AudityParameterId, bool)
Section titled “SetBool(AudioSource, AudityParameterId, bool)”public static bool SetBool(AudioSource source, AudityParameterId id, bool value)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
System.Boolean |
value |
SetInt(AudioSource, AudityParameterId, int)
Section titled “SetInt(AudioSource, AudityParameterId, int)”public static bool SetInt(AudioSource source, AudityParameterId id, int value)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
System.Int32 |
value |
SetVector(AudioSource, AudityParameterId, Vector2, float)
Section titled “SetVector(AudioSource, AudityParameterId, Vector2, float)”Sets a Vector2 member componentwise (per-element glide).
public static bool SetVector(AudioSource source, AudityParameterId id, Vector2 value, float smoothSeconds = -1)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
UnityEngine.Vector2 |
value |
System.Single |
smoothSeconds |
SetVector(AudioSource, AudityParameterId, Vector3, float)
Section titled “SetVector(AudioSource, AudityParameterId, Vector3, float)”Sets a Vector3 member componentwise (per-element glide).
public static bool SetVector(AudioSource source, AudityParameterId id, Vector3 value, float smoothSeconds = -1)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
UnityEngine.Vector3 |
value |
System.Single |
smoothSeconds |
SetVector(AudioSource, AudityParameterId, Vector4, float)
Section titled “SetVector(AudioSource, AudityParameterId, Vector4, float)”Sets a Vector4 member componentwise (per-element glide).
public static bool SetVector(AudioSource source, AudityParameterId id, Vector4 value, float smoothSeconds = -1)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
UnityEngine.Vector4 |
value |
System.Single |
smoothSeconds |
SetSpatial(AudioSource, Vector3, Vector3)
Section titled “SetSpatial(AudioSource, Vector3, Vector3)”Pushes listener and emitter world positions to the instance playing on
source (consumed by Listener Info nodes). Sent per frame
by DarkEffekt.Audity.AuditySource while a graph using the node plays; values hold
between pushes. This overload sends a default listener orientation (world
forward/up) and zero velocities - Azimuth/Elevation/Relative Speed read as
world-axis-relative and static.
public static bool SetSpatial(AudioSource source, Vector3 listenerPosition, Vector3 emitterPosition)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
UnityEngine.Vector3 |
listenerPosition |
UnityEngine.Vector3 |
emitterPosition |
SetSpatial(AudioSource, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3)
Section titled “SetSpatial(AudioSource, Vector3, Vector3, Vector3, Vector3, Vector3, Vector3)”Full spatial push: positions plus the listener’s world-space orientation (feeds Azimuth/Elevation) and both velocities in world units per second (feeds Relative Speed → Doppler).
public static bool SetSpatial(AudioSource source, Vector3 listenerPosition, Vector3 emitterPosition, Vector3 listenerForward, Vector3 listenerUp, Vector3 listenerVelocity, Vector3 emitterVelocity)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
UnityEngine.Vector3 |
listenerPosition |
UnityEngine.Vector3 |
emitterPosition |
UnityEngine.Vector3 |
listenerForward |
UnityEngine.Vector3 |
listenerUp |
UnityEngine.Vector3 |
listenerVelocity |
UnityEngine.Vector3 |
emitterVelocity |
SetTime(AudioSource, float, float)
Section titled “SetTime(AudioSource, float, float)”Pushes game-time state (rate + session clock) to the instance playing on
source (consumed by Time nodes). Sent per frame by
DarkEffekt.Audity.AudityInstanceRegistry while a graph using the node plays; values
hold between pushes. Play Time is engine-derived and not carried here.
public static bool SetTime(AudioSource source, float rate, float sessionTime)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.Single |
rate |
System.Single |
sessionTime |
Stop(AudioSource, float)
Section titled “Stop(AudioSource, float)”Stops the instance playing on source, fading out over fadeSeconds.
public static bool Stop(AudioSource source, float fadeSeconds)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.Single |
fadeSeconds |
FadeIn(AudioSource, float)
Section titled “FadeIn(AudioSource, float)”Fades the instance playing on source in from silence over
fadeSeconds. Must be sent immediately after Play(),
before the instance’s first trigger executes - see DarkEffekt.Audity.AuditySource.Play(float).
public static bool FadeIn(AudioSource source, float fadeSeconds)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.Single |
fadeSeconds |
Trigger(AudioSource, AudityQuantize)
Section titled “Trigger(AudioSource, AudityQuantize)”Fires every Trigger In (anonymous API - all Trigger Ins, including named ones).
Prefer DarkEffekt.Audity.AudityMessaging.Trigger(UnityEngine.AudioSource%2cDarkEffekt.Audity.AudityParameterId%2cDarkEffekt.Audity.AudityQuantize) for
a single named trigger parameter.
public static bool Trigger(AudioSource source, AudityQuantize quantize = AudityQuantize.Immediate)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityQuantize | quantize |
Trigger(AudioSource, AudityParameterId, AudityQuantize)
Section titled “Trigger(AudioSource, AudityParameterId, AudityQuantize)”Fires Trigger In nodes bound to the given parameter id (and aliases). Does not fire anonymous (unnamed) Trigger Ins.
public static bool Trigger(AudioSource source, AudityParameterId id, AudityQuantize quantize = AudityQuantize.Immediate)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | id |
| DarkEffekt.Audity.AudityQuantize | quantize |
Trigger(AudioSource, string, AudityQuantize)
Section titled “Trigger(AudioSource, string, AudityQuantize)”Fires the named Trigger parameter on the instance playing on source.
public static bool Trigger(AudioSource source, string name, AudityQuantize quantize = AudityQuantize.Immediate)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.String |
name |
| DarkEffekt.Audity.AudityQuantize | quantize |
SetTempo(AudioSource, double, int)
Section titled “SetTempo(AudioSource, double, int)”Sets the tempo grid used by quantized triggers for the instance playing on source.
public static bool SetTempo(AudioSource source, double bpm, int beatsPerBar = 4)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
System.Double |
bpm |
System.Int32 |
beatsPerBar |
StartQuantized(AudioSource, AudityQuantize)
Section titled “StartQuantized(AudioSource, AudityQuantize)”Holds the instance’s onset (silence, clock frozen) until the next boundary of
its effective transport, then starts exactly there. Must be sent immediately
after Play(), before the first block renders - the FadeIn contract.
No active transport → starts immediately.
public static bool StartQuantized(AudioSource source, AudityQuantize quantize)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityQuantize | quantize |
BindSource(AudioSource, AudityParameterId, AudityBankHandle)
Section titled “BindSource(AudioSource, AudityParameterId, AudityBankHandle)”Repoints a rebindable source key (a Sample Set member) at a resident bank - pointer repoint + refcount only, cannot load. The bind latches a persistent per-instance slot: it holds until repointed and applies to future triggers; voices already playing ride their old bank to completion (a looping voice never completes - stop and retrigger it to pick up the new bank).
public static bool BindSource(AudioSource source, AudityParameterId key, AudityBankHandle bank)Returns
Section titled “Returns”System.Boolean: True if the source is playing a live Audity instance that handled the message.
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | key |
| DarkEffekt.Audity.AudityBankHandle | bank |
ClearSource(AudioSource, AudityParameterId)
Section titled “ClearSource(AudioSource, AudityParameterId)”Clears a source key back to its compile-baked default content.
public static bool ClearSource(AudioSource source, AudityParameterId key)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | key |
LatchSourceBank(AudioSource, AudityParameterId, AudityBankHandle)
Section titled “LatchSourceBank(AudioSource, AudityParameterId, AudityBankHandle)”Arms a one-shot bank for key, captured into the voices of
the next Play trigger on the bound player(s) and then discarded - per-call
argument semantics, independent of the persistent DarkEffekt.Audity.AudityMessaging.BindSource(UnityEngine.AudioSource%2cDarkEffekt.Audity.AudityParameterId%2cDarkEffekt.Audity.AudityBankHandle)
slot (which remains the fallback for triggers without a latch). Pair with a
trigger for the design’s Play(key, bank).
public static bool LatchSourceBank(AudioSource source, AudityParameterId key, AudityBankHandle bank)Returns
Section titled “Returns”System.Boolean
Parameters
Section titled “Parameters”| Type | Name |
|---|---|
UnityEngine.AudioSource |
source |
| DarkEffekt.Audity.AudityParameterId | key |
| DarkEffekt.Audity.AudityBankHandle | bank |