Split audren/audout files into separate folders, some minor cleanup
This commit is contained in:
parent
be4ac28aa0
commit
a9fb9379fc
23 changed files with 34 additions and 75 deletions
|
@ -1,13 +0,0 @@
|
||||||
namespace Ryujinx.Audio
|
|
||||||
{
|
|
||||||
public enum AudioFormat
|
|
||||||
{
|
|
||||||
Invalid = 0,
|
|
||||||
PcmInt8 = 1,
|
|
||||||
PcmInt16 = 2,
|
|
||||||
PcmImt24 = 3,
|
|
||||||
PcmImt32 = 4,
|
|
||||||
PcmFloat = 5,
|
|
||||||
Adpcm = 6
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,11 +2,7 @@ namespace Ryujinx.Audio
|
||||||
{
|
{
|
||||||
public interface IAalOutput
|
public interface IAalOutput
|
||||||
{
|
{
|
||||||
int OpenTrack(
|
int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback);
|
||||||
int SampleRate,
|
|
||||||
int Channels,
|
|
||||||
ReleaseCallback Callback,
|
|
||||||
out AudioFormat Format);
|
|
||||||
|
|
||||||
void CloseTrack(int Track);
|
void CloseTrack(int Track);
|
||||||
|
|
||||||
|
|
|
@ -227,15 +227,9 @@ namespace Ryujinx.Audio.OpenAL
|
||||||
while (KeepPolling);
|
while (KeepPolling);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int OpenTrack(
|
public int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback)
|
||||||
int SampleRate,
|
|
||||||
int Channels,
|
|
||||||
ReleaseCallback Callback,
|
|
||||||
out AudioFormat Format)
|
|
||||||
{
|
{
|
||||||
Format = AudioFormat.PcmInt16;
|
Track Td = new Track(SampleRate, GetALFormat(Channels), Callback);
|
||||||
|
|
||||||
Track Td = new Track(SampleRate, GetALFormat(Channels, Format), Callback);
|
|
||||||
|
|
||||||
for (int Id = 0; Id < MaxTracks; Id++)
|
for (int Id = 0; Id < MaxTracks; Id++)
|
||||||
{
|
{
|
||||||
|
@ -248,38 +242,16 @@ namespace Ryujinx.Audio.OpenAL
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ALFormat GetALFormat(int Channels, AudioFormat Format)
|
private ALFormat GetALFormat(int Channels)
|
||||||
{
|
{
|
||||||
if (Channels == 1)
|
switch (Channels)
|
||||||
{
|
{
|
||||||
switch (Format)
|
case 1: return ALFormat.Mono16;
|
||||||
{
|
case 2: return ALFormat.Stereo16;
|
||||||
case AudioFormat.PcmInt8: return ALFormat.Mono8;
|
case 6: return ALFormat.Multi51Chn16Ext;
|
||||||
case AudioFormat.PcmInt16: return ALFormat.Mono16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Channels == 2)
|
|
||||||
{
|
|
||||||
switch (Format)
|
|
||||||
{
|
|
||||||
case AudioFormat.PcmInt8: return ALFormat.Stereo8;
|
|
||||||
case AudioFormat.PcmInt16: return ALFormat.Stereo16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Channels == 6)
|
|
||||||
{
|
|
||||||
switch (Format)
|
|
||||||
{
|
|
||||||
case AudioFormat.PcmInt8: return ALFormat.Multi51Chn8Ext;
|
|
||||||
case AudioFormat.PcmInt16: return ALFormat.Multi51Chn16Ext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(Channels));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException(nameof(Format));
|
throw new ArgumentOutOfRangeException(nameof(Channels));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseTrack(int Track)
|
public void CloseTrack(int Track)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct AudioOutData
|
struct AudioOutData
|
|
@ -6,7 +6,7 @@ using Ryujinx.HLE.OsHle.Ipc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
|
||||||
{
|
{
|
||||||
class IAudioOut : IpcService, IDisposable
|
class IAudioOut : IpcService, IDisposable
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
static class AudioConsts
|
static class AudioConsts
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct BehaviorIn
|
struct BehaviorIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
|
||||||
struct BiquadFilter
|
struct BiquadFilter
|
|
@ -9,7 +9,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
class IAudioRenderer : IpcService, IDisposable
|
class IAudioRenderer : IpcService, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
Track = AudioOut.OpenTrack(
|
Track = AudioOut.OpenTrack(
|
||||||
AudioConsts.HostSampleRate,
|
AudioConsts.HostSampleRate,
|
||||||
AudioConsts.HostChannelsCount,
|
AudioConsts.HostChannelsCount,
|
||||||
AudioCallback, out _);
|
AudioCallback);
|
||||||
|
|
||||||
MemoryPools = CreateArray<MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4);
|
MemoryPools = CreateArray<MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
class MemoryPoolContext
|
class MemoryPoolContext
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)]
|
||||||
struct MemoryPoolIn
|
struct MemoryPoolIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct MemoryPoolOut
|
struct MemoryPoolOut
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
enum MemoryPoolState : int
|
enum MemoryPoolState : int
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
enum PlayState : byte
|
enum PlayState : byte
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
static class Resampler
|
static class Resampler
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
struct UpdateDataHeader
|
struct UpdateDataHeader
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
|
||||||
struct VoiceChannelResourceIn
|
struct VoiceChannelResourceIn
|
|
@ -2,7 +2,7 @@ using ChocolArm64.Memory;
|
||||||
using Ryujinx.Audio.Adpcm;
|
using Ryujinx.Audio.Adpcm;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
class VoiceContext
|
class VoiceContext
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,8 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
|
||||||
private void Reset()
|
private void Reset()
|
||||||
{
|
{
|
||||||
|
BufferReload = true;
|
||||||
|
|
||||||
BufferIndex = 0;
|
BufferIndex = 0;
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
||||||
struct VoiceIn
|
struct VoiceIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct VoiceOut
|
struct VoiceOut
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
||||||
struct WaveBuffer
|
struct WaveBuffer
|
|
@ -3,6 +3,7 @@ using Ryujinx.Audio;
|
||||||
using Ryujinx.HLE.Logging;
|
using Ryujinx.HLE.Logging;
|
||||||
using Ryujinx.HLE.OsHle.Handles;
|
using Ryujinx.HLE.OsHle.Handles;
|
||||||
using Ryujinx.HLE.OsHle.Ipc;
|
using Ryujinx.HLE.OsHle.Ipc;
|
||||||
|
using Ryujinx.HLE.OsHle.Services.Aud.AudioOut;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
@ -154,13 +155,13 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
|
||||||
IAalOutput AudioOut = Context.Ns.AudioOut;
|
IAalOutput AudioOut = Context.Ns.AudioOut;
|
||||||
|
|
||||||
int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback, out AudioFormat Format);
|
int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback);
|
||||||
|
|
||||||
MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track));
|
MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track));
|
||||||
|
|
||||||
Context.ResponseData.Write(SampleRate);
|
Context.ResponseData.Write(SampleRate);
|
||||||
Context.ResponseData.Write(Channels);
|
Context.ResponseData.Write(Channels);
|
||||||
Context.ResponseData.Write((int)Format);
|
Context.ResponseData.Write((int)SampleFormat.PcmInt16);
|
||||||
Context.ResponseData.Write((int)PlaybackState.Stopped);
|
Context.ResponseData.Write((int)PlaybackState.Stopped);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Ryujinx.Audio;
|
using Ryujinx.Audio;
|
||||||
using Ryujinx.HLE.Logging;
|
using Ryujinx.HLE.Logging;
|
||||||
using Ryujinx.HLE.OsHle.Ipc;
|
using Ryujinx.HLE.OsHle.Ipc;
|
||||||
|
using Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.OsHle.Services.Aud
|
namespace Ryujinx.HLE.OsHle.Services.Aud
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue