remove unnecessary code
This commit is contained in:
parent
dfbcdfa83a
commit
e1cb957d7b
@ -79,8 +79,6 @@ namespace Ryujinx.Audio.Backends.SDL3
|
|||||||
|
|
||||||
private unsafe void Update(nint userdata, nint stream, int additional_amount, int total_amount)
|
private unsafe void Update(nint userdata, nint stream, int additional_amount, int total_amount)
|
||||||
{
|
{
|
||||||
Span<byte> streamSpan = new((void*)stream, additional_amount);
|
|
||||||
|
|
||||||
int maxFrameCount = (int)GetSampleCount(additional_amount);
|
int maxFrameCount = (int)GetSampleCount(additional_amount);
|
||||||
int bufferedFrames = _ringBuffer.Length / _bytesPerFrame;
|
int bufferedFrames = _ringBuffer.Length / _bytesPerFrame;
|
||||||
|
|
||||||
@ -88,29 +86,22 @@ namespace Ryujinx.Audio.Backends.SDL3
|
|||||||
|
|
||||||
if (frameCount == 0)
|
if (frameCount == 0)
|
||||||
{
|
{
|
||||||
// SDL3 left the responsibility to the user to clear the buffer.
|
|
||||||
streamSpan.Clear();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using SpanOwner<byte> samplesOwner = SpanOwner<byte>.Rent(frameCount * _bytesPerFrame);
|
using SpanOwner<byte> samplesOwner = SpanOwner<byte>.Rent(frameCount * _bytesPerFrame);
|
||||||
using SpanOwner<byte> destinationOwner = SpanOwner<byte>.Rent(frameCount * _bytesPerFrame);
|
using SpanOwner<byte> destinationOwner = SpanOwner<byte>.Rent(frameCount * _bytesPerFrame);
|
||||||
|
|
||||||
Span<byte> samples = samplesOwner.Span;
|
Span<byte> samples = samplesOwner.Span;
|
||||||
Span<byte> destinationBuffer = destinationOwner.Span;
|
Span<byte> destinationBuffer = destinationOwner.Span;
|
||||||
|
|
||||||
_ringBuffer.Read(samples, 0, samples.Length);
|
_ringBuffer.Read(samples, 0, samples.Length);
|
||||||
|
|
||||||
fixed (byte* pSrc = samples)
|
fixed (byte* pSrc = samples, pDst = destinationBuffer)
|
||||||
fixed (byte* pDst = destinationBuffer)
|
|
||||||
{
|
{
|
||||||
nint pStreamSrc = (nint)pSrc;
|
nint pStreamSrc = (nint)pSrc;
|
||||||
nint pStreamDst = (nint)pDst;
|
nint pStreamDst = (nint)pDst;
|
||||||
|
|
||||||
// Zero the dest buffer
|
|
||||||
streamSpan.Clear();
|
|
||||||
|
|
||||||
// Apply volume to written data
|
// Apply volume to written data
|
||||||
SDL_MixAudio(pStreamDst, pStreamSrc, _nativeSampleFormat, (uint)samples.Length, _driver.Volume);
|
SDL_MixAudio(pStreamDst, pStreamSrc, _nativeSampleFormat, (uint)samples.Length, _driver.Volume);
|
||||||
SDL_PutAudioStreamData(stream, pStreamSrc, samples.Length);
|
SDL_PutAudioStreamData(stream, pStreamSrc, samples.Length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user