Game Development Community

Delay when first playing a sound

by Sam Redfern · in Torque Game Engine · 12/20/2006 (3:40 am) · 4 replies

Just wondered whether anyone has a quick solution to the problem where there is a brief delay the first time a sound is played?

Specifically, this is for short GUI sounds such as button clicks. I sorted out the delays with longer sounds by setting isStreaming=true but for short sounds that puts them into loop, contrary to what the isLooping field is telling them...

This is on TGE1.3..

#1
12/20/2006 (3:48 am)
Hmm.. it seems there's no problem when the sound is stereo. True to form, the solution hits me within seconds of posting a question :-)
#2
12/20/2006 (3:55 am)
[Edit: oops. didn't see your followup]

You've probably already looked into this, but if not . . . the first thing I thought of was the preload flag in audioprofiles.cs. I'm mostly clueless about audio issues, so feel free to ignore this . . .

new AudioProfile(AudioButtonOver)
{
   filename = "~/data/sound/buttonOver.wav";
   description = "AudioGui";
	preload = true;
};

or

Another option might be to scriptically cut down all of your volume levels and play all of your button/interface sounds one time quickly during the start of your game's fade-in screens. Then bring the volume back up before the main gui interface screen appears. It's a cheap hack, to be sure. But it might work.

I remember seeing weird test patterns in one corner of old standup arcade games many years ago. My guess is that they did it to pre-cache the graphic elements that would be needed later.

[Edit: my hacky observations seem silly after reading your second post. Oh well]
#3
12/20/2006 (4:11 am)
Aaron: thanks anyway :-)

Yes, preload was always true, that didn't help

I had also tried a similar scriptical hack to what you suggested, but it seemed to only intermittently help ..

"scriptical".. nice word.. ;-)
#4
12/20/2006 (4:21 am)
Yeah, inventing new words is one of my specialties. Couldn't fit it into my profile though. :)