mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 01:55:27 +00:00
4c2ab880ef
* Ryujinx.Audio: Remove BOM from files * misc: Relicense Ryujinx.Audio under the terms of the MIT license With the approvals of all the Ryujinx.Audio contributors, this commit changes Ryujinx.Audio license from LGPLv3 to MIT.
27 lines
795 B
C#
27 lines
795 B
C#
using Ryujinx.Audio.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.Audio.Backends.Common
|
|
{
|
|
public static class BackendHelper
|
|
{
|
|
public static int GetSampleSize(SampleFormat format)
|
|
{
|
|
return format switch
|
|
{
|
|
SampleFormat.PcmInt8 => sizeof(byte),
|
|
SampleFormat.PcmInt16 => sizeof(ushort),
|
|
SampleFormat.PcmInt24 => 3,
|
|
SampleFormat.PcmInt32 => sizeof(int),
|
|
SampleFormat.PcmFloat => sizeof(float),
|
|
_ => throw new ArgumentException($"{format}"),
|
|
};
|
|
}
|
|
|
|
public static int GetSampleCount(SampleFormat format, int channelCount, int bufferSize)
|
|
{
|
|
return bufferSize / GetSampleSize(format) / channelCount;
|
|
}
|
|
}
|
|
}
|