logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AudioReverbVoiceCapPolicy

    Decides which voices keep their per-source reverb when more voices want it than the authored cap allows: the nearest voices win, and which voice gives its slot back because it stayed dry. Pure and engine-free; the caller owns the list of voices that hold a slot.

    Inheritance
    object
    AudioReverbVoiceCapPolicy
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.AudioPlayer.Domain.Services
    Assembly: Serenity.AudioPlayer.Domain.dll
    Syntax
    public static class AudioReverbVoiceCapPolicy

    Fields

    DisplacementMargin

    How much nearer than the farthest reverberated voice a candidate must be to take its slot, as a share of that voice's distance. Two sources that orbit at almost the same distance therefore never trade a slot back and forth.

    Declaration
    public const float DisplacementMargin = 0.1
    Field Value
    Type Description
    float

    DrySecondsBeforeSlotRelease

    How long a reverberated voice may stay dry before it gives its slot up. Longer than the time an occlusion change takes to settle, so a wet share dipping while the occlusion smooths never churns a slot.

    Declaration
    public const float DrySecondsBeforeSlotRelease = 0.5
    Field Value
    Type Description
    float

    MaxDryFrameSeconds

    The most one frame adds to a dry stretch, so a single long frame (a hitch, a load) never releases a slot on its own.

    Declaration
    public const float MaxDryFrameSeconds = 0.1
    Field Value
    Type Description
    float

    NoDrySeconds

    Declaration
    public const float NoDrySeconds = 0
    Field Value
    Type Description
    float

    Methods

    Decide(IReadOnlyList<AudioReverbVoice>, float, int)

    Admits the candidate while there is room. At the cap a candidate clearly nearer than the farthest reverberated voice (by more than DisplacementMargin of its distance) takes that voice's slot; anything else is rejected, and a tie in distance never takes a slot.

    Declaration
    public static AudioReverbAdmission Decide(IReadOnlyList<AudioReverbVoice> reverberated, float candidateDistance, int maxReverberatedVoices)
    Parameters
    Type Name Description
    IReadOnlyList<AudioReverbVoice> reverberated
    float candidateDistance
    int maxReverberatedVoices
    Returns
    Type Description
    AudioReverbAdmission

    NextDrySeconds(float, bool, float)

    How long the voice has been dry in a row: back to zero the moment its wet share is audible, otherwise grown by the elapsed time, at most MaxDryFrameSeconds per call.

    Declaration
    public static float NextDrySeconds(float drySeconds, bool isWetShareAudible, float elapsedSeconds)
    Parameters
    Type Name Description
    float drySeconds
    bool isWetShareAudible
    float elapsedSeconds
    Returns
    Type Description
    float

    SelectSlotToTrim(IReadOnlyList<AudioReverbVoice>, int)

    The slot of the farthest voice when more voices hold a slot than the cap allows, otherwise no slot.

    Declaration
    public static int SelectSlotToTrim(IReadOnlyList<AudioReverbVoice> reverberated, int maxReverberatedVoices)
    Parameters
    Type Name Description
    IReadOnlyList<AudioReverbVoice> reverberated
    int maxReverberatedVoices
    Returns
    Type Description
    int

    ShouldReleaseSlot(float)

    Whether a voice dry for drySeconds in a row must give its reverb slot back.

    Declaration
    public static bool ShouldReleaseSlot(float drySeconds)
    Parameters
    Type Name Description
    float drySeconds
    Returns
    Type Description
    bool
    In this article
    © 2026 Serenity. All Rights Reserved