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.

Author
Message
Brother
12
Years of Service
User Offline
Joined: 2nd Jul 2012
Location:
Posted: 14th Dec 2012 12:43
Hi,

I would like to loop a car engine sound with AGK.
My sample is 200Ko. (Maybe too big ?)
The other specifications are : PCM, 16 bits, Mono, 48Kz, 768kbps.

When i play it in loop with Cool Edit, it's ok, there is no gap.

But when i try to use it with AGK
with PlayMusic() or PlaySound() instruction i hear a gap
wich completely break the ambiance i want to create...

I think it's due to the memory sound reload or something ?

Is there some specification for a sound file i don't know ?

Is there an other way to play a loop sound file with AppGameKit ?

Thanks for your help.

I am not english so xcuse my syntax, grammary or anything else wich could occure some ununderstanding
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 14th Dec 2012 13:06
I would ignore AGK's loop mechanism.

Instead, play your sound with PlaySound() without looping, and check in your main program loop to see if it's playing. If it isn't, play it again. And so on. This works fine 99.9% of the time.

Reference here:
http://www.appgamekit.com/documentation/Reference/Sound/GetSoundsPlaying.htm

If you're using Tier2 or Tier3 there are other third-party options, but they can be expensive for commercial use. I'm tempted to produce some for AppGameKit that do not cost as much as a luxury car!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
7RS
12
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 14th Dec 2012 14:06
Hi, we have used the loop with PlaySound but i loaded all sfx in memory because if you try to load it in realtime the devices aren't faster sometimes, especially if are not powerful.

just to explain

sound = loadsound(name)
playsound(sound)

now if you won't play with the inside loop option you can check if the sound is still playing checking with GetSoundPlaying

This work fine in my game.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Brother
12
Years of Service
User Offline
Joined: 2nd Jul 2012
Location:
Posted: 14th Dec 2012 14:08
Hi Jim,

Thank you.

I tried this with PlaySound() but there is always a gap.
Do you see something in my code wich could be corrected ?


(i also try to include a sync() right after playsound() without good result)

I am not english so xcuse my syntax, grammary or anything else wich could occure some ununderstanding
7RS
12
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 14th Dec 2012 14:12
What is the reason to do not use the inside loop option ?
if is a sound that need to play in loop you can play like



and if you need to stop it when the car crash or in any other moment you can use the StopSound

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Brother
12
Years of Service
User Offline
Joined: 2nd Jul 2012
Location:
Posted: 14th Dec 2012 14:28
Hi 7RS,

I am going to try your solution.
It's right... in my game i didnt use memory location for sound sample in my preload section...

I reduced also my sample size to 9ko.

... some moment later...

That's what i put in my code :
Preload section:

Sound Main loop :


The result is quite good on windows.(still a little gap)

But it's perfect on Android, no gap any more !!!

As it's an app for Android, problem is solved for me.

But if anyone as the correct specifications needed for a sound sample it could be useful to other people.

Thank you every body.

Brother

I am not english so xcuse my syntax, grammary or anything else wich could occure some ununderstanding
7RS
12
Years of Service
User Offline
Joined: 10th May 2012
Location:
Posted: 14th Dec 2012 14:33
You welcome, in any case load functions are always a problem if need to be processed in realtime.

http://www.7ravenstudios.com
https://www.facebook.com/pages/7-Raven-Studios/102567824318?ref=hl
https://www.facebook.com/groups/391126020940838/
Brother
12
Years of Service
User Offline
Joined: 2nd Jul 2012
Location:
Posted: 14th Dec 2012 17:05
Ok 7RS, i note this information

I am going to continue my engine sound implementation and my sample adaptation (switch on, slow, acceleration, brake...).

People dont know how much programmers suffer to make these things going fine...

Thank you all.

Regards,
Brother

I am not english so xcuse my syntax, grammary or anything else wich could occure some ununderstanding

Login to post a reply

Server time is: 2024-11-27 20:54:27
Your offset time is: 2024-11-27 20:54:27