Computer Science Canada

Require help with Checking to see if a sound file is active

Author:  Sharkbait [ Wed May 27, 2009 7:45 pm ]
Post subject:  Require help with Checking to see if a sound file is active

So i have this error message wav file, but my program lags if they hold down the incorrect button because the program starts playing the file again. Is there away to check if the file is active so that i can tell the program to not play it? or do i just have to set a timer, if so, how would i go about doing that?

Author:  DtY [ Wed May 27, 2009 9:38 pm ]
Post subject:  RE:Require help with Checking to see if a sound file is active

You can use a global variable to check:
Somewhere at the beginning:
var errorPlaying:boolean:=false
then when they do something to get an error:
if errorPlaying == false then
%Play sound
errorPlaying := true
end
Then when it's done:
errorPlaying := false

Author:  Sharkbait [ Wed May 27, 2009 9:53 pm ]
Post subject:  Re: Require help with Checking to see if a sound file is active

The Error message is not just a short beep, its like a sentence... and if they hold down the button they never get to hear it.
In addition, how do it tell a process to stop playing a file. I tried Music.PlayFileStop, but when i start up a new file the old one starts up too.

Author:  TheGuardian001 [ Wed May 27, 2009 10:02 pm ]
Post subject:  Re: Require help with Checking to see if a sound file is active

I believe Music.SoundOff is what you're looking for. If not, just create a blank sound file of the same type as the one you want to stop and play it.

Author:  Sharkbait [ Wed May 27, 2009 10:49 pm ]
Post subject:  Re: Require help with Checking to see if a sound file is active

I Have a process that plays a sound file.
In my procedure i tell it to fork because i need to play it while doing other stuff.
then i exit that procedure and i use Music.PlayFileStop at the end of the procedure

I then go into another procedure in which i use a different process to play a file, but when i do that the first file begins anew as well.

I'm not sure how a blank file will stop it from playing and Music.SoundOff did not work. Is there a better way then forking the process?

Author:  andrew. [ Thu May 28, 2009 7:16 am ]
Post subject:  Re: Require help with Checking to see if a sound file is active

Sharkbait @ Wed May 27, 2009 10:49 pm wrote:
I'm not sure how a blank file will stop it from playing and Music.SoundOff did not work. Is there a better way then forking the process?

1. Turing can only play one file at a time with the same file type (mp3, wav, midi) so when you have an mp3 playing and you play another, it cuts off the first one and plays the second.
2. I think there is a better way, but I can't find it right now. Look through the Turing help (F10 in Turing) at the "Music" commands.

Author:  Sharkbait [ Thu May 28, 2009 8:08 pm ]
Post subject:  Re: Require help with Checking to see if a sound file is active

Thanks for the help


: