diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-07-09 22:49:07 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-09 22:49:07 -0300 |
| commit | 791fe70810f0f0f417c74aaff5446551bed78fee (patch) | |
| tree | 61cf0e4d7d2bbac931989b6dcd5e3adbacb5e28d /Ryujinx.Audio/OpenAL/OpenALAudioOut.cs | |
| parent | 0a36bfbf921038e8eb7d4294ec8543903c933d90 (diff) | |
Allow sample rate of 0 on OpenAudioOut, fix 5.1 sound output (#240)
Diffstat (limited to 'Ryujinx.Audio/OpenAL/OpenALAudioOut.cs')
| -rw-r--r-- | Ryujinx.Audio/OpenAL/OpenALAudioOut.cs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs index f574b46f..2860dc2e 100644 --- a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs +++ b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs @@ -20,7 +20,7 @@ namespace Ryujinx.Audio.OpenAL public int SourceId { get; private set; } public int SampleRate { get; private set; } - + public ALFormat Format { get; private set; } private ReleaseCallback Callback; @@ -153,7 +153,7 @@ namespace Ryujinx.Audio.OpenAL ShouldCallReleaseCallback = true; } } - + private void SyncQueuedTags() { AL.GetSource(SourceId, ALGetSourcei.BuffersQueued, out int QueuedCount); @@ -249,11 +249,6 @@ namespace Ryujinx.Audio.OpenAL private ALFormat GetALFormat(int Channels, AudioFormat Format) { - if (Channels < 1 || Channels > 2) - { - throw new ArgumentOutOfRangeException(nameof(Channels)); - } - if (Channels == 1) { switch (Format) @@ -262,7 +257,7 @@ namespace Ryujinx.Audio.OpenAL case AudioFormat.PcmInt16: return ALFormat.Mono16; } } - else /* if (Channels == 2) */ + else if (Channels == 2) { switch (Format) { @@ -270,6 +265,18 @@ namespace Ryujinx.Audio.OpenAL 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)); } @@ -288,7 +295,7 @@ namespace Ryujinx.Audio.OpenAL { return Td.ContainsBuffer(Tag); } - + return false; } @@ -298,7 +305,7 @@ namespace Ryujinx.Audio.OpenAL { return Td.GetReleasedBuffers(MaxCount); } - + return null; } |
