Thursday, April 26, 2007

I've learnt some CFFI while trying to play with SDL (bottom line being, Macs are weird, I shoulda known better, *shakes fist*) and it's real smooth stuff. It's still not second nature, but it's really nice to read through the tutorial for a library, encounter a function or a type you haven't used yet, enter a simple declaration or two in my running SBCL image, and start playing around with the function to see how it works.

Tonight I was trying to learn to use SDL_audio (which is nice, because it forces me to learn how to do callbacks in CFFI) and I made a simple white noise generator. So it turns out it's not a good idea to cons in a callback that is called 44100 times a second. :D I managed to get the error message "Whoa! allocation trap and we weren't in lisp!" and had an uninterruptible stream of white noise coming out of my speakers while frantically trying to bring up a terminal to kill sbcl, my hard drive thrashing as it swapped out virtual memory it never knew it had.

Who says I don't ever do anything exciting?

No comments: