I just found out that the problem of multiple calls of TRIGGER_START/TRIGGER_STOP might be caused by using ossplay (oss emulation layer) for testing. If I use aplay, TRIGGER_START gets called once but then Alsa goes in a loop continuously calling pcm_pointer(). Return values of pcm_pointer() look like the following: ---snip--- pcm_pointer returns 0 pcm_pointer returns 1024 pcm_pointer returns 2048 pcm_pointer returns 3072 pcm_pointer returns 4096 pcm_pointer returns 5120 pcm_pointer returns 6144 pcm_pointer returns 7168 pcm_pointer returns 0 pcm_pointer returns 1024 pcm_pointer returns 2048 pcm_pointer returns 3072 pcm_pointer returns 4096 pcm_pointer returns 5120 pcm_pointer returns 6144 pcm_pointer returns 7168 ---snap--- Finally I get a message saying: ---snip--- ALSA sound/core/pcm_native.c:1525: playback drain error (DMA or IRQ trouble?) ---snap--- Hope this helps. Regards, Markus Franke Markus Franke wrote: > Hi, > > Trent Piepho wrote: >> You need to make sure the buffer size is an integer multiple of the period >> size if you wrap like this. > > Yeah I have to take care of this but right now my buffersize is 32768 > bytes and the period size is 4096 bytes which should work I think. > >> I found that ALSA would call TRIGGER_STOP if it detected an overrun. > > Yeah that's right. I guess this is my case because xrun() is getting > called somewhere. So how can I fix this underrun problem? > >> Check the value returned for every call of your pointer callback. I found out >> that ALSA was calling the pointer callback before the first IRQ, which was >> something I hadn't planned on and the values confused ALSA. > > That's not my case. pcm_pointer gets called after the first DMA > transaction is finished. (DMA transfer finished callback gets called > before pcm_pointer) Also the values which are returned by pcm_pointer > look quite reasonable. (see also my very first posting in this thread, > look for the printk's "pcm_pointer returns <value>") > > > Thanks for your effort, > > Markus Franke > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@xxxxxxxxxxxxxxxx > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel