From fb1d9493a3d43f2b86c551682586905a1f0e9ea7 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 6 Dec 2018 05:16:24 -0600 Subject: Adjust naming conventions and general refactoring in HLE Project (#527) * Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Apply previous refactorings to the merged code --- .../HOS/Services/Aud/IHardwareOpusDecoder.cs | 68 +++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs') diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs index a71b8602..fc0bd8db 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs @@ -10,80 +10,80 @@ namespace Ryujinx.HLE.HOS.Services.Aud { private const int FixedSampleRate = 48000; - private Dictionary m_Commands; + private Dictionary _commands; - public override IReadOnlyDictionary Commands => m_Commands; + public override IReadOnlyDictionary Commands => _commands; - private int SampleRate; - private int ChannelsCount; + private int _sampleRate; + private int _channelsCount; - private OpusDecoder Decoder; + private OpusDecoder _decoder; - public IHardwareOpusDecoder(int SampleRate, int ChannelsCount) + public IHardwareOpusDecoder(int sampleRate, int channelsCount) { - m_Commands = new Dictionary() + _commands = new Dictionary { { 0, DecodeInterleaved }, { 4, DecodeInterleavedWithPerf } }; - this.SampleRate = SampleRate; - this.ChannelsCount = ChannelsCount; + _sampleRate = sampleRate; + _channelsCount = channelsCount; - Decoder = new OpusDecoder(FixedSampleRate, ChannelsCount); + _decoder = new OpusDecoder(FixedSampleRate, channelsCount); } - public long DecodeInterleavedWithPerf(ServiceCtx Context) + public long DecodeInterleavedWithPerf(ServiceCtx context) { - long Result = DecodeInterleaved(Context); + long result = DecodeInterleaved(context); //TODO: Figure out what this value is. //According to switchbrew, it is now used. - Context.ResponseData.Write(0L); + context.ResponseData.Write(0L); - return Result; + return result; } - public long DecodeInterleaved(ServiceCtx Context) + public long DecodeInterleaved(ServiceCtx context) { - long InPosition = Context.Request.SendBuff[0].Position; - long InSize = Context.Request.SendBuff[0].Size; + long inPosition = context.Request.SendBuff[0].Position; + long inSize = context.Request.SendBuff[0].Size; - if (InSize < 8) + if (inSize < 8) { return MakeError(ErrorModule.Audio, AudErr.OpusInvalidInput); } - long OutPosition = Context.Request.ReceiveBuff[0].Position; - long OutSize = Context.Request.ReceiveBuff[0].Size; + long outPosition = context.Request.ReceiveBuff[0].Position; + long outSize = context.Request.ReceiveBuff[0].Size; - byte[] OpusData = Context.Memory.ReadBytes(InPosition, InSize); + byte[] opusData = context.Memory.ReadBytes(inPosition, inSize); - int Processed = ((OpusData[0] << 24) | - (OpusData[1] << 16) | - (OpusData[2] << 8) | - (OpusData[3] << 0)) + 8; + int processed = ((opusData[0] << 24) | + (opusData[1] << 16) | + (opusData[2] << 8) | + (opusData[3] << 0)) + 8; - if ((uint)Processed > (ulong)InSize) + if ((uint)processed > (ulong)inSize) { return MakeError(ErrorModule.Audio, AudErr.OpusInvalidInput); } - short[] Pcm = new short[OutSize / 2]; + short[] pcm = new short[outSize / 2]; - int FrameSize = Pcm.Length / (ChannelsCount * 2); + int frameSize = pcm.Length / (_channelsCount * 2); - int Samples = Decoder.Decode(OpusData, 0, OpusData.Length, Pcm, 0, FrameSize); + int samples = _decoder.Decode(opusData, 0, opusData.Length, pcm, 0, frameSize); - foreach (short Sample in Pcm) + foreach (short sample in pcm) { - Context.Memory.WriteInt16(OutPosition, Sample); + context.Memory.WriteInt16(outPosition, sample); - OutPosition += 2; + outPosition += 2; } - Context.ResponseData.Write(Processed); - Context.ResponseData.Write(Samples); + context.ResponseData.Write(processed); + context.ResponseData.Write(samples); return 0; } -- cgit v1.2.3