I'm pretty sure the loving to hateful words ratio between me and ALSA is about 0 : 1,000,000. Or in short if I ever say "I effing love ALSA", it's a pretty safe bet that I've been replaced by a bodysnatcher or something.
Generally I have used ALSA directly as much as possible over the years because at the end of the road on Linux systems you will always, sadly, end up with that. But I also find that configuring and living with it tends to be a bitch on wheels of fire the more complicated people make things. Let's say that ALSA is something I suffer not something I love.
Well, recently I've had a bit of a pain in my arse dealing with ALSA, GStreamer, and trying to do audio passthrough. And I've learned that I really do like PulseAudio.
mpv is able to do passthrough but that doesn't suit my purposes, or let's just say scripting that ain't my real objective.
$ mpv --aid={track #} --audio-device=alsa/{device} --audio-channels=5.1 {my file with fancy audios}
GStreamer is smart enough to passthrough audio if you send the bits to the sink. Most elements that manipulate audio expect audio/x-raw data like you would get out of your audio decoder. But the sinks can also take other formats--much like my surround system knows how to decode pretty much anything.
What I ran into was alsasink never reporting any of the compressed formats my graphics card supports, after GStreamer tries to decipher what the device is capable of.
Enter PulseAudio!
$ gst-launch-1.0 filesrc location="{my file}" ! queue ! {demuxer} ! audio/x-ac3 ! queue ! parsebin ! pulsesinkWhere I had no luck getting this to work with alsasink it was easy as pie with pulsesink.
Deciphering the documentation to configure the default profile for my card via pactl and add the formats I want to passthrough to my surround sound system was a snap that only took 15~20 minutes. Figuring out the device names used for pulsesink based on pactl list was a bit tricker. I spent 2~3 days screwing with ALSA before that.
For bonus points: I could test ahead of time using my laptop's HDMI port and pavucontrol to configure the outputs, letting me know if this would be possible at all before I started learning how to do it with pactl.
I can't say that I'm a big fan of the guy who wrote PA, or that I truly gave a flying hoot when the Linux desktop world went to PA and we all threw out things like aRts and ESD. My only horse in that race was I wanted audio to work in applications like mplayer and firefox without having to screw around.
In retrospect: I should have just learned how to use PulseAudio a long fucking time ago instead of dicking with /etc/asound.conf and amixer and all that BS. Because those aspects of PA really do suck less in my honest experience.
And then I find myself remembering FreeBSD and its OSS, in which the only issue I ever really had with audio was whether or not there was an suitable driver for my card, lol.
No comments:
Post a Comment