diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2018-12-04 14:23:37 -0600 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-12-04 18:23:37 -0200 |
| commit | 85dbb9559ad317a657dafd24da27fec4b3f5250f (patch) | |
| tree | ecd92931bc2146e549484d9a3af308469089ad4e /Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs | |
| parent | c86aacde76b5f8e503e2b412385c8491ecc86b3b (diff) | |
Adjust naming conventions and general refactoring in HLE Project (#490)
* 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
* Remove unneeded property setters
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs | 68 |
1 files changed, 34 insertions, 34 deletions
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<int, ServiceProcessRequest> m_Commands; + private Dictionary<int, ServiceProcessRequest> _commands; - public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands; + public override IReadOnlyDictionary<int, ServiceProcessRequest> 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<int, ServiceProcessRequest>() + _commands = new Dictionary<int, ServiceProcessRequest> { { 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; } |
