DWORD CALLBACK stream(HSTREAM handle, char *buffer, int length, DWORD user) { int c; // check how much recorded data is buffered c=BASS_ChannelGetData(rchan,0,BASS_DATA_AVAILABLE); c-=length; if (c>2*chunk+1764) { // buffer has gotten pretty large so remove some c-=chunk; // leave a single 'chunk' BASS_ChannelGetData(rchan,0,c); // remove it } // fetch recorded data into stream c=BASS_ChannelGetData(rchan,buffer,length); if (c