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.

DarkBASIC Professional Discussion / Check if User Plays the Whole Sound File

Author
Message
x_THOR_x
19
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 3rd Aug 2010 00:21
I have a sound file that starts when the user holds down the S key. If they release the S key the sound stops.



What I need is a 2nd sound file to play ONLY if the WHOLE 1st sound file is played. So if the user releases the S Key before the 1st sound file is done the 2nd sound file wont play.


(The 2nd sound file doesnt need the S key to be kept pressed in order to play, like the 1st sound file)


Any Help Please...
Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 3rd Aug 2010 00:37
try this?


it checks to see if the user let go using pause, as you can check if it is paused easy enough, if it is paused it then stops it and tells you its being stopped.
x_THOR_x
19
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 3rd Aug 2010 01:49
I keep getting "COMMAND LINE OUT OF PLACE AT LINE 308" error





What am I missing or doing wrong?
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Aug 2010 03:20
There's no endif in your snippit, try this...


My signature is NOT a moderator plaything! Stop changing it!
x_THOR_x
19
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 3rd Aug 2010 03:49
Thanks, it kinda works now, I just have to get the 2nd sound working somehow in the code. with Play Sound 2.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Aug 2010 10:55 Edited at: 3rd Aug 2010 10:58
Add a few global variables called "SOUND" "FIRSTSOUND" "LASTSOUND" then change your code to something like:


EDIT: I should read my code before posting sorry for the edits!

Interplanetary Funk
16
Years of Service
User Offline
Joined: 19th Apr 2010
Location: Ipswich, United Kingdom
Posted: 3rd Aug 2010 19:04
I had it return a value specially so you could. after you've put that function in try this:


where skeydown is the paremeter of wether the s key is down and _SOUND is the number of the sound you want to play.

Login to post a reply

Server time is: 2026-07-25 08:29:46
Your offset time is: 2026-07-25 08:29:46