using Ryujinx.Audio.Renderer.Common; using Ryujinx.Audio.Renderer.Parameter; using Ryujinx.Audio.Renderer.Server.MemoryPool; using System.Diagnostics; using static Ryujinx.Audio.Renderer.Common.BehaviourParameter; namespace Ryujinx.Audio.Renderer.Server.Sink { /// /// Base class used for server information of a sink. /// public class BaseSink { /// /// The type of this . /// public SinkType Type; /// /// Set to true if the sink is used. /// public bool IsUsed; /// /// Set to true if the sink need to be skipped because of invalid state. /// public bool ShouldSkip; /// /// The node id of the sink. /// public int NodeId; /// /// Create a new . /// public BaseSink() { CleanUp(); } /// /// Clean up the internal state of the . /// public virtual void CleanUp() { Type = TargetSinkType; IsUsed = false; ShouldSkip = false; } /// /// The target handled by this . /// public virtual SinkType TargetSinkType => SinkType.Invalid; /// /// Check if the sent by the user match the internal . /// /// The user parameter. /// Return true, if the sent by the user match the internal . public bool IsTypeValid(ref SinkInParameter parameter) { return parameter.Type == TargetSinkType; } /// /// Update the state during command generation. /// public virtual void UpdateForCommandGeneration() { Debug.Assert(Type == TargetSinkType); } /// /// Update the internal common parameters from user parameter. /// /// The user parameter. protected void UpdateStandardParameter(ref SinkInParameter parameter) { if (IsUsed != parameter.IsUsed) { IsUsed = parameter.IsUsed; NodeId = parameter.NodeId; } } /// /// Update the internal state from user parameter. /// /// The possible that was generated. /// The user parameter. /// The user output status. /// The mapper to use. public virtual void Update(out ErrorInfo errorInfo, ref SinkInParameter parameter, ref SinkOutStatus outStatus, PoolMapper mapper) { Debug.Assert(IsTypeValid(ref parameter)); errorInfo = new ErrorInfo(); } } }