Initial fix
Based off of Yuzu's PR authored by ogniK5377: https://github.com/yuzu-emu/yuzu/pull/1455
This commit is contained in:
parent
2e143365eb
commit
24d069759d
6 changed files with 100 additions and 0 deletions
16
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectContext.cs
Normal file
16
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectContext.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
{
|
||||||
|
class EffectContext
|
||||||
|
{
|
||||||
|
public EffectOut OutStatus;
|
||||||
|
|
||||||
|
public EffectContext()
|
||||||
|
{
|
||||||
|
OutStatus.State = EffectState.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectIn.cs
Normal file
25
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectIn.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0xc0, Pack = 4)]
|
||||||
|
unsafe struct EffectIn
|
||||||
|
{
|
||||||
|
public EffectType Type;
|
||||||
|
|
||||||
|
public byte FirstUpdate;
|
||||||
|
public byte Enabled;
|
||||||
|
|
||||||
|
public byte Unknown11;
|
||||||
|
|
||||||
|
public uint MixID;
|
||||||
|
|
||||||
|
public ulong BufferBase;
|
||||||
|
public ulong BufferSZ;
|
||||||
|
|
||||||
|
public int Priority;
|
||||||
|
|
||||||
|
public uint Unknown24;
|
||||||
|
public fixed byte Padding[0xa0];
|
||||||
|
}
|
||||||
|
}
|
14
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectOut.cs
Normal file
14
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectOut.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x13, Pack = 4)]
|
||||||
|
struct EffectOut
|
||||||
|
{
|
||||||
|
public EffectState State;
|
||||||
|
public int Unknown14;
|
||||||
|
public long Unknown18;
|
||||||
|
public short Unknown12;
|
||||||
|
public byte Unknown11;
|
||||||
|
}
|
||||||
|
}
|
12
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectState.cs
Normal file
12
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectState.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
{
|
||||||
|
enum EffectState
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
New = 1
|
||||||
|
}
|
||||||
|
}
|
12
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectType.cs
Normal file
12
Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/EffectType.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
{
|
||||||
|
enum EffectType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Aux = 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
|
||||||
private VoiceContext[] _voices;
|
private VoiceContext[] _voices;
|
||||||
|
|
||||||
|
private EffectContext[] _effects;
|
||||||
|
|
||||||
private int _track;
|
private int _track;
|
||||||
|
|
||||||
private PlayState _playState;
|
private PlayState _playState;
|
||||||
|
@ -75,6 +77,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
|
||||||
_voices = CreateArray<VoiceContext>(Params.VoiceCount);
|
_voices = CreateArray<VoiceContext>(Params.VoiceCount);
|
||||||
|
|
||||||
|
_effects = CreateArray<EffectContext>(Params.EffectCount);
|
||||||
|
|
||||||
InitializeAudioOut();
|
InitializeAudioOut();
|
||||||
|
|
||||||
_playState = PlayState.Stopped;
|
_playState = PlayState.Stopped;
|
||||||
|
@ -210,6 +214,18 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
voiceCtx.PlayState = voice.PlayState;
|
voiceCtx.PlayState = voice.PlayState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EffectIn[] effectsIn = reader.Read<EffectIn>(inputHeader.EffectSize);
|
||||||
|
|
||||||
|
for (int index = 0; index < effectsIn.Length; index++)
|
||||||
|
{
|
||||||
|
EffectIn effect = effectsIn[index];
|
||||||
|
|
||||||
|
if (effect.FirstUpdate != 0)
|
||||||
|
{
|
||||||
|
_effects[index].OutStatus.State = EffectState.New;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateAudio();
|
UpdateAudio();
|
||||||
|
|
||||||
UpdateDataHeader outputHeader = new UpdateDataHeader();
|
UpdateDataHeader outputHeader = new UpdateDataHeader();
|
||||||
|
@ -243,6 +259,11 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
writer.Write(voice.OutStatus);
|
writer.Write(voice.OutStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (EffectContext effect in _effects)
|
||||||
|
{
|
||||||
|
writer.Write(effect.OutStatus);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue