Hi markheath
I've modified the code. Buy i dont understand how to stop Read function. It's continuing calling and the sound is keep playing. What should i do?
publicoverrideint Read(byte[] buffer, int offset, int count) {int samples = count / 2;for (int i = 0; i < samples && time < (44100 * 3); i++) {double sine = amplitude * Math.Sin(Math.PI * 2 * frequency * time); time += 1.0 / 44100;short truncated = (short)Math.Round(sine * (Math.Pow(2,15) - 1)); buffer[i * 2] = (byte)(truncated & 0x00ff); buffer[i * 2 + 1] = (byte)((truncated & 0xff00) >> 8); }return count; }
slinger