mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 09:41:14 +02:00
Revert and reimplement Float BiquadFilterEffect support, fixes infinite load issues in a few games like Splatoon 3. Fix incorrect string check with the new thread naming system. Implement object pooling for all Audio Commands and a few other audio related objects and use a growing error list for updating wave buffers instead of always allocating space for 8 errors.
64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using Ryujinx.Audio.Renderer.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
{
|
|
public class DepopPrepareCommand : ICommand
|
|
{
|
|
public bool Enabled { get; set; }
|
|
|
|
public int NodeId { get; private set; }
|
|
|
|
public CommandType CommandType => CommandType.DepopPrepare;
|
|
|
|
public uint EstimatedProcessingTime { get; set; }
|
|
|
|
public uint MixBufferCount { get; private set; }
|
|
|
|
public ushort[] OutputBufferIndices { get; }
|
|
|
|
public Memory<VoiceState> State { get; private set; }
|
|
public Memory<float> DepopBuffer { get; private set; }
|
|
|
|
public DepopPrepareCommand()
|
|
{
|
|
OutputBufferIndices = new ushort[Constants.MixBufferCountMax];
|
|
}
|
|
|
|
public DepopPrepareCommand Initialize(Memory<VoiceState> state, Memory<float> depopBuffer, uint mixBufferCount, uint bufferOffset, int nodeId, bool enabled)
|
|
{
|
|
Enabled = enabled;
|
|
NodeId = nodeId;
|
|
MixBufferCount = mixBufferCount;
|
|
|
|
for (int i = 0; i < Constants.MixBufferCountMax; i++)
|
|
{
|
|
OutputBufferIndices[i] = (ushort)(bufferOffset + i);
|
|
}
|
|
|
|
State = state;
|
|
DepopBuffer = depopBuffer;
|
|
|
|
return this;
|
|
}
|
|
|
|
public void Process(CommandList context)
|
|
{
|
|
ref VoiceState state = ref State.Span[0];
|
|
|
|
Span<float> depopBuffer = DepopBuffer.Span;
|
|
Span<float> lastSamplesSpan = state.LastSamples.AsSpan();
|
|
|
|
for (int i = 0; i < MixBufferCount; i++)
|
|
{
|
|
if (lastSamplesSpan[i] != 0)
|
|
{
|
|
depopBuffer[OutputBufferIndices[i]] += lastSamplesSpan[i];
|
|
|
|
lastSamplesSpan[i] = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|