From 4cc4e4cce6e91699f3977d87fa7e240e8289d0d5 Mon Sep 17 00:00:00 2001 From: Starlet Date: Fri, 15 Jun 2018 09:19:29 -0400 Subject: [PATCH] Compliant with review. (2) --- Ryujinx.Audio/ADPCM/{Info.cs => ADPCMInfo.cs} | 2 +- Ryujinx.Audio/ADPCM/Decoder.cs | 12 ++++++------ Ryujinx.Audio/AudioHelper.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) rename Ryujinx.Audio/ADPCM/{Info.cs => ADPCMInfo.cs} (87%) diff --git a/Ryujinx.Audio/ADPCM/Info.cs b/Ryujinx.Audio/ADPCM/ADPCMInfo.cs similarity index 87% rename from Ryujinx.Audio/ADPCM/Info.cs rename to Ryujinx.Audio/ADPCM/ADPCMInfo.cs index bfd19d21b..63ef3cfa1 100644 --- a/Ryujinx.Audio/ADPCM/Info.cs +++ b/Ryujinx.Audio/ADPCM/ADPCMInfo.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Audio.ADPCM { - struct Info + struct ADPCMInfo { public short History1; public short History2; diff --git a/Ryujinx.Audio/ADPCM/Decoder.cs b/Ryujinx.Audio/ADPCM/Decoder.cs index d8a7a38b6..cd6f4b5de 100644 --- a/Ryujinx.Audio/ADPCM/Decoder.cs +++ b/Ryujinx.Audio/ADPCM/Decoder.cs @@ -13,13 +13,13 @@ namespace Ryujinx.Audio.ADPCM Helper = new AudioHelper(); } - public short[] Decode(byte[] ADPCM, Info ADPCMInfo, int Samples) + public short[] Decode(byte[] ADPCM, ADPCMInfo Info, int Samples) { short[] PCM = new short[Samples]; - short Hist1 = ADPCMInfo.History1; - short Hist2 = ADPCMInfo.History2; - short[] Coefficients = ADPCMInfo.Coefficients; + short Hist1 = Info.History1; + short Hist2 = Info.History2; + short[] Coefficients = Info.Coefficients; int FrameCount = Helper.DivideByRoundUp(Samples, SamplesPerFrame); int SamplesRemaining = Samples; @@ -33,8 +33,8 @@ namespace Ryujinx.Audio.ADPCM int Scale = (1 << Helper.GetLowNibble(PredictorScale)) * 2048; int Predictor = Helper.GetHighNibble(PredictorScale); - short Coef1 = ADPCMInfo.Coefficients[Predictor * 2]; - short Coef2 = ADPCMInfo.Coefficients[Predictor * 2 + 1]; + short Coef1 = Info.Coefficients[Predictor * 2]; + short Coef2 = Info.Coefficients[Predictor * 2 + 1]; int SamplesToRead = Math.Min(SamplesPerFrame, SamplesRemaining); diff --git a/Ryujinx.Audio/AudioHelper.cs b/Ryujinx.Audio/AudioHelper.cs index c995b66b1..ffca0838c 100644 --- a/Ryujinx.Audio/AudioHelper.cs +++ b/Ryujinx.Audio/AudioHelper.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Audio public int DivideByRoundUp(int Value, int Divisor) { - return (int)Math.Ceiling((double)Value / Divisor); + return (Value + (Divisor - 1)) / Divisor; } } }