Esempio n. 1
0
        protected override bool InitializeDecoding()
        {
            if (this.BaseStream.Length < 44)
            {
                throw new NotImplementedException();
            }

            this.header = new WAVBitstreamHeader();
            byte[] buffer = new byte[12];

            this.BaseStream.Read(buffer, 0, 12);
            char[] chunkID = new char[4] {
                (char)buffer[0x0], (char)buffer[0x1], (char)buffer[0x2], (char)buffer[0x3]
            };                                                                                             // big-endian ChunkID ("RIFF" in ASCII)
            int chunkSize = (int)(buffer[0x4] | buffer[0x5] << 8 | buffer[0x6] << 16 | buffer[0x7] << 24); // little-endian ChunkSize

            char[] format = new char[4] {
                (char)buffer[0x8], (char)buffer[0x9], (char)buffer[0xA], (char)buffer[0xB]
            };                                                                                                          // big-endian Format ("WAVE" in ASCII)

            this.BaseStream.Read(buffer, 12, 12);
            char[] subchunk1ID = new char[4] {
                (char)buffer[0x0], (char)buffer[0x1], (char)buffer[0x2], (char)buffer[0x3]
            };                                                                                                 // big-endian Subchunk1ID ("fmt " in ASCII)
            int subchunk1Size = (int)(buffer[0x4] | buffer[0x5] << 8 | buffer[0x6] << 16 | buffer[0x7] << 24); // little-endian Subchunk1Size

            this.BaseStream.Read(buffer, 24, 12);

            return(false);
        }
Esempio n. 2
0
        protected override bool InitializeDecoding()
        {
            if (this.BaseStream.Length < 44)
                throw new NotImplementedException();

            this.header = new WAVBitstreamHeader();
            byte[] buffer = new byte[12];

            this.BaseStream.Read(buffer, 0, 12);
            char[] chunkID = new char[4] { (char)buffer[0x0], (char)buffer[0x1], (char)buffer[0x2], (char)buffer[0x3] }; // big-endian ChunkID ("RIFF" in ASCII)
            int chunkSize = (int)(buffer[0x4] | buffer[0x5] << 8 | buffer[0x6] << 16 | buffer[0x7] << 24); // little-endian ChunkSize
            char[] format = new char[4] { (char)buffer[0x8], (char)buffer[0x9], (char)buffer[0xA], (char)buffer[0xB] }; // big-endian Format ("WAVE" in ASCII)

            this.BaseStream.Read(buffer, 12, 12);
            char[] subchunk1ID = new char[4] { (char)buffer[0x0], (char)buffer[0x1], (char)buffer[0x2], (char)buffer[0x3] }; // big-endian Subchunk1ID ("fmt " in ASCII)
            int subchunk1Size = (int)(buffer[0x4] | buffer[0x5] << 8 | buffer[0x6] << 16 | buffer[0x7] << 24); // little-endian Subchunk1Size

            this.BaseStream.Read(buffer, 24, 12);

            return false;
        }