mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-12 10:37:06 +00:00
Code cleanup: Audio effects fix and audio object pooling
Commit cdbe5686
This commit is contained in:
parent
f98af9e175
commit
82ae055fe5
21 changed files with 8 additions and 109 deletions
|
|
@ -31,11 +31,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public bool IsEffectEnabled { get; private set; }
|
public bool IsEffectEnabled { get; private set; }
|
||||||
|
|
||||||
public AuxiliaryBufferCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuxiliaryBufferCommand Initialize(
|
public AuxiliaryBufferCommand Initialize(
|
||||||
uint bufferOffset,
|
uint bufferOffset,
|
||||||
byte inputBufferOffset,
|
byte inputBufferOffset,
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public bool HasVolumeRamp { get; private set; }
|
public bool HasVolumeRamp { get; private set; }
|
||||||
public bool IsFirstMixBuffer { get; private set; }
|
public bool IsFirstMixBuffer { get; private set; }
|
||||||
|
|
||||||
public BiquadFilterAndMixCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiquadFilterAndMixCommand Initialize(
|
public BiquadFilterAndMixCommand Initialize(
|
||||||
float volume0,
|
float volume0,
|
||||||
float volume1,
|
float volume1,
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
private BiquadFilterParameter2 _parameter;
|
private BiquadFilterParameter2 _parameter;
|
||||||
|
|
||||||
public BiquadFilterCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiquadFilterCommand Initialize(
|
public BiquadFilterCommand Initialize(
|
||||||
int baseIndex,
|
int baseIndex,
|
||||||
ref BiquadFilterParameter2 filter,
|
ref BiquadFilterParameter2 filter,
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public bool IsEffectEnabled { get; private set; }
|
public bool IsEffectEnabled { get; private set; }
|
||||||
|
|
||||||
public CaptureBufferCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public CaptureBufferCommand Initialize(uint bufferOffset, byte inputBufferOffset, ulong sendBufferInfo, bool isEnabled,
|
public CaptureBufferCommand Initialize(uint bufferOffset, byte inputBufferOffset, ulong sendBufferInfo, bool isEnabled,
|
||||||
uint countMax, CpuAddress outputBuffer, uint updateCount, uint writeOffset, int nodeId)
|
uint countMax, CpuAddress outputBuffer, uint updateCount, uint writeOffset, int nodeId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public uint EstimatedProcessingTime { get; set; }
|
public uint EstimatedProcessingTime { get; set; }
|
||||||
|
|
||||||
public ClearMixBufferCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClearMixBufferCommand Initialize(int nodeId)
|
public ClearMixBufferCommand Initialize(int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public ushort InputBufferIndex { get; private set; }
|
public ushort InputBufferIndex { get; private set; }
|
||||||
public ushort OutputBufferIndex { get; private set; }
|
public ushort OutputBufferIndex { get; private set; }
|
||||||
|
|
||||||
public CopyMixBufferCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public CopyMixBufferCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId)
|
public CopyMixBufferCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ using Ryujinx.Audio.Renderer.Common;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using Ryujinx.Memory;
|
|
||||||
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public Memory<float> DepopBuffer { get; private set; }
|
public Memory<float> DepopBuffer { get; private set; }
|
||||||
|
|
||||||
public DepopForMixBuffersCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public DepopForMixBuffersCommand Initialize(Memory<float> depopBuffer, uint bufferOffset, uint mixBufferCount, int nodeId, uint sampleRate)
|
public DepopForMixBuffersCommand Initialize(Memory<float> depopBuffer, uint bufferOffset, uint mixBufferCount, int nodeId, uint sampleRate)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public Memory<float> Buffers { get; private set; }
|
public Memory<float> Buffers { get; private set; }
|
||||||
|
|
||||||
public DeviceSinkCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public DeviceSinkCommand Initialize(uint bufferOffset, DeviceSink sink, int sessionId, Memory<float> buffers, int nodeId)
|
public DeviceSinkCommand Initialize(uint bufferOffset, DeviceSink sink, int sessionId, Memory<float> buffers, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public int Length { get; private set; }
|
public int Length { get; private set; }
|
||||||
public float Value { get; private set; }
|
public float Value { get; private set; }
|
||||||
|
|
||||||
public FillBufferCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public FillBufferCommand Initialize(SplitterDestination destination, int length, float value, int nodeId)
|
public FillBufferCommand Initialize(SplitterDestination destination, int length, float value, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public float Volume { get; private set; }
|
public float Volume { get; private set; }
|
||||||
|
|
||||||
public MixCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MixCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId, float volume)
|
public MixCommand Initialize(uint inputBufferIndex, uint outputBufferIndex, int nodeId, float volume)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public int LastSampleIndex { get; private set; }
|
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)
|
public MixRampCommand Initialize(float volume0, float volume1, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceState> state, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public Memory<VoiceState> State { get; private set; }
|
public Memory<VoiceState> State { get; private set; }
|
||||||
|
|
||||||
public MixRampGroupedCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MixRampGroupedCommand Initialize(
|
public MixRampGroupedCommand Initialize(
|
||||||
uint mixBufferCount,
|
uint mixBufferCount,
|
||||||
uint inputBufferIndex,
|
uint inputBufferIndex,
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public bool HasVolumeRamp { get; private set; }
|
public bool HasVolumeRamp { get; private set; }
|
||||||
public bool IsFirstMixBuffer { get; private set; }
|
public bool IsFirstMixBuffer { get; private set; }
|
||||||
|
|
||||||
public MultiTapBiquadFilterAndMixCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MultiTapBiquadFilterAndMixCommand Initialize(
|
public MultiTapBiquadFilterAndMixCommand Initialize(
|
||||||
float volume0,
|
float volume0,
|
||||||
float volume1,
|
float volume1,
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public int OutputBufferIndex { get; private set; }
|
public int OutputBufferIndex { get; private set; }
|
||||||
public bool[] IsInitialized { 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)
|
public MultiTapBiquadFilterCommand Initialize(int baseIndex, ReadOnlySpan<BiquadFilterParameter2> filters, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
|
||||||
{
|
{
|
||||||
Parameters = filters.ToArray();
|
Parameters = filters.ToArray();
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public Type PerformanceType { get; set; }
|
public Type PerformanceType { get; set; }
|
||||||
|
|
||||||
public PerformanceCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public PerformanceCommand Initialize(ref PerformanceEntryAddresses performanceEntryAddresses, Type performanceType, int nodeId)
|
public PerformanceCommand Initialize(ref PerformanceEntryAddresses performanceEntryAddresses, Type performanceType, int nodeId)
|
||||||
{
|
{
|
||||||
if (PerformanceEntryAddresses is not null)
|
if (PerformanceEntryAddresses is not null)
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public Memory<float> OutBuffer { get; private set; }
|
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)
|
public UpsampleCommand Initialize(uint bufferOffset, UpsamplerInfo info, uint inputCount, Span<byte> inputBufferOffset, uint bufferCount, uint sampleCount, uint sampleRate, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
|
||||||
public float Volume { get; private set; }
|
public float Volume { get; private set; }
|
||||||
|
|
||||||
public VolumeCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public VolumeCommand Initialize(float volume, uint bufferIndex, int nodeId)
|
public VolumeCommand Initialize(float volume, uint bufferIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
public float Volume0 { get; private set; }
|
public float Volume0 { get; private set; }
|
||||||
public float Volume1 { get; private set; }
|
public float Volume1 { get; private set; }
|
||||||
|
|
||||||
public VolumeRampCommand()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public VolumeRampCommand Initialize(float volume0, float volume1, uint bufferIndex, int nodeId)
|
public VolumeRampCommand Initialize(float volume0, float volume1, uint bufferIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using CpuAddress = System.UInt64;
|
using CpuAddress = System.UInt64;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server
|
namespace Ryujinx.Audio.Renderer.Server
|
||||||
|
|
@ -98,8 +97,6 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
case CommandType.BiquadFilter:
|
case CommandType.BiquadFilter:
|
||||||
_biquadFilterCommandPool.Release((BiquadFilterCommand)command);
|
_biquadFilterCommandPool.Release((BiquadFilterCommand)command);
|
||||||
break;
|
break;
|
||||||
case CommandType.BiquadFilterFloatCoeff:
|
|
||||||
throw new NotImplementedException();
|
|
||||||
case CommandType.Mix:
|
case CommandType.Mix:
|
||||||
_mixCommandPool.Release((MixCommand)command);
|
_mixCommandPool.Release((MixCommand)command);
|
||||||
break;
|
break;
|
||||||
|
|
@ -157,8 +154,6 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
case CommandType.MultiTapBiquadFilter:
|
case CommandType.MultiTapBiquadFilter:
|
||||||
_multiTapBiquadFilterCommandPool.Release((MultiTapBiquadFilterCommand)command);
|
_multiTapBiquadFilterCommandPool.Release((MultiTapBiquadFilterCommand)command);
|
||||||
break;
|
break;
|
||||||
case CommandType.MultiTapBiquadFilterFloatCoeff:
|
|
||||||
throw new NotImplementedException();
|
|
||||||
case CommandType.CaptureBuffer:
|
case CommandType.CaptureBuffer:
|
||||||
_captureBufferCommandPool.Release((CaptureBufferCommand)command);
|
_captureBufferCommandPool.Release((CaptureBufferCommand)command);
|
||||||
break;
|
break;
|
||||||
|
|
@ -168,24 +163,20 @@ namespace Ryujinx.Audio.Renderer.Server
|
||||||
case CommandType.BiquadFilterAndMix:
|
case CommandType.BiquadFilterAndMix:
|
||||||
_biquadFilterAndMixCommandPool.Release((BiquadFilterAndMixCommand)command);
|
_biquadFilterAndMixCommandPool.Release((BiquadFilterAndMixCommand)command);
|
||||||
break;
|
break;
|
||||||
case CommandType.BiquadFilterAndMixFloatCoeff:
|
|
||||||
throw new NotImplementedException();
|
|
||||||
case CommandType.MultiTapBiquadFilterAndMix:
|
case CommandType.MultiTapBiquadFilterAndMix:
|
||||||
_multiTapBiquadFilterAndMixCommandPool.Release((MultiTapBiquadFilterAndMixCommand)command);
|
_multiTapBiquadFilterAndMixCommandPool.Release((MultiTapBiquadFilterAndMixCommand)command);
|
||||||
break;
|
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:
|
case CommandType.FillBuffer:
|
||||||
_fillBufferCommandPool.Release((FillBufferCommand)command);
|
_fillBufferCommandPool.Release((FillBufferCommand)command);
|
||||||
break;
|
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:
|
default:
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common
|
namespace Ryujinx.Common
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue