mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-25 03:25:13 +00:00
1825bd87b4
This is the first commit of a series of reformat around the codebase as discussed internally some weeks ago. This project being one that isn't touched that much, it shouldn't cause conflict with any opened PRs.
26 lines
No EOL
794 B
C#
26 lines
No EOL
794 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;
|
|
}
|
|
}
|
|
} |