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

Username:   Password: 
 RegisterRegister   
 Require help with Checking to see if a sound file is active
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sharkbait




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: 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
Sharkbait




PostPosted: 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.
TheGuardian001




PostPosted: 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.
Sharkbait




PostPosted: 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?
andrew.




PostPosted: 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.
Sharkbait




PostPosted: 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
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  [ 7 Posts ]
Jump to:   


Style:  
Search: