[alsa-devel] Alsa asynchonus playnback

Clemens Ladisch clemens at ladisch.de
Tue Nov 29 16:14:23 CET 2011

Martin schmidt wrote:
> my problem is, the sound has an Echo (in german Hall-Effekt).
> int write_to_audiostream(short*buf)
> {
>     memcpy(audiobuffer[audiobuffercounter],buf,audio_buffersize*sizeof(short));
>    int w=  snd_pcm_writei (pcm_handle, audiobuffer[audiobuffercounter], 2* audio_buffersize);

This looks correct (as long as the buffer is correctly filled).
Do you ever check w?

>    audiobuffercounter = ++audiobuffercounter % 10;

It is a bad idea to disable compiler warnings, or to not heed them.

> in a Timer-Event

Why a timer?  How is the timer synchronized to the sample clock?


More information about the Alsa-devel mailing list