[alsa-devel] Exemple of source code for capture without using callback

brunal2496 gmail brunal2496 at gmail.com
Fri Oct 23 11:39:06 CEST 2009

Tanks for your answer.

>> But _not_ the snd_async_add_pcm_handler function, which is evil.
>> (This is the only ALSA PCM function that mentions "callback" in its
>> documentation, so these are often confused.)
>> The 'good' callback method means that the audio driver informs the
>> application when its wants to have new audio data, not the other way.

If I'm not wrong you're talking about playback in that case, isn't it?  
I'm considering capture so you mean that the good callback method is  
when the audio driver tells the application that it have new audio  
data (the buffer contains at least a "period_size" of audio samples)  
to give to it. Am I right?

> Yes, to clarify, not that call.
> A poll() that then does the callback is the preferred method.

Ok. But I cannot find a source code using poll() for capture on  
internet. Would you please gimme a pointer or at least a pseudo-code  
for an application using poll() i.e. just what is the sequence of the  
Many thanks.

More information about the Alsa-devel mailing list