Code cleanup: Audio effects fix and audio object pooling

Commit cdbe5686
This commit is contained in:
KeatonTheBot 2025-10-26 17:33:51 -05:00
parent f98af9e175
commit 82ae055fe5
21 changed files with 8 additions and 109 deletions

View file

@ -31,11 +31,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public bool IsEffectEnabled { get; private set; }
public AuxiliaryBufferCommand()
{
}
public AuxiliaryBufferCommand Initialize(
uint bufferOffset,
byte inputBufferOffset,

View file

@ -34,11 +34,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public bool HasVolumeRamp { get; private set; }
public bool IsFirstMixBuffer { get; private set; }
public BiquadFilterAndMixCommand()
{
}
public BiquadFilterAndMixCommand Initialize(
float volume0,
float volume1,

View file

@ -21,11 +21,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
private BiquadFilterParameter2 _parameter;
public BiquadFilterCommand()
{
}
public BiquadFilterCommand Initialize(
int baseIndex,
ref BiquadFilterParameter2 filter,

View file

@ -30,11 +30,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public bool IsEffectEnabled { get; private set; }
public CaptureBufferCommand()
{
}
public CaptureBufferCommand Initialize(uint bufferOffset, byte inputBufferOffset, ulong sendBufferInfo, bool isEnabled,
uint countMax, CpuAddress outputBuffer, uint updateCount, uint writeOffset, int nodeId)
{

View file

@ -10,11 +10,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public uint EstimatedProcessingTime { get; set; }
public ClearMixBufferCommand()
{
}
public ClearMixBufferCommand Initialize(int nodeId)
{
Enabled = true;

View file

@ -13,11 +13,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public ushort InputBufferIndex { get; private set; }
public ushort OutputBufferIndex { get; private set; }
public CopyMixBufferCommand()
{
}
public CopyMixBufferCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId)
{
Enabled = true;

View file

@ -3,7 +3,6 @@ using Ryujinx.Audio.Renderer.Common;
using Ryujinx.Audio.Renderer.Server.Voice;
using System;
using Ryujinx.Audio.Renderer.Parameter;
using Ryujinx.Memory;
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
namespace Ryujinx.Audio.Renderer.Dsp.Command

View file

@ -21,11 +21,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public Memory<float> DepopBuffer { get; private set; }
public DepopForMixBuffersCommand()
{
}
public DepopForMixBuffersCommand Initialize(Memory<float> depopBuffer, uint bufferOffset, uint mixBufferCount, int nodeId, uint sampleRate)
{
Enabled = true;

View file

@ -25,11 +25,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public Memory<float> Buffers { get; private set; }
public DeviceSinkCommand()
{
}
public DeviceSinkCommand Initialize(uint bufferOffset, DeviceSink sink, int sessionId, Memory<float> buffers, int nodeId)
{
Enabled = true;

View file

@ -19,11 +19,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public int Length { get; private set; }
public float Value { get; private set; }
public FillBufferCommand()
{
}
public FillBufferCommand Initialize(SplitterDestination destination, int length, float value, int nodeId)
{
Enabled = true;

View file

@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public float Volume { get; private set; }
public MixCommand()
{
}
public MixCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId, float volume)
{
Enabled = true;

View file

@ -24,11 +24,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public int LastSampleIndex { get; private set; }
public MixRampCommand()
{
}
public MixRampCommand Initialize(float volume0, float volume1, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceState> state, int nodeId)
{
Enabled = true;

View file

@ -24,11 +24,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public Memory<VoiceState> State { get; private set; }
public MixRampGroupedCommand()
{
}
public MixRampGroupedCommand Initialize(
uint mixBufferCount,
uint inputBufferIndex,

View file

@ -38,11 +38,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public bool HasVolumeRamp { get; private set; }
public bool IsFirstMixBuffer { get; private set; }
public MultiTapBiquadFilterAndMixCommand()
{
}
public MultiTapBiquadFilterAndMixCommand Initialize(
float volume0,
float volume1,

View file

@ -20,11 +20,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public int OutputBufferIndex { get; private set; }
public bool[] IsInitialized { get; private set; }
public MultiTapBiquadFilterCommand()
{
}
public MultiTapBiquadFilterCommand Initialize(int baseIndex, ReadOnlySpan<BiquadFilterParameter2> filters, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
{
Parameters = filters.ToArray();

View file

@ -23,11 +23,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public Type PerformanceType { get; set; }
public PerformanceCommand()
{
}
public PerformanceCommand Initialize(ref PerformanceEntryAddresses performanceEntryAddresses, Type performanceType, int nodeId)
{
if (PerformanceEntryAddresses is not null)

View file

@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public Memory<float> OutBuffer { get; private set; }
public UpsampleCommand()
{
}
public UpsampleCommand Initialize(uint bufferOffset, UpsamplerInfo info, uint inputCount, Span<byte> inputBufferOffset, uint bufferCount, uint sampleCount, uint sampleRate, int nodeId)
{
Enabled = true;

View file

@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public float Volume { get; private set; }
public VolumeCommand()
{
}
public VolumeCommand Initialize(float volume, uint bufferIndex, int nodeId)
{
Enabled = true;

View file

@ -19,11 +19,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public float Volume0 { get; private set; }
public float Volume1 { get; private set; }
public VolumeRampCommand()
{
}
public VolumeRampCommand Initialize(float volume0, float volume1, uint bufferIndex, int nodeId)
{
Enabled = true;

View file

@ -10,7 +10,6 @@ using Ryujinx.Audio.Renderer.Server.Upsampler;
using Ryujinx.Audio.Renderer.Server.Voice;
using Ryujinx.Common;
using System;
using System.Runtime.CompilerServices;
using CpuAddress = System.UInt64;
namespace Ryujinx.Audio.Renderer.Server
@ -98,8 +97,6 @@ namespace Ryujinx.Audio.Renderer.Server
case CommandType.BiquadFilter:
_biquadFilterCommandPool.Release((BiquadFilterCommand)command);
break;
case CommandType.BiquadFilterFloatCoeff:
throw new NotImplementedException();
case CommandType.Mix:
_mixCommandPool.Release((MixCommand)command);
break;
@ -157,8 +154,6 @@ namespace Ryujinx.Audio.Renderer.Server
case CommandType.MultiTapBiquadFilter:
_multiTapBiquadFilterCommandPool.Release((MultiTapBiquadFilterCommand)command);
break;
case CommandType.MultiTapBiquadFilterFloatCoeff:
throw new NotImplementedException();
case CommandType.CaptureBuffer:
_captureBufferCommandPool.Release((CaptureBufferCommand)command);
break;
@ -168,24 +163,20 @@ namespace Ryujinx.Audio.Renderer.Server
case CommandType.BiquadFilterAndMix:
_biquadFilterAndMixCommandPool.Release((BiquadFilterAndMixCommand)command);
break;
case CommandType.BiquadFilterAndMixFloatCoeff:
throw new NotImplementedException();
case CommandType.MultiTapBiquadFilterAndMix:
_multiTapBiquadFilterAndMixCommandPool.Release((MultiTapBiquadFilterAndMixCommand)command);
break;
case CommandType.MultiTapBiquadFilterAndMixFloatCoef:
throw new NotImplementedException();
case CommandType.AuxiliaryBufferGrouped:
throw new NotImplementedException();
case CommandType.FillMixBuffer:
throw new NotImplementedException();
case CommandType.BiquadFilterCrossFade:
throw new NotImplementedException();
case CommandType.MultiTapBiquadFilterCrossFade:
throw new NotImplementedException();
case CommandType.FillBuffer:
_fillBufferCommandPool.Release((FillBufferCommand)command);
break;
case CommandType.BiquadFilterFloatCoeff:
case CommandType.MultiTapBiquadFilterFloatCoeff:
case CommandType.BiquadFilterAndMixFloatCoeff:
case CommandType.MultiTapBiquadFilterAndMixFloatCoef:
case CommandType.AuxiliaryBufferGrouped:
case CommandType.FillMixBuffer:
case CommandType.BiquadFilterCrossFade:
case CommandType.MultiTapBiquadFilterCrossFade:
default:
throw new NotImplementedException();
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Threading;
namespace Ryujinx.Common
{