Game Development Community

Audio sometimes does not play ???

by torque2a · in Technical Issues · 01/17/2007 (3:04 pm) · 6 replies

Any assistance would be appreciated. I post the same about a month ago and received no replies:


When the game loads, all sounds work fine. As time goes by however, some sounds sometimes don't play, seemingly at random. This gets worse the longer the game is running until eventually it's rare that any play.

Techy stuff:
The only function I'm using is alxPlay. On the random failures it doesn't give me the error return of "0".
The sound card used is a Realtek High Definition Audio onboard an Asus motherboard. We've downloaded the latest drivers from realtek with no change.

To fix the problem I have tried both streaming and non-streaming audio, as well as creating a set of audio management functions which has had no effect on the problem. I've tried playing from the profile and from the handle as well as using multiple channels and rotating on each play. I have searched the forums for an answer but have not found one.

THANKS in advance for your assistance!

#1
01/18/2007 (12:02 pm)
Here's more info on the problem which we can replicate each time:

Test with a Realtek HD sound device

When I run the latest version of Torque game builder, sounds are not working properly. Sometimes sounds play and other times they don't. It's intermittent.

I downloaded and installed the latest version of Realteks HD driver. The problem persisted.

I downloaded and copied to my game directory the latest OpenAL dll. The problem persisted.

Using a USB port, I plugged in an Edirol UA-25 external sound card and installed the latest driver. The problem was resolved.

So it seems there is an incompatibility issue between torque game builder and the Realtek HD sound device. We need to fix this ASAP.
#2
01/18/2007 (11:38 pm)
Isolated the problem to Intel Duo Core (multithreading) and OpenAL.

Any suggestions as I narrowed it down... same app works on regular Intel and non-Intel with same onboard audio. Thanks in advance for your assistance.
#3
02/09/2007 (2:17 am)
I also have the same problem, I also use onboard sound device. And, I'm running Athlon 64x2 (multithreading).

I always run torque with the other cpu affinity disabled to simulate single core.

Still the problem occurs. Preloaded or not preloaded the problem occurs.

I don't have any other PCs to test it.

We need help.
#4
03/13/2007 (7:29 pm)
Is anyone from Garage Games OR anyone else able to address this audio problem that lingers on and on and on???

Thanks for whatever help you may be able to provide... Or for suggesting what areas of the code to look at to fix.
#5
03/13/2007 (8:00 pm)
Ok, my problem is solved. Actually my problem i solved. Though, I discovered that it's not a problem with OpenAL after all. My problem was getRandom.

if you play sounds like i do:

switch(getRandom(0, 2))
{
case 0:
    PlaySound1();
case 1:
    PlaySound2();
case 2:
    PlaySound3();
}

this simply won't work. I found this undocumented bug in how getRandom inside a switch won't be stable.
It turns out that getRandom(int, int) does not return a values that's always within the bounds [int,int]. You'll see when you add a default case in the switch above that there are cases that it goes there. So, my problem with occasional sounds not playing was actually because of that.
#6
03/13/2007 (10:02 pm)
Thanks for your prompt reply and for noting how you resolved the problem. We'll try this when back in the office tomorrow. Thanks again.