CommandProcessingTimeEstimatorVersion4.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Copyright (c) 2019-2021 Ryujinx
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. //
  17. using Ryujinx.Audio.Common;
  18. using Ryujinx.Audio.Renderer.Dsp.Command;
  19. using Ryujinx.Audio.Renderer.Parameter.Effect;
  20. using System;
  21. using System.Diagnostics;
  22. using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
  23. namespace Ryujinx.Audio.Renderer.Server
  24. {
  25. /// <summary>
  26. /// <see cref="ICommandProcessingTimeEstimator"/> version 4. (added with REV10)
  27. /// </summary>
  28. public class CommandProcessingTimeEstimatorVersion4 : CommandProcessingTimeEstimatorVersion3
  29. {
  30. public CommandProcessingTimeEstimatorVersion4(uint sampleCount, uint bufferCount) : base(sampleCount, bufferCount) { }
  31. public override uint Estimate(GroupedBiquadFilterCommand command)
  32. {
  33. Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
  34. if (_sampleCount == 160)
  35. {
  36. return (uint)7424.5f;
  37. }
  38. return (uint)9730.4f;
  39. }
  40. public override uint Estimate(CaptureBufferCommand command)
  41. {
  42. Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
  43. if (_sampleCount == 160)
  44. {
  45. if (command.Enabled)
  46. {
  47. return (uint)435.2f;
  48. }
  49. return (uint)4261.0f;
  50. }
  51. if (command.Enabled)
  52. {
  53. return (uint)5858.26f;
  54. }
  55. return (uint)435.2f;
  56. }
  57. }
  58. }