protected override void OnBufferInitializing() { Mp3Stream stream = Stream as Mp3Stream; if (stream == null) { throw new ApplicationException("The stream used by the StreamedMp3Sound class should be of type Mp3Stream."); } if (stream.Frequency < 0) { if (stream.DecodeFrames(1) == 0) { // throw new Exception("Could not decode"); } } if (stream.Frequency > 0 && stream.ChannelCount > 0) { this.WaveFormat = SoundUtil.CreateWaveFormat(stream.Frequency, 16, stream.ChannelCount); } }
public StreamedMp3Sound(Device device, Mp3Stream mp3SourceStream) : base(device, mp3SourceStream, SoundUtil.CreateWaveFormat(22050, 16, 2)) { }