Log in

No account? Create an account
Pete Zaitcev's Journal -- Day [entries|friends|calendar]
Pete Zaitcev

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

[12 Nov 2004|10:56pm]
To celebrate the installation of FC3 and thus a natural loss of all software capable of playing MP3s I have decided to build mpg123 with ALSA backend. It turned out that the ALSA support in mpg123 bitrotted and the API moved on so much that a rewrite was in order.

This hackery was an enlightening experience, to say the least. I pondered writing a nastigram to Jaroslav a few times while doing it. I discovered that the ALSA userland has all the features of the kernel side ALSA, that is to say, ridiculous complexity, pointless abstractions, and poor style and C craft level (featuring, but not limited to, passing structures willy-nilly).

ALSA is not documented in any useful way, so to write anything as simple as a function which reports supported sample formats one has to read the source then puzzle out the twisted mental process of the author. Sure, there's a HOWTO (with trivial examples which do not explain much), and a reference manual (made with Doxygen).

To top it off, something in ALSA exhibits ludicrous behaviour upon underflows: they must be explicitly cleared, it appears. Joy.

Long time ago, I somehow entered a flamewar with Jeff Garzik and Alan about ALSA. Jeff wrote about "inherent races", but when I grilled him about it, he wrote, "close-then-open is spec-defined, and IMO obviously racy." Yay. How is it racy if only one thread can work with an instance of a device? And in ALSA it's actually worse: same one thread per instance of PCM, and a thick library layer with murky reentrability. Alan wrote with authority: "I actually worked with the 4Front guys on some of the API fixups. There are several real "oh dear, game over" type problems in the old OSS API especially on the synth/effects side." If I knew then what I know now I might have tried to argue from a position of experience and maybe got myself smacked. Fortunately, I haven't seen at the time what I saw this week and therefore decided that Alan knew better. And now I do not care enough to argue with anyone.

The only little thing that bothers me is that I may be getting bugs in ALSA assigned, and that would be unpleasant. But life is like that - unfair. I'm completely at peace with it.
post comment

[ viewing | November 12th, 2004 ]
[ go | previous day|next day ]