logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AudioPriorityCandidateSelector

    Default IAudioPriorityCandidateSelector. Picks the least important replaceable slot allowed by the policy, breaking ties in favor of the oldest sound.

    Inheritance
    object
    AudioPriorityCandidateSelector
    Implements
    IAudioPriorityCandidateSelector
    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 class AudioPriorityCandidateSelector : IAudioPriorityCandidateSelector
    Remarks

    Selection rules:

    • Only replaceable candidates are considered.
    • IgnoreIfNoSourceAvailable never selects anything.
    • ReplaceLowerPriority requires candidate priority < requested.
    • ReplaceLowerOrEqualPriority requires candidate priority <= requested.
    • AlwaysReplace accepts any replaceable candidate.
    • Among eligible candidates the lowest priority wins; ties are broken by the lowest sequence (the oldest sound).

    Constructors

    AudioPriorityCandidateSelector()

    Declaration
    public AudioPriorityCandidateSelector()

    Methods

    SelectReplacement(IReadOnlyList<AudioPlaybackCandidate>, int, AudioPriorityPolicy)

    Chooses the least important replaceable candidate that satisfies the given policy.

    Declaration
    public int SelectReplacement(IReadOnlyList<AudioPlaybackCandidate> activeCandidates, int requestedPriority, AudioPriorityPolicy policy)
    Parameters
    Type Name Description
    IReadOnlyList<AudioPlaybackCandidate> activeCandidates

    Snapshots of the currently playing slots.

    int requestedPriority

    Serenity priority of the sound being requested (higher = more important).

    AudioPriorityPolicy policy

    Policy controlling which candidates are eligible.

    Returns
    Type Description
    int

    The Index of the slot to reassign, or -1 when no candidate is eligible (the new sound should not play).

    Implements

    IAudioPriorityCandidateSelector
    In this article
    © 2026 Serenity. All Rights Reserved