Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Delay when playing sound

Author
Message
UberNoob
16
Years of Service
User Offline
Joined: 6th Oct 2008
Location:
Posted: 6th Oct 2008 22:34
Dear all.

I'm completely new to DBp and am trying various noob stuff.

One anomoly I've come up against is a delay when I first try to play a sound.

This is my code...



When my ball first hits the bat 'sprite hit (1,2)' there is a delay before it plays the boing.wav sound. After this, it's instantaneous.

Anyone know why? I've done a search, but it didn't come up with anything.

Thank you.

UberNoob
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 7th Oct 2008 01:17
It's because it has to load the sound into memory before playing it.

At the start of your game (right when you initialise everything), load the sound, set the volume to 0, play the sound, and then put the volume back to normal.

The sounds will then all be in RAM and available to play instantly.
Tobo
19
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 7th Oct 2008 12:40
Is that the official solution?

It sounds a bit of a bodge to me.

T
UberNoob
16
Years of Service
User Offline
Joined: 6th Oct 2008
Location:
Posted: 7th Oct 2008 20:01
Okay, I've tried the 'if sound playing' method, and have used another type of .wav file. Both still have a pause the first time it's called from the 'sprite hit' condition.

Any other thoughts?

I've attached a RAR'd file of the executable with media, so you should see what I mean. if not, the it must be my PC.

Attachments

Login to view attachments
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 7th Oct 2008 22:46
Hm, there's no delay for me when running that one.
Maybe it's your sound cards doing?

"I kören hörs de brummande busarna Björnligan och Gondolen"

Login to post a reply

Server time is: 2024-11-25 16:27:20
Your offset time is: 2024-11-25 16:27:20