Re-wrote with event-loop structure utilizing Python's native asyncio interface. The logic is relying on the SPDIF lock register on ADAU145x.
On some devices (e.g. VIZIO m602i-b3), it may switch SPDIF signal back on for about a minute after it is turned off, and therefore acquires the device once again even it is not in use. However by sending USR1 signal to the process can temporary pause the loop for 15 seconds so other process can occupy the playback device.
I'm preparing another PR for alsaloop, which is not yet matured but shares a similar state machine as this one. We may have further discussion about if an abstraction layer in audiocontroller module can help/promote code reuse.
BTW do we need MPRIS/DBus connections on this script as well?
Re-wrote with event-loop structure utilizing Python's native asyncio interface. The logic is relying on the SPDIF lock register on
ADAU145x
.On some devices (e.g. VIZIO m602i-b3), it may switch SPDIF signal back on for about a minute after it is turned off, and therefore acquires the device once again even it is not in use. However by sending USR1 signal to the process can temporary pause the loop for 15 seconds so other process can occupy the playback device.
I'm preparing another PR for
alsaloop
, which is not yet matured but shares a similar state machine as this one. We may have further discussion about if an abstraction layer inaudiocontroller
module can help/promote code reuse.BTW do we need MPRIS/DBus connections on this script as well?