Sound delay?

BlitzMax Forums/BlitzMax Programming/Sound delay?

Chroma(Posted 2009) [#1]
I'm experiencing something with Vista that I didn't with XP. When I play a sound, there's about a 0.5 second delay before the sound is actually played.

I've tried to load and play the sound directly. Also, tried loading it to a channel with getting it ready with CueChannel and then ResumChannel and it still has the small delay?

Anyone else experience this and/or have a fix?


ziggy(Posted 2009) [#2]
On vista, it is recommended to use the OpenAL driver to avoid this problem with sound.
More info here


Chroma(Posted 2009) [#3]
Cool. Problem solved with:

SetAudioDriver("FreeAudio DirectSound")

I'm assuming that driver is on every windows computer ever made right?


ziggy(Posted 2009) [#4]
Yes, OpenAL works better (FreeAudio has some glitches sometimes), and all you have to do is distribute the dll in the same folder as your exe. Just in case...


sswift(Posted 2009) [#5]
This is what I did in my game:
?Win32
If Not SetAudioDriver("directsound") Then DebugLog("Error in App.Create(): Could not set DirectSound audio driver!")
?

I did that because of the Vista sound delays. I have tested on Vista since then and have not noticed any delays. But maybe it only happens on some Vista systems?


GfK(Posted 2009) [#6]
Has anybody confirmed whether this issue exists in Windows 7 or not?


Chroma(Posted 2009) [#7]
i don't want to download and install the whole sdk. what's the name of the dll? is it openal.dll or openal32.dll?


GfK(Posted 2009) [#8]
There are two and you need both:

openal32.dll
wrap_oal.dll


Chroma(Posted 2009) [#9]
Ok...so what's wrong with using the "DirectSound" driver? I changed it to that because of something sswift posted. I haven't had any problems at all and it sounds normal and of course, no delays.

I guess I'll test the DirectSound out for a bit and see if there's any glitches. I'm keeping OpenAL as a backup. Thanks for all the info.


Tachyon(Posted 2009) [#10]
I prefer using DirectSound on Vista. OpenAL sounds muffled, not as clear as other drivers.


Dabhand(Posted 2009) [#11]
DirectSound buggered for a few people who had a little test of my game, same as FreeAudio knacking up too.

So, I've just stuck with OpenAL, and had no bother since.

Dabz


xlsior(Posted 2009) [#12]
Just out of curosity: Any issues with OpenAL if you bundle the 32-bit OpenAL DLL with people under Vista 64?


Muttley(Posted 2009) [#13]
Just out of curosity: Any issues with OpenAL if you bundle the 32-bit OpenAL DLL with people under Vista 64?


No issues that I'm aware of. I develop under Vista 64bit and use the 32bit OpenAL DLL and it works fine.


sswift(Posted 2009) [#14]
So basically, you can't trust any of the drivers. You have a choice between delayed, "buggered", "knacked", or muffled audio. :-)


therevills(Posted 2009) [#15]
Has anybody confirmed whether this issue exists in Windows 7 or not?


I quickly wrote this to test it:



On my Win7 64-bit RC1, I cant hear any delays...

Heres the exe if you want to try it:
http://therevills.syntaxbomb.com/tests/sound_test.exe

The ogg files are here if you need them to test with the code:
http://therevills.syntaxbomb.com/tests/yeehaaa.ogg
http://therevills.syntaxbomb.com/tests/yipee.ogg


GfK(Posted 2009) [#16]
I tried your EXE. Half second delay under Vista SP2.


therevills(Posted 2009) [#17]
I tried your EXE. Half second delay under Vista SP2.


Thanks Gfk... looks like its fixed in Win7, no delay at all when I press the mouse buttons...


xlsior(Posted 2009) [#18]
Therevills: Not necessarily.

The half-second delay is present under Vista on SOME computers, but not all. Since Windows 7 is mostly identical to Vista, it's quite likely that it too will work on some and be broken on others.

It hasn't been pinpointed what exactly the conditions are to cause this problem, all we know is that it happens on some computers while the same code works OK on others.


therevills(Posted 2009) [#19]
Thats true Xlsior... Ive tested on two different PCs running Win7 and both were okay, but (as we know) there are so many combinations out there...