Older blog entries for volsung (starting at number 8)

Dang, Win32 is *ugly*. I dug up the MSDN Library CD here at work and started reading the section explaining sound output. Boy, I don't like it. The waveOutWrite() call is always non-blocking *and* I can't free the buffer until the write is done. That means I can't return from the ao_play () call in my library unless the block is done playing or I've copied it to a new buffer.

In either case, I'm going to have to figure out some goofy way to sleep until the block is done playing. A poll loop is icky because I would have to hot spin and blow CPU time. I can do a callback, but I don't have a clue right now how I should go about sleeping until the callback wakes me up. I want to use something like signals I think. I sure as heck am not going to dive into Win32 threads and lose my mind. Bleah.

Wow, Slashdot sure is whacked out these days. I went back to try and read the comments, and I can't deal with it anymore. The demographic has changed so that I'm not that interested in the discussions that go on. Too bad. I kind of liked that place.

Good thing I found Advogato, or I might have actually become productive. :)

Took someone's (darn, already scrolled off the end of the recent diary entries) advice and changed the libao API for the third time. The change was trivial, and the result is much cleaner. Thanks.

Finally figured out the ALSA problem. By default the driver operates in non-blocking mode. The program would decode the next block before the first one had finished playing and would overwrite the currently playing block with the next block. Hence the neat (though frustrating effect) of listening to Brickhouse at 33% faster speed. I fixed that and wrote some buffering code to pack the data coming in (which can be in chunks of whatever size) into 32k blocks and send the completed blocks to the ALSA driver. Sounds good.

I've decided to wait on submitting this code until Kenneth gets back. Monty mentioned a little while ago that he would no longer mess with that branch (after accidentally stepping on Kenneth during a commit frenzy). In the meantime, I'm going to see if I can scrounge up an IRIX account on some friend's box to test (at least the compilation of) libao on IRIX. Same goes for Solaris, though I don't know if our school's Solaris boxes have the sound header files. If neither of these seem feasible, I'll go figure out how to do Win32 code instead. :)

Also hacked on a patch I found to let ht://Dig work with SSL. The patch was for 3.1.4, but would not cleanly apply to 3.1.5. I've never hacked a diff directly, though I must say it is not as hard as it looks.

ralsina: Ack. Slashdot has cured me of my desire to participate (or watch) the license flamewars. I must say that the GPL == non-free debate is one of the stranger ones I've heard of. I guess my take is that every license except the public domain is "non-free" to a certain extent, just like anarchy is the only truly "free" form of government. Of course, being "free" isn't one's only motivation in such things, so the issue is how much freedom should be traded in for other things we want. That's the real debate in my mind, and the rest is just playing games with semantics.

jmg: Careful with the CD-RW. I've had problems reading them in most CD drives (unless they are also CD Burners). I imagine newer drives have no problems, but you may be stuck in front of an older box.

Got ALSA working on the spare computer. It looks really quite powerful. Perhaps one day we'll start seeing audio workstations running on this architecture. (Come on Cakewalk, you know you want to do a Linux port. You know you do!)

Finished my API rewrite for libao and tried to write the ALSA driver. Whoa boy, too much control. I have no idea which values are critical to set. I can finally get about 5 seconds of playback before the program goes silent. It keeps running, but I can't hear anything. Hmm..

Back in real life, I decided not to go to my Theoretical Computer Science class. I think my time was better spent reading the chapter for 20 min than sitting in class for 90 min. Why are these classes so boring?

Update:Argh! ALSA is making me very mad. I can't figure out how to get this thing to do anything but play "Brickhouse" (my test OGG file) at high speed. It seems to be chucking 25% of my buffer everytime I write. Ack. Tired.

I was thinking in the shower this morning and realized that my public interfaces to libao are fairly annoying. Why make the application keep track of the driver function table *and* the device state. If real life is any indication, groups of items tend to get separated and lost. I should just make generic wrapper functions that take device id's (think file id's) returned by the ao_open function, lookup the associated function table, and call the right function.

Does this sound familiar? I should have looked at the standard UNIX open() and write() functions. Doh! Reminder to self: Never forget precedent. If UNIX programmers like it, it can't be that bad. :) (I'm sure someone in the audience will have issues with that one.)

Anyway, I've started installing ALSA onto a spare Linux box I have at work. Once I get the hang of it (and get it to work with my AWE32 card), I'll write an ALSA driver for libao. Still waiting for someone (Monty) to tell me how I should get this package into the vorbis tree. Maybe my last email was unclear. (Or maybe Monty is clairvoyant and knows that I needed to fix my code.)

libao is ready to integrate into vorbis now. I still need to hear back from Monty about how to get all my changes into the tree. Next up I need to add support for ESD and ALSA.

More work on libao/ogg123 integration. Today I figured out how to do autoconf and got my compilation magic to work. Now I can output to the soundcard and 6 wav files simultaneously. (Though either the IDE or the P-166MHz CPU is causing some serious skipping when the OS finally decides to flush the disk cache. ) Now to go through and do cleanup and submit to Monty.

This is actually rather exciting. I've never submitted anything to an Open Source project before. (Well, aside from a lame patch to vorbis that Kenneth was going to submit already.) Most nifty.

Spent most of the afternoon monkeying with an 8 year old color laser copier my father got for free. Works pretty well, and now I know more about fixing and operating these things than I think I wanted. Unfortunately, they lost the Postscript unit that let you use the copier as a printer. I drool at the thought of owning a printer that does color and postscript natively. (No more damn PCL, please!)

Oh yeah! Nothing like a working program to make you feel good in the morning! I've got libao pretty much working now. Multiple device support is working too. (Let this be a lesson to you: Beware of pointers to pointers. Dereferencing them improperly leads to madness.) I just ran ogg123 and let the output go to the null device, the soundcard, and a wav file all at once. Whee!

Now I've got to clean up the code and make the build process more slick. I should also write an ogg123 man page. I wonder how you do that.

Did some more work on the libao cross-platform audio library. I almost have all the bugs out. I think I did something stupid with the linked list of devices, so I still haven't got multiple device output working yet. Next up will be doing the configure/Makefile magic to get all the right files compiled in. Hopefully I can start pestering Monty about integrating it by Saturday or Sunday.

Maybe someday I can grow up and understand the actual libvorbis code. I suppose I can dream. :)

Whee. This is an interesting site. I've been lurking here for a few days. The trust metric is a really interesting idea. I remember discussing something like it with Slashdot comments, though the goal was different. Our idea was to change moderation to a basic "like it/ don't like it" choice and make everyone a moderator. The system, through a probably order n^3 algorithm, would assign every other user on slashdot a score based upon how similar you were in comment taste. Eventually, the system could "pre-score" comments based upon how others who were similar to you liked him. We thought it was neat, although it would surely kill the slashdot servers.

Anyway, I'm currently working to add cross-platform audio support to ogg123, the command line vorbis player. I started with libao, a crossplatform audio library buried in ac3dec, which was buried in the LiViD archives. I'm having to rewrite it severely so it does not require automake, just autoconf, and so it allows many simultaneous output drivers to be in use. It's coming along nicely, though I'm going to hit a wall soon when I need to test the IRIX and Solaris code. (Unless someone decides to send me a free UltraSPARC.)

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!