omxplayer bypasses ALSA etc and goes straight to the hardware so isn't a good test of what is working.
The default ALSA driver exposes a single device that can then be switched between the analog and HDMI outputs via a control. Run "amixer controls" and it should list out
Code: Select all
pi@raspberrypi:~ $ amixer controls
numid=3,iface=MIXER,name='PCM Playback Route'
numid=2,iface=MIXER,name='PCM Playback Switch'
numid=1,iface=MIXER,name='PCM Playback Volume'
numid=5,iface=PCM,name='IEC958 Playback Con Mask'
numid=4,iface=PCM,name='IEC958 Playback Default'
numid=3 is the one you want for redirecting the audio output. 1 is analog, and 2 is HDMI, (3 is HDMI1 on Pi4).
The volume control tool in Raspbian does exactly this when you switch the output. This should redirect the default audio output.
There is an alternate way to drive the audio hardware that exposes the different audio destinations as independent ALSA devices. See
https://www.raspberrypi.org/forums/view ... 4#p1526690
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.