//
// Copyright (c) 2019-2021 Ryujinx
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
//
using Ryujinx.Common.Utilities;
using System;
using System.Runtime.InteropServices;
namespace Ryujinx.Audio.Renderer.Parameter
{
///
/// Input header for a splitter destination update.
///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct SplitterDestinationInParameter
{
///
/// Magic of the input header.
///
public uint Magic;
///
/// Target splitter destination data id.
///
public int Id;
///
/// Mix buffer volumes storage.
///
private MixArray _mixBufferVolume;
///
/// The mix to output the result of the splitter.
///
public int DestinationId;
///
/// Set to true if in use.
///
[MarshalAs(UnmanagedType.I1)]
public bool IsUsed;
///
/// Reserved/padding.
///
private unsafe fixed byte _reserved[3];
[StructLayout(LayoutKind.Sequential, Size = 4 * RendererConstants.MixBufferCountMax, Pack = 1)]
private struct MixArray { }
///
/// Mix buffer volumes.
///
/// Used when a splitter id is specified in the mix.
public Span MixBufferVolume => SpanHelpers.AsSpan(ref _mixBufferVolume);
///
/// The expected constant of any input header.
///
private const uint ValidMagic = 0x44444E53;
///
/// Check if the magic is valid.
///
/// Returns true if the magic is valid.
public bool IsMagicValid()
{
return Magic == ValidMagic;
}
}
}