aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion4.cs
blob: 25bc67cd9377659dcfb0c51e0d785e7f7d02d3d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Ryujinx.Audio.Renderer.Dsp.Command;
using System.Diagnostics;

namespace Ryujinx.Audio.Renderer.Server
{
    /// <summary>
    /// <see cref="ICommandProcessingTimeEstimator"/> version 4. (added with REV10)
    /// </summary>
    public class CommandProcessingTimeEstimatorVersion4 : CommandProcessingTimeEstimatorVersion3
    {
        public CommandProcessingTimeEstimatorVersion4(uint sampleCount, uint bufferCount) : base(sampleCount, bufferCount) { }

        public override uint Estimate(GroupedBiquadFilterCommand command)
        {
            Debug.Assert(SampleCount == 160 || SampleCount == 240);

            if (SampleCount == 160)
            {
                return (uint)7424.5f;
            }

            return (uint)9730.4f;
        }

        public override uint Estimate(CaptureBufferCommand command)
        {
            Debug.Assert(SampleCount == 160 || SampleCount == 240);

            if (SampleCount == 160)
            {
                if (command.Enabled)
                {
                    return (uint)435.2f;
                }

                return (uint)4261.0f;
            }

            if (command.Enabled)
            {
                return (uint)5858.26f;
            }

            return (uint)435.2f;
        }
    }
}