In this section of Read:
if (samplesRead < count)
{
Array.Clear(buffer, offset + samplesRead, count - samplesRead);
samplesRead = count;
}
buffer is being Cleared as a byte[] at runtime, but the next 2 parameters are sample based (ie off by factor of 4).
Read parameter signature is a float[] so this does confuse me a bit. i worked around by ()*4 the 2nd 2 params.
Comments: good spot, the WaveBuffer hack confuses Array.Clear, so it isn't really safe to use in this fuction. I'll replace it with a for loop setting the values to 0.
if (samplesRead < count)
{
Array.Clear(buffer, offset + samplesRead, count - samplesRead);
samplesRead = count;
}
buffer is being Cleared as a byte[] at runtime, but the next 2 parameters are sample based (ie off by factor of 4).
Read parameter signature is a float[] so this does confuse me a bit. i worked around by ()*4 the 2nd 2 params.
Comments: good spot, the WaveBuffer hack confuses Array.Clear, so it isn't really safe to use in this fuction. I'll replace it with a for loop setting the values to 0.