Split audren/audout files into separate folders, some minor cleanup

This commit is contained in:
gdkchan 2018-07-12 20:25:29 -03:00
parent be4ac28aa0
commit a9fb9379fc
23 changed files with 34 additions and 75 deletions

View file

@ -1,13 +0,0 @@
namespace Ryujinx.Audio
{
public enum AudioFormat
{
Invalid = 0,
PcmInt8 = 1,
PcmInt16 = 2,
PcmImt24 = 3,
PcmImt32 = 4,
PcmFloat = 5,
Adpcm = 6
}
}

View file

@ -2,11 +2,7 @@ namespace Ryujinx.Audio
{
public interface IAalOutput
{
int OpenTrack(
int SampleRate,
int Channels,
ReleaseCallback Callback,
out AudioFormat Format);
int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback);
void CloseTrack(int Track);

View file

@ -227,15 +227,9 @@ namespace Ryujinx.Audio.OpenAL
while (KeepPolling);
}
public int OpenTrack(
int SampleRate,
int Channels,
ReleaseCallback Callback,
out AudioFormat Format)
public int OpenTrack(int SampleRate, int Channels, ReleaseCallback Callback)
{
Format = AudioFormat.PcmInt16;
Track Td = new Track(SampleRate, GetALFormat(Channels, Format), Callback);
Track Td = new Track(SampleRate, GetALFormat(Channels), Callback);
for (int Id = 0; Id < MaxTracks; Id++)
{
@ -248,38 +242,16 @@ namespace Ryujinx.Audio.OpenAL
return -1;
}
private ALFormat GetALFormat(int Channels, AudioFormat Format)
private ALFormat GetALFormat(int Channels)
{
if (Channels == 1)
switch (Channels)
{
switch (Format)
{
case AudioFormat.PcmInt8: return ALFormat.Mono8;
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));
case 1: return ALFormat.Mono16;
case 2: return ALFormat.Stereo16;
case 6: return ALFormat.Multi51Chn16Ext;
}
throw new ArgumentException(nameof(Format));
throw new ArgumentOutOfRangeException(nameof(Channels));
}
public void CloseTrack(int Track)

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
{
[StructLayout(LayoutKind.Sequential)]
struct AudioOutData

View file

@ -6,7 +6,7 @@ using Ryujinx.HLE.OsHle.Ipc;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioOut
{
class IAudioOut : IpcService, IDisposable
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
static class AudioConsts
{

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
struct BehaviorIn

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
struct BiquadFilter

View file

@ -9,7 +9,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
class IAudioRenderer : IpcService, IDisposable
{
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
Track = AudioOut.OpenTrack(
AudioConsts.HostSampleRate,
AudioConsts.HostChannelsCount,
AudioCallback, out _);
AudioCallback);
MemoryPools = CreateArray<MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4);

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
class MemoryPoolContext
{

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)]
struct MemoryPoolIn

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
struct MemoryPoolOut

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
enum MemoryPoolState : int
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
enum PlayState : byte
{

View file

@ -1,6 +1,6 @@
using System;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
static class Resampler
{

View file

@ -1,4 +1,4 @@
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
struct UpdateDataHeader
{

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
struct VoiceChannelResourceIn

View file

@ -2,7 +2,7 @@ using ChocolArm64.Memory;
using Ryujinx.Audio.Adpcm;
using System;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
class VoiceContext
{
@ -51,6 +51,8 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
private void Reset()
{
BufferReload = true;
BufferIndex = 0;
Offset = 0;

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
struct VoiceIn

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
struct VoiceOut

View file

@ -1,6 +1,6 @@
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Services.Aud
namespace Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer
{
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
struct WaveBuffer

View file

@ -3,6 +3,7 @@ using Ryujinx.Audio;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Handles;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.Services.Aud.AudioOut;
using System.Collections.Generic;
using System.Text;
@ -154,13 +155,13 @@ namespace Ryujinx.HLE.OsHle.Services.Aud
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));
Context.ResponseData.Write(SampleRate);
Context.ResponseData.Write(Channels);
Context.ResponseData.Write((int)Format);
Context.ResponseData.Write((int)SampleFormat.PcmInt16);
Context.ResponseData.Write((int)PlaybackState.Stopped);
return 0;

View file

@ -1,6 +1,7 @@
using Ryujinx.Audio;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.OsHle.Ipc;
using Ryujinx.HLE.OsHle.Services.Aud.AudioRenderer;
using System.Collections.Generic;
namespace Ryujinx.HLE.OsHle.Services.Aud