So what's the best way to do audio right now?

BlitzMax Forums/BlitzMax Programming/So what's the best way to do audio right now?

sswift(Posted 2007) [#1]
I'd rather not include a big OpenAL DLL with my game... Can we assume Vista will mostly have OpenAL installed? If so, would the safest automated way to do this be to use the default FreeAudio driver unless OpenAL is available, and use OpenAL instead if that is the case?

I also notice a lot of people who posted lists of the drivers that Max returns didn't have DirectSound in the list. They had FreeAudio DirectSound, but not plain old DirectSound. I've got DirectSound on mine. It seems odd that anyone would not have plain DirectSound, unless they're running Vista, but even in that case, I thought it was software emulated, or a wrapper for OpenAL?

It's kind of annoying that I have to worry about this at all. Why isn't Max automatically selecting the best driver available? Mark has access to a lot more testing information than I do. He could make much better decisions about which drivers are safest to switch to under which OS's.

Perfect sound would be nice, but there's no way I'm gonna force a user to select one of five different sound drivers in a casual game, even if it means the sound won't work on some systems.


GfK(Posted 2007) [#2]
I use FreeAudio on all operating systems, except Vista, where I use OpenAL.

I had a lot of problems with channel limitations on one of my PCs when using OpenAL, so I had to use its software mixer which slowed things down a little. I figure any PC capable of running Vista, will have fairly enormous balls anyway, but I didn't feel I could suffer a speed loss - however small - on minimum spec systems.

FreeAudio works on everything but Vista - where it lags horribly. As for DirectSound, some people tell me it works in Vista, some people tell me it doesn't.

The sound driver is switchable in-game between FreeAudio, DirectSound and OpenAL via advanced options.

The OpenAL DLLs compress down to 234k so I don't see that as a hurdle, really.


Grey Alien(Posted 2007) [#3]
I'm gonna do what GfK does, auto detect vista and pick OpenAL otherwise use FreeAudio (which is default anyway right?). Problem is FreeAudio doesn't work very well on 98 (and maybe Me) due to buffer size issues I believe. I've seen these problems myself and have heard others report them, even the musician for Holiday Bonus who sent me a recording of the problem.

Sure only 10% of people run 98 now, but what about Me? Do those people buy games because they obvisouly haven't bought a new PC in a while etc...who knows?


Tachyon(Posted 2007) [#4]
Grey: how are you detecting Vista from other versions of Windows?


ziggy(Posted 2007) [#5]
I would recomend you to follow gfk advise at first run (then save configuration). this way, you can add an option to change the 'default detected' audio driver in the options section of your game, just in case anybody have problems with the 'non problem' audio driver automatically selected at first run.


popcade(Posted 2007) [#6]
Carry OpenAL DLLs with your game is OK if you don't want user to install OpenAL driver.

as uFMOD has DSound/OpenAL dirver done, I use XM music for my game, and corresponding driver for SFX.


sswift(Posted 2007) [#7]
So can someone post a code snippet which detects vista and selects the OpenAL driver then?


GfK(Posted 2007) [#8]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1978


Grey Alien(Posted 2007) [#9]
beat me too it. I'll be using that code for sure. GfK. You mind if it goes in the framework (so I can make it autoswitch drivers) with a credit to you? (I ask out of politeness as it's already been declared public domain ;-))

I should be able to test it on Me (and maybe 98 too). It could be worth switching to Direct Sound on those old OSes. I'll see if the sound problem goes away.


GfK(Posted 2007) [#10]
No I don't mind. The code wasn't exactly mine in the first place - was converted to Blitzmax from some old VB code I found.

Don't forget that I haven't tested it in anything other than XP,Vista and now Win98. I confirmed the version numbers with a variety of different sources, though, so it should all work fine.

If you test it on other systems and it works OK, feel free to post a reply in the code archives for the benefit of others. ;)


Grey Alien(Posted 2007) [#11]
(thanks). YEah like I said, I'll test it on Me and post a reply. You need to update the post as it doesn't say you tried it on 98.


GfK(Posted 2007) [#12]
Updated :)


JazzieB(Posted 2007) [#13]
Hi, I'm another one for the use OpenAL on Vista, FreeAudio on everything else ... even though DirectSound actually seems to be slightly better on my own system, but hey.


ninjarat(Posted 2007) [#14]
I just use FMod, it's much faster and better optimized than Max's native sound.


Grey Alien(Posted 2007) [#15]
But for commercial project the FMOD license is a reasonably large amount I believe.


Paul "Taiphoz"(Posted 2007) [#16]
Will that audio driver be getting an update ? or is it just going to be that we need to use the Al driver ?