Misc audio fixes (#1348)
Changes: Implement software surround downmixing (fix #796). Fix a crash when no audio renderer were created when stopping emulation. NOTE: This PR also disable support of 5.1 surround on the OpenAL backend as we cannot detect if the hardware directly support it. (the downmixing applied by OpenAL on Windows is terribly slow)
This commit is contained in:
@ -4,7 +4,34 @@ namespace Ryujinx.Audio
|
||||
{
|
||||
public interface IAalOutput : IDisposable
|
||||
{
|
||||
int OpenTrack(int sampleRate, int channels, ReleaseCallback callback);
|
||||
bool SupportsChannelCount(int channels);
|
||||
|
||||
private int SelectHardwareChannelCount(int targetChannelCount)
|
||||
{
|
||||
if (SupportsChannelCount(targetChannelCount))
|
||||
{
|
||||
return targetChannelCount;
|
||||
}
|
||||
|
||||
switch (targetChannelCount)
|
||||
{
|
||||
case 6:
|
||||
return SelectHardwareChannelCount(2);
|
||||
case 2:
|
||||
return SelectHardwareChannelCount(1);
|
||||
case 1:
|
||||
throw new ArgumentException("No valid channel configuration found!");
|
||||
default:
|
||||
throw new ArgumentException($"Invalid targetChannelCount {targetChannelCount}");
|
||||
}
|
||||
}
|
||||
|
||||
int OpenTrack(int sampleRate, int channels, ReleaseCallback callback)
|
||||
{
|
||||
return OpenHardwareTrack(sampleRate, SelectHardwareChannelCount(channels), channels, callback);
|
||||
}
|
||||
|
||||
int OpenHardwareTrack(int sampleRate, int hardwareChannels, int virtualChannels, ReleaseCallback callback);
|
||||
|
||||
void CloseTrack(int trackId);
|
||||
|
||||
@ -12,7 +39,7 @@ namespace Ryujinx.Audio
|
||||
|
||||
long[] GetReleasedBuffers(int trackId, int maxCount);
|
||||
|
||||
void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct;
|
||||
void AppendBuffer<T>(int trackId, long bufferTag, T[] buffer) where T : struct;
|
||||
|
||||
void Start(int trackId);
|
||||
|
||||
|
Reference in New Issue
Block a user