Skip to content

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.

Declaration
public static class AudityMessaging

Sends a raw control message to the Audity instance playing on source.

Declaration
public static bool Send<T>(AudioSource source, ref T message) where T : unmanaged

System.Boolean: True if the source is playing a live Audity instance that handled the message.

Type Name Description
UnityEngine.AudioSource source The AudioSource whose generator instance should receive the message.
<T> message The unmanaged message payload.
  • 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.

Declaration
public static bool SetParameter(AudioSource source, AudityParameterId id, float value, float smoothSeconds = -1, int elementIndex = 0)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

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.

Declaration
public static bool TryGetFloat(AudioSource source, AudityParameterId id, out float value, int element = 0)

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.

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.

Declaration
public static bool TryGetFloat(AudioSource source, string name, out float value, int element = 0)

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.

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).

Declaration
public static int GetFloats(AudioSource source, AudityParameterId id, Span<float> destination)

System.Int32: How many elements were filled.

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).

Declaration
public static int GetFloats(AudioSource source, string name, Span<float> destination)

System.Int32: How many elements were filled.

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)”
Declaration
public static bool SetFloat(AudioSource source, AudityParameterId id, float value, float smoothSeconds = -1, int elementIndex = 0)

System.Boolean

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)”
Declaration
public static bool SetBool(AudioSource source, AudityParameterId id, bool value)

System.Boolean

Type Name
UnityEngine.AudioSource source
DarkEffekt.Audity.AudityParameterId id
System.Boolean value

SetInt(AudioSource, AudityParameterId, int)

Section titled “SetInt(AudioSource, AudityParameterId, int)”
Declaration
public static bool SetInt(AudioSource source, AudityParameterId id, int value)

System.Boolean

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).

Declaration
public static bool SetVector(AudioSource source, AudityParameterId id, Vector2 value, float smoothSeconds = -1)

System.Boolean

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).

Declaration
public static bool SetVector(AudioSource source, AudityParameterId id, Vector3 value, float smoothSeconds = -1)

System.Boolean

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).

Declaration
public static bool SetVector(AudioSource source, AudityParameterId id, Vector4 value, float smoothSeconds = -1)

System.Boolean

Type Name
UnityEngine.AudioSource source
DarkEffekt.Audity.AudityParameterId id
UnityEngine.Vector4 value
System.Single smoothSeconds

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.

Declaration
public static bool SetSpatial(AudioSource source, Vector3 listenerPosition, Vector3 emitterPosition)

System.Boolean

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).

Declaration
public static bool SetSpatial(AudioSource source, Vector3 listenerPosition, Vector3 emitterPosition, Vector3 listenerForward, Vector3 listenerUp, Vector3 listenerVelocity, Vector3 emitterVelocity)

System.Boolean

Type Name
UnityEngine.AudioSource source
UnityEngine.Vector3 listenerPosition
UnityEngine.Vector3 emitterPosition
UnityEngine.Vector3 listenerForward
UnityEngine.Vector3 listenerUp
UnityEngine.Vector3 listenerVelocity
UnityEngine.Vector3 emitterVelocity

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.

Declaration
public static bool SetTime(AudioSource source, float rate, float sessionTime)

System.Boolean

Type Name
UnityEngine.AudioSource source
System.Single rate
System.Single sessionTime

Stops the instance playing on source, fading out over fadeSeconds.

Declaration
public static bool Stop(AudioSource source, float fadeSeconds)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

Type Name
UnityEngine.AudioSource source
System.Single fadeSeconds

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).

Declaration
public static bool FadeIn(AudioSource source, float fadeSeconds)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

Type Name
UnityEngine.AudioSource source
System.Single fadeSeconds

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.

Declaration
public static bool Trigger(AudioSource source, AudityQuantize quantize = AudityQuantize.Immediate)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

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.

Declaration
public static bool Trigger(AudioSource source, AudityParameterId id, AudityQuantize quantize = AudityQuantize.Immediate)

System.Boolean

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.

Declaration
public static bool Trigger(AudioSource source, string name, AudityQuantize quantize = AudityQuantize.Immediate)

System.Boolean

Type Name
UnityEngine.AudioSource source
System.String name
DarkEffekt.Audity.AudityQuantize quantize

Sets the tempo grid used by quantized triggers for the instance playing on source.

Declaration
public static bool SetTempo(AudioSource source, double bpm, int beatsPerBar = 4)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

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.

Declaration
public static bool StartQuantized(AudioSource source, AudityQuantize quantize)

System.Boolean

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).

Declaration
public static bool BindSource(AudioSource source, AudityParameterId key, AudityBankHandle bank)

System.Boolean: True if the source is playing a live Audity instance that handled the message.

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.

Declaration
public static bool ClearSource(AudioSource source, AudityParameterId key)

System.Boolean

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).

Declaration
public static bool LatchSourceBank(AudioSource source, AudityParameterId key, AudityBankHandle bank)

System.Boolean

Type Name
UnityEngine.AudioSource source
DarkEffekt.Audity.AudityParameterId key
DarkEffekt.Audity.AudityBankHandle bank