SNDCTL_DSP_GET{I|O}SPACE and non-bloccking application
Hi all,
I'm doing a sound application and i have two questions
1)
in many documentation on web (and so in ossguide.pdf) I read that is possible use ioctl calls with SNDCTL_DSP_GETISPACE or SNDCTL_DSP_GETOSPACE to obtain information about output and input buffering. Is it right?
Later i read that these two calls permit to writing non-blocking applications.
To do a playback of a soundtrack I use SNDCTL_DSP_GETOSPACE and It works well.
In the field "bytes" of the structure "audio_buf_info" there is always the number of byte that i can write without blocking the application.
After when i write code to do recording of soundtrack I want to use SNDCTL_DSP_GETISPACE but many times I obtain that the field "bytes" of the structure "audio_buf_info" is = 0. When it's != 0 I have only one or two fragment available on 32. Is there a explanation?
2)
If to do the playback/recording of a soundtrack I use another thread, is it necessary use SNDCTL_DSP_GET{I|O}SPACE too?
I see the code of player/recorder of raw file rawrec-0.9.97.tgz it's use some thread and never call ioctl with SNDCTL_DSP_GET{I|O}SPACE but it works fine.
bye all and thanks for any explanation
|