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

Username:   Password: 
 RegisterRegister   
 Music.SoundOff not working
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cutecotton




PostPosted: Sun Jan 19, 2003 12:22 pm   Post subject: Music.SoundOff not working

hi everyone, i have a process for my msuic which i need to put into my prgraom. so i forkedit ina nd it works, but i need it so that when the user clicks a button (which will lead to antoher screen), the music will turn off.

So i put in a Music.SoundOff buti t keeps on playing hte song anyways. Any idea what's up with that? also, i have some sound effects files, like when the user types a word there will be a litlte sound, whenever that sound plays, the main song restarts itself after. Dotn' watn that happening...any ideas how to fix it?

Also (kind aoff topic) but i need to make a timer..like the user has 30 seconds to type this word..i've tired clock and wallclock bu ti dotn' seemt o get it working..how do i make a countdown?

tks again 4 ur helkp
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Jan 19, 2003 1:25 pm   Post subject: (No subject)

for the music.soundoff... if your process has a loop then it might restart the song even after you turn it off. You gotta be careful about that.

As for individual sounds, I think if you play some notes instead of loading another music file, it might not interfeir with the backgound music, but I'm not sure on that.

code:
var timeStart, timeNow : int
var c:string
var timePassed:boolean := false

process T()
wallclock(timeStart)
loop
delay(1000)
wallclock(timeNow)
locate(1,1)
put 10 - (timeNow - timeStart)

exit when timeNow - timeStart >10
end loop
timePassed:=true
put "time's up!"
end T

fork T
get c
put c


here's a working example of timer that counts down for 10 seconds then displays "time's up" while the user can type something... the only problem is that locate keeps on moving coursor, so for this to work properly you need to use getch() with a counter of how many characters were typed for proper output. It will get tricky once you want to use backspace Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
cutecotton




PostPosted: Sun Jan 19, 2003 10:08 pm   Post subject: (No subject)

hmm yeah i think teh msuic thing is cuz of the loop...pretty sure if i take it out of the loop it'll work. But see waht i don't know is wehther it'll make the song restart everytim ei load a Music.PlayFile

Cuz right now i have it so taht when teh user types an error, a Music.PlayFile will play (liek a beep), but i thought my song woudl be able to play over it to. Since it is possible to have 2 songs playing at once right?

not too sure if i watn to ues the note, that'll be last thing to do lol cuz i love my sound effects toomuch.

Tks 4 the timer thing, i read through teh coding...and just wondering, what does a "boolean" do?
Tony




PostPosted: Sun Jan 19, 2003 10:51 pm   Post subject: (No subject)

boolean doesn't realy do anything in this example... it just cahnges to "True" once the time runs out... you can use it with Ifs or something.

I'm not sure about mixing sounds together... to be honest I never used sound in my programs
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: