Beispiel #1
0
        private static void _WriteHeader(
            System.IO.BinaryWriter writer,
            CompressionCode compression,
            int sampleBytes,
            int sampleRate,
            int channels,
            int datasize)
        {
            // http://soundfile.sapp.org/doc/WaveFormat/
            writer.Write((int)ChunkID.RIFF);
            writer.Write(36 + datasize);
            writer.Write((int)ChunkID.WAVE);

            writer.Write((int)ChunkID.fmt);
            writer.Write(16);
            writer.Write((ushort)compression);
            writer.Write((ushort)channels);
            writer.Write(sampleRate);
            writer.Write(sampleRate * channels * sampleBytes);
            writer.Write((short)(channels * sampleBytes));
            writer.Write((short)(sampleBytes * 8));

            writer.Write((int)ChunkID.data);
            writer.Write(datasize);

            // The invoking caller is charged with filling the rest of the
            // content with PCM data
        }
 public void setcompress(CompressionCode cc)
 {
     compress = cc;
 }