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

Vag() public method

public Vag ( byte DataPointer, int DataLength ) : System
DataPointer byte
DataLength int
return System
        public Vag(byte* DataPointer, int DataLength)
        {
            //this.Data = Data;
            var Header = *(Header*)DataPointer;
            if (Header.Magic != 0)
            {
                Console.Error.WriteLine("Error VAG Magic: {0:X}", Header.Magic);
                throw (new NotImplementedException("Invalid VAG header"));
            }
            //var Hash = CSPspEmu.Core.Hashing.FastHash(DataPointer, DataLength);
            //Console.WriteLine("Header.SampleRate: {0}", Header.SampleRate);
            //Console.ReadKey();

            /*
            switch (Header.magic) {
                case "VAG":
                    blocks = cast(Block[])Data[0x30..$];
                break;
                case "\0\0\0":
                    blocks = cast(Block[])Data[0x10..$];
                break;
                default: throw(new Exception("Not a valid VAG File."));
            }
            */

            //ArrayUtils.HexDump(PointerUtils.PointerToByteArray(DataPointer, DataLength), 0xA0);

            SamplesCount = (DataLength - 0x10) * 56 / 16;
            SamplesDecoder = new Decoder((Block*)&DataPointer[0x10], (DataLength - 0x10) / 16);
            //SamplesDecoder = Decoder.DecodeBlocksStream(Blocks).GetEnumerator();

            //SaveToWav("output.wav");
        }