With pulseaudio, I can use this trick to figure out if my machine is producing sound:
$ grep RUNNING /proc/asound/card*/pcm*/sub*/status
For example, with pulseaudio, I get this when a video or sound file is playing in mpv:
$ grep RUNNING /proc/asound/card*/pcm*/sub*/status
/proc/asound/card0/pcm0p/sub0/status:state: RUNNING
$
If I pause the playback in mpv, I get this (as expected):
$ grep RUNNING /proc/asound/card*/pcm*/sub*/status
$
The trick doesn't work if I ditch pulseaudio and use apulse instead: Whether mpv is playing or paused, I get this same output:
$ grep RUNNING /proc/asound/card*/pcm*/sub*/status
/proc/asound/card0/pcm0p/sub0/status:state: RUNNING
$
So with apulse, if an mpv window exists, card0's state is "RUNNING" even if playback is paused.
So my question is this: Is there a different way to detect whether the soundcard is producing sound, a way that would give me the right answer even in the setting of apulse + paused mpv?