Compliant with review. (2)

This commit is contained in:
Starlet 2018-06-15 09:19:29 -04:00
parent 199ceeb01a
commit 4cc4e4cce6
3 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,6 @@
namespace Ryujinx.Audio.ADPCM namespace Ryujinx.Audio.ADPCM
{ {
struct Info struct ADPCMInfo
{ {
public short History1; public short History1;
public short History2; public short History2;

View file

@ -13,13 +13,13 @@ namespace Ryujinx.Audio.ADPCM
Helper = new AudioHelper(); 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[] PCM = new short[Samples];
short Hist1 = ADPCMInfo.History1; short Hist1 = Info.History1;
short Hist2 = ADPCMInfo.History2; short Hist2 = Info.History2;
short[] Coefficients = ADPCMInfo.Coefficients; short[] Coefficients = Info.Coefficients;
int FrameCount = Helper.DivideByRoundUp(Samples, SamplesPerFrame); int FrameCount = Helper.DivideByRoundUp(Samples, SamplesPerFrame);
int SamplesRemaining = Samples; int SamplesRemaining = Samples;
@ -33,8 +33,8 @@ namespace Ryujinx.Audio.ADPCM
int Scale = (1 << Helper.GetLowNibble(PredictorScale)) * 2048; int Scale = (1 << Helper.GetLowNibble(PredictorScale)) * 2048;
int Predictor = Helper.GetHighNibble(PredictorScale); int Predictor = Helper.GetHighNibble(PredictorScale);
short Coef1 = ADPCMInfo.Coefficients[Predictor * 2]; short Coef1 = Info.Coefficients[Predictor * 2];
short Coef2 = ADPCMInfo.Coefficients[Predictor * 2 + 1]; short Coef2 = Info.Coefficients[Predictor * 2 + 1];
int SamplesToRead = Math.Min(SamplesPerFrame, SamplesRemaining); int SamplesToRead = Math.Min(SamplesPerFrame, SamplesRemaining);

View file

@ -25,7 +25,7 @@ namespace Ryujinx.Audio
public int DivideByRoundUp(int Value, int Divisor) public int DivideByRoundUp(int Value, int Divisor)
{ {
return (int)Math.Ceiling((double)Value / Divisor); return (Value + (Divisor - 1)) / Divisor;
} }
} }
} }