ryujinx/Ryujinx.HLE/HOS/Services/Audio/AudioRendererManager/PerformanceManager.cs
Ac_K f17b772c56 audren: Fix AudioRenderer implementation (#773)
* Fix AudioRenderer implementation

According to RE:
- `GetAudioRendererWorkBufferSize` is updated and improved to support `REV7`
- `RequestUpdateAudioRenderer` is updated to `REV7` too

Should improve results on recent game and close #718 and #707

* Fix NodeStates.GetWorkBufferSize

* Use BitUtils instead of IntUtils

* Nits
2019-09-20 01:49:05 +02:00

30 lines
1.1 KiB
C#

using Ryujinx.Common.Logging;
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
{
static class PerformanceManager
{
public static long GetRequiredBufferSizeForPerformanceMetricsPerFrame(BehaviorInfo behaviorInfo, AudioRendererParameter parameters)
{
int performanceMetricsDataFormat = behaviorInfo.GetPerformanceMetricsDataFormat();
if (performanceMetricsDataFormat == 2)
{
return 24 * (parameters.VoiceCount +
parameters.EffectCount +
parameters.SubMixCount +
parameters.SinkCount + 1) + 0x990;
}
if (performanceMetricsDataFormat != 1)
{
Logger.PrintWarning(LogClass.ServiceAudio, $"PerformanceMetricsDataFormat: {performanceMetricsDataFormat} is not supported!");
}
return (((parameters.VoiceCount +
parameters.EffectCount +
parameters.SubMixCount +
parameters.SinkCount + 1) << 32) >> 0x1C) + 0x658;
}
}
}