CSPspEmu.Hle.Modules.libatrac3plus.sceAtrac3plus._sceAtracDecodeData C# (CSharp) Method

_sceAtracDecodeData() private method

private _sceAtracDecodeData ( Atrac Atrac, StereoShortSoundSample SamplesOut, int &DecodedSamples, int &ReachedEnd, int &RemainingFramesToDecode ) : int
Atrac Atrac
SamplesOut CSPspEmu.Core.Audio.StereoShortSoundSample
DecodedSamples int
ReachedEnd int
RemainingFramesToDecode int
return int
        private int _sceAtracDecodeData(Atrac Atrac, StereoShortSoundSample* SamplesOut, out int DecodedSamples, out int ReachedEnd, out int RemainingFramesToDecode)
        {
            // Decode
            DecodedSamples = Atrac.Decode(SamplesOut);
            ReachedEnd = 0;
            RemainingFramesToDecode = Atrac.RemainingFrames;

            //Console.WriteLine("{0}/{1} -> {2} : {3}", Atrac.DecodingOffsetInSamples, Atrac.TotalSamples, DecodedSamples, Atrac.DecodingReachedEnd);

            if (Atrac.DecodingReachedEnd)
            {
                if (Atrac.NumberOfLoops == 0)
                {
                    DecodedSamples = 0;
                    ReachedEnd = 1;
                    RemainingFramesToDecode = 0;
                    Console.WriteLine("SceKernelErrors.ERROR_ATRAC_ALL_DATA_DECODED)");
                    throw (new SceKernelException(SceKernelErrors.ERROR_ATRAC_ALL_DATA_DECODED));
                }
                if (Atrac.NumberOfLoops > 0) Atrac.NumberOfLoops--;

                Atrac.DecodingOffset = (Atrac.LoopInfoList.Length > 0) ? Atrac.LoopInfoList[0].StartSample : 0;
            }

            //return Atrac.GetUidIndex(InjectContext);
            return 0;
        }