"It'll only take an hour and it'll make this feel like a real game," I said last week. I was off by an order of magnitude on the first count, but it was worth it.
OpenAL streaming is tricky. The Programmer's Guide example was sketchy as hell, so I took an example from the OpenALSoft source, adapted it to use libsndfile to read OGG, FLAC, etc, and rewrote it to fit my game. My original SFX code was crap so I rewrote that too, dropped a dependency (ALURE: fancy C++ OpenAL helper lib), and added a Playlist class and playlist scripting in the scene parser, with per-track repeat count & volume. Good to go!
One slight problem when playing OGG: I hear a crackling noise whenever there's a peak (clipping) in the input waveform. I've noticed that in some released games too. I narrowed it down to OGG+sndfile and did some searching... some MuseScore devs figured it out 2 years ago: it's a libsndfile bug that'll be fixed if version 1.026 ever gets released. I could take my chances with the dev version. But... LibSndFile requires libogg & libvorbis which I never got to work in my Windows build; it's trouble. More likely I'll switch to stb_vorbis if it works ok; there'll be some extra buffering complexity between it and OpenAL but it's just one C file. Word.
And I did some recording this morning...
Here's a preview > https://soundcloud.com/tnovelli/fine-companion
I don't know about you but I can listen to that over and over. I think it'll make the final cut for one of the safe (-ish) areas in game. Apparently it's from an early 1600s play about a douchebag slacker guy, however, it reminds me more of the Companion from Firefly... and what RPG would be complete without the oldest of professions? :D
1 down, 5 more like that on my list, and 10+ originals to go... a few in that style, some edgier stuff for dangerous areas, heavy metal for combat, and foreboding silence in the woods, swamps, etc.
And... what a difference from the old days! Remember when music was all tinny OPL synths and MOD/S3M/IT?