public void DecodeWave(BinaryReaderEx reader) { byte[] oggData = new byte[this.WaveHeader.DataLength]; reader.Read(oggData, 0, this.WaveHeader.DataLength); oggDataStream = new System.IO.MemoryStream(oggData, false); vorbisFile = new csvorbis.VorbisFile(oggDataStream, null, 0); csvorbis.Info vorbisInfo = vorbisFile.getInfo(0); this.WaveFormat = new SlimDX.Multimedia.WaveFormat(); this.WaveFormat.FormatTag = SlimDX.Multimedia.WaveFormatTag.Pcm; this.WaveFormat.Channels = (short)vorbisInfo.channels; this.WaveFormat.BitsPerSample = 16; this.WaveFormat.SamplesPerSecond = vorbisInfo.rate; this.WaveFormat.BlockAlignment = (short)(this.WaveFormat.Channels * 2); // 16 bits * number of channels this.WaveFormat.AverageBytesPerSecond = this.WaveFormat.SamplesPerSecond * this.WaveFormat.BlockAlignment; this.NumChannels = this.WaveFormat.Channels; this.SamplingRate = vorbisInfo.rate; this.NumStreams = vorbisFile.streams(); this.TimeTotal = vorbisFile.time_total(0); this.PcmSamples = vorbisFile.pcm_total(0); this.BitRate = vorbisFile.bitrate(0); this.StreamLength = (int)(this.PcmSamples * this.WaveFormat.BlockAlignment); // numSamples * numChannels * bytes per sample }