public int Read(float[] fb, int offset, int count) { fork.sync(count, this); lock (locker) { //Console.WriteLine("{3} {0:000000} {1:000000} {2:000000}", buf.Length, iRead, iWrite, DateTime.UtcNow.ToLongTimeString()); count = Math.Min(Math.Min(count, fb.Length - offset), avail()); // apparently the incoming array is a BYTE array, not a F*****G FLOAT // thank you for invalidating my code naudio /*int len = buf.Length - iRead; * if (count >= len) * { * Array.Copy(buf, iRead, fb, offset, count); * offset += len; * count -= len; * Array.Copy(buf, 0, fb, offset, count); * iRead = count; * } * else * { * Array.Copy(buf, iRead, fb, offset, count); * iRead += count; * }*/ int ret = count; while (--count >= 0) { fb[offset++] = buf[iRead++]; if (iRead >= buf.Length) { iRead = 0; } } return(ret); } }
public int Read(float[] fb, int offset, int count) { fork.sync(count, this); lock (locker) { count = Math.Min(Math.Min(count, fb.Length - offset), avail()); int ret = count; while (--count >= 0) { fb[offset++] = buf[iRead++]; if (iRead >= buf.Length) { iRead = 0; } } if (dumper_r != null) { dumper_r.samples(fb, offset - ret, ret); } return(ret); } }