The trick is using dmix on loopback device:
2 dmixers; one for regualr onboard audio; the other for loopback virtual device, then duplicates streams send to onboard audio card, so you can hear what is being sent to loopback device.
Need to load snd_aloop module first;
Code:
modprobe snd-aloop index=2 id=Loopback pcm_substreams=1 enable=1
My first audio device is onboard soundcard; 2nd is HDMI card, so I put index=2 for Loopback device.
file...