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 / how do I loop my sound?

Author
Message
Plastico
20
Years of Service
User Offline
Joined: 3rd May 2004
Location:
Posted: 9th Aug 2004 07:07
yes, it sounds easy, but im stuck.

I want to achieve a simple looped sound of a rowing boat.



that does not work, it just gives me a long "beeeeeeeee" sound.
I looked at the looped sound, but I just, dont understand it at all.
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 9th Aug 2004 07:14
That "beeeee" sound is your row sound looping over itself a thousand+ times as the program runs quicly over your simple code. Unfortunetly, I am in the same boat as you (no pun intended. I don't play like that ). I am trying to make a "grunt" sound in a game as my player punches, but it sounds right for a second, then begins to do the "beeeeeeee"! Just thought I would tell you what that is

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Aug 2004 07:22 Edited at: 9th Aug 2004 07:23
You are going to kick yourself...

LOOP SOUND
This command will play and loop the specified Sound Number continuously. Optional parameters allow you to specify a start position, end position and initial position in bytes that a looping sound will use as it plays.

Personally, I never use LOOP SOUND. I always use a small routine that checks the status of all my sounds at any given time, and I decide whether I want to loop it again or not, reduce the volume, increase the speed, etc...

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 9th Aug 2004 08:11
Don't put LOOP SOUND in your main loop(directly)! Put it in before your main loop and the sound will loop untill you tell it to stop.

-Ilya
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 9th Aug 2004 11:38
Yeah, I was using loop sound. Your right, I'm an idiot! Need to make a subroutine to check if the sound is playing, and if not, then play it again. Sweet!

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
Plastico
20
Years of Service
User Offline
Joined: 3rd May 2004
Location:
Posted: 9th Aug 2004 12:16
I did this initially, I tried to avoid the loop, since it still confuses me. (newbie luck of mine)



I love wait keys
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 9th Aug 2004 13:22 Edited at: 9th Aug 2004 13:24
I understand what he meant now. Don't know why I didn't get it sooner. Ok, when the sound needs to be played, do a gosub or create a function (or I suppose you could just do it in the code), that, when it needs to play the sound, you use
I guess. May be a little off in a few details, as I am at work right now and can't try it, but that is the general idea.

EDIT: Oops, fixed the code snippet. Had a 1 instead of a 0 for returnInt. That should work!

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
Plastico
20
Years of Service
User Offline
Joined: 3rd May 2004
Location:
Posted: 9th Aug 2004 13:30
that works much better actually.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Aug 2004 18:29
Maybe I was a little vague. You can use LOOP SOUND by itself, with no need to do anything else. Do this ONCE, not in a loop.

If you want more control, use the method I described, which is illustrated perfectly in Spaghetti's code.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply

Login to post a reply

Server time is: 2024-09-22 20:20:22
Your offset time is: 2024-09-22 20:20:22