RPi: Multithread for sound and GPIO input
thanos (1776) 1 post |
Hi all, What i need to do is playback a sound and simultaneously listen from input using a GPIO pin. So far I managed to perform these two processes solely in Raspbian meaning that I can execute the first command but I have to wait playback to finish in order to proceed to the 2nd. Is it possible to achieve this using RISCOS?Accuracy is the main requirement. Achieving less than 1-2ms will be the best in logging the GPIO input. |
Peter van der Vos (95) 115 posts |
I think the best way of doing it to implement the second routine as an interrupt routine. Maybe you can use the GPIO to generate an interrupt or you can use a timer with the accuracy you want to poll the status of the GPIO input. The other way to do it is to interleave your two projects. Play the sound/fill the sound buffer for 1 msec, then check the GPIO pin etc. |
nemo (145) 2556 posts |
Sound is already played back under interrupts in RISC OS, so you can just start the sound playing and then start monitoring, surely? Writing sound modules is not for the faint-hearted though. |