Tanu Kaskinen wrote on 19.06.2011 12:18: >> I tried using pa_stream_begin_write, but it always returns a nullpointer >> there... > > It shouldn't return a null pointer. Check the error code. Nevermind, I made the mistake to set nbytes to 0 instead of (size_t)-1. pa_stream_begin_write works fine now. Anyway, no matter what I choose for the offset, I still get always underruns and bad latencies when rewriting buffers like this: int tmpOff = 10000; // also tried: 0, 100, -100, -10000 int16_t *tmpBuf = 0; size_t n = (size_t) -1; pa_stream_begin_write(cs->pa_Strm, (void **)&tmpBuf, &n); writeToneToBuffer(tmpBuf, n/4, cs); pa_stream_write(cs->pa_Strm, tmpBuf, 4*(n/4), 0, tmpOff, PA_SEEK_RELATIVE_ON_READ ); I've uploaded the latest version: http://www2.informatik.hu-berlin.de/~endemann/PulseStress_0.2.tar.bz2 Zeno