Exemplo n.º 1
0
 public override void Write(SoundInput source, Stream output)
 {
     using (var buffer = new BinaryWriter(output, Encoding.ASCII, true))
     {
         uint total_size = (uint)(0x2e - 8 + source.PcmSize);
         buffer.Write(Signature);
         buffer.Write(total_size);
         buffer.Write(0x45564157);  // 'WAVE'
         buffer.Write(0x20746d66);  // 'fmt '
         buffer.Write(0x12);
         buffer.Write(source.Format.FormatTag);
         buffer.Write(source.Format.Channels);
         buffer.Write(source.Format.SamplesPerSecond);
         buffer.Write(source.Format.AverageBytesPerSecond);
         buffer.Write(source.Format.BlockAlign);
         buffer.Write(source.Format.BitsPerSample);
         buffer.Write((ushort)0);
         buffer.Write(0x61746164);  // 'data'
         buffer.Write((uint)source.PcmSize);
         source.Position = 0;
         source.CopyTo(output);
     }
 }
Exemplo n.º 2
0
 public override void Write(SoundInput source, Stream output)
 {
     WriteRiffHeader(output, source.Format, (uint)source.PcmSize);
     source.Position = 0;
     source.CopyTo(output);
 }