public void CanCreateResamplerStream()
 {
     //using (WaveFileReader reader = new WaveFileReader("C:\\Users\\Mark\\Recording\\REAPER\\ideas-2008-05-17.wav"))
     using (WaveStream reader = new NullWaveStream(new WaveFormat(44100,16,1),1000 ))
     {
         using (ResamplerDmoStream resampler = new ResamplerDmoStream(reader, WaveFormat.CreateIeeeFloatWaveFormat(48000,2)))
         {
             Assert.Greater(resampler.Length, reader.Length, "Length");
             Assert.AreEqual(0, reader.Position, "Position");
             Assert.AreEqual(0, resampler.Position, "Position");            
         }
     }
 }
 public void CanReadABlockFromResamplerStream()
 {
     //using (WaveFileReader reader = new WaveFileReader("C:\\Users\\Mark\\Recording\\REAPER\\ideas-2008-05-17.wav"))
     WaveFormat inputFormat = new WaveFormat(44100, 16, 1);
     using (WaveStream reader = new NullWaveStream(inputFormat, inputFormat.AverageBytesPerSecond * 20))
     {
         using (ResamplerDmoStream resampler = new ResamplerDmoStream(reader, WaveFormat.CreateIeeeFloatWaveFormat(48000, 2)))
         {
             // try to read 10 ms;
             int bytesToRead = resampler.WaveFormat.AverageBytesPerSecond / 100;
             byte[] buffer = new byte[bytesToRead];
             int count = resampler.Read(buffer, 0, bytesToRead);
             Assert.That(count > 0, "Bytes Read");
         }
     }
 }
 private void ResampleAWholeStream(WaveFormat inputFormat, WaveFormat outputFormat)
 {
     using (WaveStream reader = new NullWaveStream(inputFormat, inputFormat.AverageBytesPerSecond * 20))
     {
         using (ResamplerDmoStream resampler = new ResamplerDmoStream(reader, outputFormat))
         {
             // try to read 10 ms;
             int bytesToRead = resampler.WaveFormat.AverageBytesPerSecond / 100;
             byte[] buffer = new byte[bytesToRead];
             int count;
             int total = 0;
             do
             {
                 count = resampler.Read(buffer, 0, bytesToRead);
                 total += count;
                 //Assert.AreEqual(count, bytesToRead, "Bytes Read");
             } while (count > 0);
             //Debug.WriteLine(String.Format("Converted input length {0} to {1}", reader.Length, total));
         }
     }
 }
 private void CanCreateConversionStream(WaveFormat inputFormat, WaveFormat outputFormat)
 {
     WaveStream inputStream = new NullWaveStream(inputFormat, 10000);
     using (WaveFormatConversionStream stream = new WaveFormatConversionStream(
         outputFormat, inputStream))
     {
         byte[] buffer = new byte[stream.WaveFormat.AverageBytesPerSecond];
         int totalRead = 0;
         int bytesRead;
         do
         {
             bytesRead = stream.Read(buffer, 0, buffer.Length);
             totalRead += bytesRead;
         } while (bytesRead > 0);
         Debug.WriteLine(String.Format("Converted {0}", totalRead));
         Assert.AreEqual(inputStream.Length, inputStream.Position);
     }
 }