Update of /cvsroot/alsa/alsa-lib/src/pcm In directory sc8-pr-cvs1:/tmp/cvs-serv21759
Modified Files: pcm_direct.c pcm_dmix.c pcm_dshare.c pcm_dsnoop.c Log Message: Fixed poll() behaviour for direct plugins, also added snd_pcm_hwsync() call to start callback Index: pcm_direct.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_direct.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- pcm_direct.c 9 Jan 2004 18:32:05 -0000 1.11 +++ pcm_direct.c 21 Jan 2004 19:21:11 -0000 1.12 @@ -410,15 +410,23 @@ { snd_pcm_direct_t *dmix = pcm->private_data; unsigned short events; - static snd_timer_read_t rbuf[5]; /* can be overwriten by multiple plugins, we don't need the value */ + /* rbuf might be overwriten by multiple plugins */ + /* we don't need the value */ + static snd_timer_read_t rbuf[5]; assert(pfds && nfds == 1 && revents); events = pfds[0].revents; if (events & POLLIN) { - events |= POLLOUT; - events &= ~POLLIN; + int empty = 0; + if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { + events |= POLLOUT; + events &= ~POLLIN; + empty = snd_pcm_mmap_playback_avail(pcm) < pcm->avail_min; + } else { + empty = snd_pcm_mmap_capture_avail(pcm) < pcm->avail_min; + } /* empty the timer read queue */ - while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf)) ; + while (empty && snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf)) ; } *revents = events; return 0; Index: pcm_dmix.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_dmix.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- pcm_dmix.c 20 Jan 2004 15:29:39 -0000 1.47 +++ pcm_dmix.c 21 Jan 2004 19:21:11 -0000 1.48 @@ -407,7 +407,6 @@ } dmix->hw_ptr += diff; dmix->hw_ptr %= pcm->boundary; - // printf("sync ptr diff = %li\n", diff); if (pcm->stop_threshold >= pcm->boundary) /* don't care */ return 0; if ((avail = snd_pcm_mmap_playback_avail(pcm)) >= pcm->stop_threshold) { @@ -545,6 +544,7 @@ if (err < 0) return err; dmix->state = SND_PCM_STATE_RUNNING; + snd_pcm_hwsync(dmix->spcm); dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; avail = snd_pcm_mmap_playback_hw_avail(pcm); if (avail < 0) Index: pcm_dshare.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_dshare.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- pcm_dshare.c 20 Jan 2004 15:29:39 -0000 1.13 +++ pcm_dshare.c 21 Jan 2004 19:21:11 -0000 1.14 @@ -292,6 +292,7 @@ if (err < 0) return err; dshare->state = SND_PCM_STATE_RUNNING; + snd_pcm_hwsync(dshare->spcm); dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr; avail = snd_pcm_mmap_playback_hw_avail(pcm); if (avail < 0) Index: pcm_dsnoop.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_dsnoop.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- pcm_dsnoop.c 20 Jan 2004 15:29:39 -0000 1.13 +++ pcm_dsnoop.c 21 Jan 2004 19:21:11 -0000 1.14 @@ -274,6 +274,7 @@ if (err < 0) return err; dsnoop->state = SND_PCM_STATE_RUNNING; + snd_pcm_hwsync(dsnoop->spcm); dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr = *dsnoop->spcm->hw.ptr; gettimeofday(&tv, 0); dsnoop->trigger_tstamp.tv_sec = tv.tv_sec; ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog