aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-25 22:50:59 +0200
committerGitHub <noreply@github.com>2023-06-25 22:50:59 +0200
commit42d31f646dfe2dfc8ed646102c06ca44af7b8b07 (patch)
tree0e7b0a10c2b0e6cb06ea57e9e69d8b5cab2cd329 /src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
parent07fc3ded687fd1321f9ae73d0c72b2d7566c87d5 (diff)
[Ryujinx.Audio.Backends.SDL2] Address dotnet-format issues (#5364)1.1.918
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Address dotnet format CA1816 warnings * Address most dotnet format whitespace warnings * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Update src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs')
-rw-r--r--src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
index 14310b93..0bd73f3c 100644
--- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
+++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
@@ -12,19 +12,19 @@ namespace Ryujinx.Audio.Backends.SDL2
{
class SDL2HardwareDeviceSession : HardwareDeviceSessionOutputBase
{
- private SDL2HardwareDeviceDriver _driver;
- private ConcurrentQueue<SDL2AudioBuffer> _queuedBuffers;
- private DynamicRingBuffer _ringBuffer;
+ private readonly SDL2HardwareDeviceDriver _driver;
+ private readonly ConcurrentQueue<SDL2AudioBuffer> _queuedBuffers;
+ private readonly DynamicRingBuffer _ringBuffer;
private ulong _playedSampleCount;
- private ManualResetEvent _updateRequiredEvent;
+ private readonly ManualResetEvent _updateRequiredEvent;
private uint _outputStream;
private bool _hasSetupError;
- private SDL_AudioCallback _callbackDelegate;
- private int _bytesPerFrame;
+ private readonly SDL_AudioCallback _callbackDelegate;
+ private readonly int _bytesPerFrame;
private uint _sampleCount;
private bool _started;
private float _volume;
- private ushort _nativeSampleFormat;
+ private readonly ushort _nativeSampleFormat;
public SDL2HardwareDeviceSession(SDL2HardwareDeviceDriver driver, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount, float requestedVolume) : base(memoryManager, requestedSampleFormat, requestedSampleRate, requestedChannelCount)
{
@@ -72,7 +72,7 @@ namespace Ryujinx.Audio.Backends.SDL2
private unsafe void Update(IntPtr userdata, IntPtr stream, int streamLength)
{
- Span<byte> streamSpan = new Span<byte>((void*)stream, streamLength);
+ Span<byte> streamSpan = new((void*)stream, streamLength);
int maxFrameCount = (int)GetSampleCount(streamLength);
int bufferedFrames = _ringBuffer.Length / _bytesPerFrame;
@@ -82,7 +82,7 @@ namespace Ryujinx.Audio.Backends.SDL2
if (frameCount == 0)
{
// SDL2 left the responsibility to the user to clear the buffer.
- streamSpan.Fill(0);
+ streamSpan.Clear();
return;
}
@@ -96,7 +96,7 @@ namespace Ryujinx.Audio.Backends.SDL2
IntPtr pStreamSrc = (IntPtr)p;
// Zero the dest buffer
- streamSpan.Fill(0);
+ streamSpan.Clear();
// Apply volume to written data
SDL_MixAudioFormat(stream, pStreamSrc, _nativeSampleFormat, (uint)samples.Length, (int)(_volume * SDL_MIX_MAXVOLUME));
@@ -151,7 +151,7 @@ namespace Ryujinx.Audio.Backends.SDL2
if (_outputStream != 0)
{
- SDL2AudioBuffer driverBuffer = new SDL2AudioBuffer(buffer.DataPointer, GetSampleCount(buffer));
+ SDL2AudioBuffer driverBuffer = new(buffer.DataPointer, GetSampleCount(buffer));
_ringBuffer.Write(buffer.Data, 0, buffer.Data.Length);