//
// Copyright (c) 2019-2020 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 System;
using System.Diagnostics;
namespace Ryujinx.Audio.Renderer.Integration
{
///
/// Represent an hardware device used in
///
public interface HardwareDevice : IDisposable
{
///
/// Get the supported sample rate of this device.
///
/// The supported sample rate of this device.
uint GetSampleRate();
///
/// Get the channel count supported by this device.
///
/// The channel count supported by this device.
uint GetChannelCount();
///
/// Appends new PCM16 samples to the device.
///
/// The new PCM16 samples.
/// The number of channels.
void AppendBuffer(ReadOnlySpan data, uint channelCount);
///
/// Check if the audio renderer needs to perform downmixing.
///
/// True if downmixing is needed.
public bool NeedDownmixing()
{
uint channelCount = GetChannelCount();
Debug.Assert(channelCount > 0 && channelCount <= RendererConstants.ChannelCountMax);
return channelCount != RendererConstants.ChannelCountMax;
}
}
}