Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 playing gun shot sounds repeately
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
omni




PostPosted: Sun May 02, 2004 6:15 pm   Post subject: playing gun shot sounds repeately

Gun shot sounds are driving me crazy.
ex:
process gunshot
Music.PlayFile("gunshot.wav")
end gunshot
loop
if userpressedshoot then
fork gunshot
end if
end loop

The problem with this is that every time the user shoots, the gunshot.wav is repeately starting over and over and can never finish playing. Any ideas how to play gun shot noises like Counter-Strike does?
Sponsor
Sponsor
Sponsor
sponsor
GreenTiger




PostPosted: Sun May 02, 2004 7:18 pm   Post subject: (No subject)

You've got to have a delay of some kind or another. One that stop the user from firing too quickly. If you want them to be able to fire at a certain speed, then start from there and set that delay, then modify your sound to fit.
If you want the sound to fit the game, time the length of the sound with an editor of some kind and set the delay to be that long.
Mazer




PostPosted: Mon May 03, 2004 4:43 am   Post subject: (No subject)

A delay might help but it won't completely solve the problem. As stated many times before, turing can only play one sound of each type (ie, one wav, one mp3, one [whatever that other thing is]). So, if you're shooting, every time it gets to the line "Music.PlayFile("gunshot.wav")" turing stops whatever wav file may already be playing and starts to play the file you just told it to.
omni




PostPosted: Mon May 03, 2004 2:30 pm   Post subject: (No subject)

so theres NO good solution to this problem?
GRR...
GreenTiger




PostPosted: Mon May 03, 2004 8:57 pm   Post subject: (No subject)

Yeah, you CANNOT have two gunshots at the same time. You CAN settle for having a long enough delay to make sure the gunshot sounds CAN'T sound over each other.

And that IS a good solution.

Basically change your sound file to fit a certain delay or change your delay to fit a certain length.

So kinda like what I said the first time around.

However, there will be NO way for enemies to also have their guns fire...
gamer




PostPosted: Tue May 04, 2004 12:57 pm   Post subject: (No subject)

that sucks then......but im sure theres a better way
Paul




PostPosted: Tue May 04, 2004 1:47 pm   Post subject: (No subject)

Maybe shorten the sound and make sure you don't have a bunch of inputs stacked up in the buffer. (does mouse work that way?)
white_dragon




PostPosted: Tue May 04, 2004 2:07 pm   Post subject: (No subject)

just use a music program to merge da two gun shots goin of at da same time. it should work. or like paul said, make the sound shorter....
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: