ALSA Queries on OMAP

I have some doubts on the ALSA programming,

1)ALSA driver supports minimum Period Bytes size as 32 bytes, but when i set the period size as 512 bytes it is always setting to 1024 bytes.I am using the function “snd_pcm_hw_params_set_period_size_near()” . What might be wrong here?Is the function what i am using correct?

2)How the Library functions and the Driver functions interact, what is the interface between the library functions and driver functions?Is there any document which explains this. I got a document which explains how to write ALSA driver.But it does not mention the interface with the library.

3)How Can we achive MIC and LINEIN switching using the mixer?What library function do i need to use to achive this?

4)If i want to get the Timestamp for each buffer captured, what library function should be used?

5)I am trying to capture and play the same audio (ALSA duplex). When i capture and store it in a file and play from the file i am able to hear the sound properly. If i capture in a buffer and play the same buffer directly it says Broken PIPE ERROR in the playout.

I tried the capture and playout in two different threads, i am able to hear the sound and i am not getting any Broken PIPE error. But along with the audio i am hearing some noise.

Do we need to use some kind of synchronisation between the threads for capture and playout?

Any help on these things is appreciated.

Thank you in advance.

Regards,
Shaan

Shaan :

What's your kernel version and from which distribution. I've tried to
compile Linux kernel from different source and with different version
but no success in sound capture using arecord. However, aplay works
without problem.

Thanks and Regards,

David

Shantanu Bhaduri wrote: