CSPspEmu.Hle.Formats.audio.Vag.Decoder.DecodeBlock C# (CSharp) Method

DecodeBlock() public method

public DecodeBlock ( Block Block ) : void
Block Block
return void
            public void DecodeBlock(Block Block)
            {
                int SampleOffset = 0;
                int ShiftFactor = (int)BitUtils.Extract(Block.Modificator, 0, 4);
                int PredictIndex = (int)BitUtils.Extract(Block.Modificator, 4, 4) % Vag.VAG_f.Length;
                //if (predict_nr > VAG_f.length) predict_nr = 0;

                // @TODO: maybe we can change << 12 >> shift_factor for "<< (12 - shift_factor)"
                // and move the substract outside the for.

                Predict1 = VAG_f[PredictIndex * 2 + 0];
                Predict2 = VAG_f[PredictIndex * 2 + 1];

                //History1 = 0;
                //History2 = 0;

                // Mono 4-bit/28 Samples per block.
                for (int n = 0; n < CompressedBytesInBlock; n++)
                {
                    var DataByte = Block.Data[n];

                    DecodedBlockSamples[SampleOffset++] = HandleSampleKeepHistory(((short)((((uint)DataByte >> 0) & 0xF) << 12)) >> ShiftFactor);
                    DecodedBlockSamples[SampleOffset++] = HandleSampleKeepHistory(((short)((((uint)DataByte >> 4) & 0xF) << 12)) >> ShiftFactor);
                }
            }