mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-30 06:20:47 -07:00
Move solution and projects to src
This commit is contained in:
26
src/Ryujinx.Audio/Backends/Common/BackendHelper.cs
Normal file
26
src/Ryujinx.Audio/Backends/Common/BackendHelper.cs
Normal file
@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user