title: How to play back a array of samples after reading them from an 'ISampleSource'
body: <p>So, I have a piece of code that reads out an <code>ISampleSource</code> in to a <code>float[][]</code>, the first array layer being for the number of channels and the second being for the sample data within the channel. I am going to take this data and attempt to apply signal processing to it, however for debugging purposes I might want to manipulate the sample array and then play it back so that I can "hear" what the code is doing. is there an easy way to take the data returned by <code>ISampleSource.Read</code> and stick it back in to a <em>new</em> <code>ISampleSource</code> so it can then be converted to an <code>IWaveSource</code> and played using <code>WasapiOut</code>?</p>
  
  <p>Here is the class I tried to make so far, you pass it the <code>float[][]</code> and basically all the data in a <code>WaveFormat</code> for it to make one from.. but it doesn't actually do <em>anything</em>. doesn't error, doesn't play.. just does nothing. What am I doing wrong?</p>
  
  <pre><code>private class SampleSource : ISampleSource
  {
      public long Position { get; set; }
      public WaveFormat WaveFormat { get; private set; }
      public bool CanSeek =&gt; true;
      public long Length  =&gt; _data.Length;
  
      private float[] _data;
      private long readPoint = 0;
  
      public SampleSource(float[][] samples, int sampleRate, int bits, int channels)
      {
          WaveFormat = new WaveFormat(sampleRate, bits, channels);
          if (samples.Length &lt;= 0) return;
  
          _data = new float[samples[0].Length * samples.Length];
          int cchannels = samples.Length;
          int sampleLength = samples[0].Length;
  
          for (var i = 0; i &lt; sampleLength; i += cchannels)
              for (var n = 0; n &lt; cchannels; n++)
                  _data[i + n] = samples[n][i / cchannels];
      }
  
      public int Read(float[] buffer, int offset, int count)
      {
          if (_data.Length &lt; Position + count)
              count = (int) (_data.Length - Position);
  
          float[] outFloats = new float[count];
          for (var i = 0; i &lt; count; i++)
              outFloats[i] = _data[i + Position + offset];
  
          buffer = outFloats;
          Position += count;
          return count;
      }
  
      public void Dispose() =&gt;_data = null;
  }
  </code></pre>