Example #1
0
        /// <summary>
        /// Load a RIFF WAVE.
        /// </summary>
        /// <param name="b">The file.</param>
        public void Load(byte[] b)
        {
            //Reader.
            MemoryStream     src = new MemoryStream(b);
            BinaryDataReader br  = new BinaryDataReader(src);

            magic     = new string(br.ReadChars(4));
            chunkSize = br.ReadUInt32();
            format    = new string(br.ReadChars(4));

            //The chunks.
            fmt  = new FmtChunk();
            data = new DataChunk();

            fmt.Load(ref br);
            data.Load(ref br, fmt);

            while (br.Position <= (b.Length - 4))
            {
                string magic = new string(br.ReadChars(4));
                if (magic == "smpl")
                {
                    br.Position -= 4;
                    smpl         = new SmplChunk();
                    smpl.Load(ref br);
                }
            }
        }