hifiberry / hifiberry-dsp

DSP toolkit
MIT License
143 stars 36 forks source link

Release ALSA Playback Device When TV is Off #41

Closed hftsai256 closed 2 years ago

hftsai256 commented 2 years ago

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?

hifiberry commented 2 years ago

Thanks for this. While in general all player (including Roon) will start the pause-all script, I'll still merge this.