Receiving data from the PCM subchannel
The function that you call to receive data from the subchannel depends on whether or not you're using plugin converters.
- The number of bytes read must be a multiple of the fragment size, or the read fails.
- The plugin reads an entire fragment from the driver and then fulfills requests for partial reads from that buffer until another full fragment has to be read.
A full nonblocking read mode is supported if the application can't afford to be blocked on the PCM subchannel. You can enable nonblocking mode when you open the handle or by using the snd_pcm_nonblock_mode() API call.
Another method that your application can use to avoid blocking on the read is to use select() (see the BlackBerry 10 OS C Library Reference) to wait until the PCM subchannel has more data. It allows the program to wait on user input while at the same time receiving the capture data from the PCM subchannel.
To get the file descriptor to pass to select(), call snd_pcm_file_descriptor() .
Last modified: 2013-10-30