Пример #1
0
        public static WaveChunk ReadChunk(BinaryReader rdr, bool bigEndian)
        {
            WaveChunk chunk = null;
            string    id    = new string(rdr.ReadChars(4));

            if (id.Length > 0)
            {
                int chunkSize = rdr.ReadInt32();
                if (bigEndian)
                {
                    chunkSize = System.Net.IPAddress.NetworkToHostOrder(chunkSize);
                }

                switch (id)
                {
                case "fmt ":
                    chunk = new WaveFmtChunk(chunkSize);
                    break;

                default:
                    chunk = new WaveChunk(id, chunkSize);
                    break;
                }
            }
            return(chunk);
        }
Пример #2
0
        public static WaveChunk ReadChunk(BinaryReader rdr, bool bigEndian)
        {
            WaveChunk chunk = null;
            string id = new string(rdr.ReadChars(4));
            if (id.Length > 0)
            {
                int chunkSize = rdr.ReadInt32();
                if (bigEndian)
                    chunkSize = System.Net.IPAddress.NetworkToHostOrder(chunkSize);

                switch (id)
                {
                    case "fmt ":
                        chunk = new WaveFmtChunk(chunkSize);
                        break;
                    default:
                        chunk = new WaveChunk(id, chunkSize);
                        break;
                }
            }
            return chunk;
        }