alsaloop: confusing line of code and easier example of the use of snd_pcm_poll_descriptors API
alsa-project/alsa-utils issue #185 was opened from anthonio9:
Hi! Recently I've been studying the alsaloop software, I'm trying to understand how should the snd_pcm_poll_descriptors api be used reliably. Reading through the pcmjob.c file I've noticed that in the pcmjob_pollfds_handle function in line 1964 there's a condition that does not exactly make sense to me. What's the purpose of variable loopcount? If the code is more or less
```cpp
int loopcount = 0;
do
{
// instructions
loopcount++;
} while ((ccount > 0 || pcount > 0) && loopcount > 10); // line 1964
```isn't it equal to running the loop just once without any loops? After all, the loopcount will never reach 10 and the conditional statement will always turn false finishing the loop after one iteration. Correct me if I'm wrong.
I'd also appreciate a simpler example than alsaloop focusing just on the audio parts, on transferring audio from input to output reliably with the use of snd_pcm_poll_descriptors.
Thanks
Issue URL : https://github.com/alsa-project/alsa-utils/issues/185
Repository URL: https://github.com/alsa-project/alsa-utils