/// <summary> /// Initializes a new instance of the <see cref="DialogAudioOutputStream"/> class. /// </summary> /// <param name="format"> The audio format of the underlying data. </param> protected DialogAudioOutputStream(DialogAudio format) : this() { Contract.Requires(format != null); Contract.Requires(this.bufferStream.Position == 0); this.Format = format; var encoding = this.Format.Encoding; // For PCM streams, we will assume that there's no header information available and write what's needed // for playback. if (encoding.Subtype == "WAV" || encoding.Subtype == "PCM") { WaveHeader.WriteWaveFormatHeaderToStream(this.bufferStream, encoding, WaveHeaderLengthOption.UseMaximumLength); this.bufferStream.Seek(0, SeekOrigin.Begin); } }