Depending on what exactly you have in mind, maybe the following could help.
You can extract an ALSA device’s stream status from…
/proc/asound/x/pcmyp/subz/status
… with the nomenclature depending on installed devices.
If not already streaming via an ALSA device on the core, you can set up a loopback device on startup in \etc\rc.local via following line before the exit 0 line …
#!/bin/sh -e
#rc.local
#This script is executed at the end of each multiuser runlevel.
#Make sure that the script will “exit 0” on success or any other
#value on error.
#In order to enable or disable this script just change the execution
#bits.
#By default this script does nothing.
#Print the IP address
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “My IP address is %s\n” “$_IP”
fi
sudo modprobe snd-aloop
exit 0
… to add as an audio zone and then group with your actual RAAT zone you want to monitor.
Then adapt following executable script to extract stream status and effect whatever you need.
I use this for my roon-dynamic-range-metering-bridge to keep the RPi screen on during play and to turn it off on stop:
#!/bin/bash
DIR=‘/proc/asound/Loopback/pcm1p/sub0/status’
monitoron=‘xset -d :0 dpms 2 2 2’
monitoroff=‘xset -d :0 dpms 1 1 1’
while :
do
content=cat $DIR
if [[ “$content” != ‘closed’ ]]; then
$monitoron
else [[ “$content” = ‘closed’ ]]
$monitoroff
fi
sleep 1
done
Might be a little clumsy, but hope that helps, and you might want to show us what you’re up to!