Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-20 Thread Andy Wingo
On Thu, 18 Oct 2001, Paul Davis wrote: IIRC, it reflects issues to do with the layout of the h/w buffer. the results from mmap_begin() reflect the amount you can touch in one single contiguous operation (e.g. memcpy). keep in mind that the h/w buffer is a ring buffer, and the space available

[Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Andy Wingo
Hi. I'm writing the alsa plugin for gstreamer. When I go to capture audio, my loop eats the entire cpu. I set avail_min but still sometimes get out 32 frame avail values. Here's the relevant portion: /* shamelessly stolen from pbd's audioengine. thanks, paul! */ static void gst_alsa_loop

Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Paul Davis
In message [EMAIL PROTECTED]you write: Hi. I'm writing the alsa plugin for gstreamer. When I go to capture audio, my loop eats the entire cpu. I set avail_min but still sometimes get out 32 frame avail values. Here's the relevant portion: /* shamelessly stolen from pbd's audioengine. thanks,

Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Andy Wingo
On Wed, 17 Oct 2001, Paul Davis wrote: In message [EMAIL PROTECTED]you write: Hi. I'm writing the alsa plugin for gstreamer. When I go to capture audio, my loop eats the entire cpu. I set avail_min but still sometimes get out 32 frame avail values. Here's the relevant portion: /*

Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Paul Davis
there are two of these loops running separately, one for each element, with separate handles, etc. I was thinking for some reason that snd_pcm_update_avai l would block until avail_min frames were available, but that's not the case. If I run the following pipeline, I get: snd_pcm_avail_update():

Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Andy Wingo
On Wed, 17 Oct 2001, Paul Davis wrote: snd_pcm_avail_update(): this simply updates the information on the number of available bytes. as you have noted, it does not block. what is snd_pcm_set_avail_main() for, then? your code does this: if (this-stream == SND_PCM_STREAM_PLAYBACK)

Re: [Alsa-devel] proper method for waiting on a capture device

2001-10-17 Thread Paul Davis
I just came to a pseudo-epiphany, but I can't test it atm. Do I poll on the fd , but set pfd.events = POLLIN | POLLERR? there now, that wasn't too hard, was it? :)) the rest of the code should look identical. note that audioengine (and now JACK) is technically in error because it only polls