Beispiel #1
0
 // Token: 0x060002F9 RID: 761 RVA: 0x0000B4DC File Offset: 0x000096DC
 public void ToFile(string fileName, WaveWriteOptions options)
 {
     using (FileStream fileStream = File.Create(fileName))
     {
         this.ToStream(fileStream, options);
     }
 }
Beispiel #2
0
 // Token: 0x060002FA RID: 762 RVA: 0x0000B514 File Offset: 0x00009714
 public void ToStream(Stream stream, WaveWriteOptions options)
 {
     if (stream == null)
     {
         throw new ArgumentNullException("stream");
     }
     if (!stream.CanWrite)
     {
         throw new ArgumentNullException("Given Stream cannot write.");
     }
     using (ABinaryWriter abinaryWriter = new ABinaryWriter(stream))
     {
         if (!options.HasFlag(WaveWriteOptions.NoHeader))
         {
             abinaryWriter.WriteString("RIFF");
             abinaryWriter.Write32(this.WrittenSize);
             abinaryWriter.WriteString("WAVE");
             abinaryWriter.WritePadding(4, 0);
         }
         abinaryWriter.WriteString("fmt ");
         abinaryWriter.Write32((this.format == WaveFormat.PCM) ? 16U : 20U);
         abinaryWriter.Write16((ushort)this.format);
         abinaryWriter.Write16(this.channelCount);
         abinaryWriter.Write32(this.sampleRate);
         abinaryWriter.Write32(this.ByteRate);
         abinaryWriter.Write32((uint)this.BlockAlign);
         abinaryWriter.Write32((uint)this.bitsPerSample);
         if (this.format != WaveFormat.PCM)
         {
             abinaryWriter.Write32(0U);
         }
         abinaryWriter.WritePadding(4, 0);
         abinaryWriter.WriteString("data");
         if (this.data == null)
         {
             abinaryWriter.Write32(0U);
         }
         else
         {
             abinaryWriter.WriteS32(this.data.Length);
             abinaryWriter.Write8s(this.data);
         }
         abinaryWriter.WritePadding(4, 0);
     }
 }