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

Username:   Password: 
 RegisterRegister   
 How do i play a sound when there is a music on going??
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
8749236




PostPosted: Sat May 28, 2011 7:01 pm   Post subject: How do i play a sound when there is a music on going??

What is it you are trying to achieve?
i'm trying to play another sound without stop the sound that didn't finished..


What is the problem you are having?
Don't know how to do


Describe what you have tried to solve this problem
tried use process, procedure, PlayFile and PlayFileLoop..


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


process test
    Music.PlayFileLoop ("Sounds/BGM.wav")
end test
fork test        % this used to run the music
Music.PlayFile ("Sounds/anysound.wav")           % this run anysound



Please specify what version of Turing you are using
Turing 4.1
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Sat May 28, 2011 7:28 pm   Post subject: RE:How do i play a sound when there is a music on going??

Read the docs.

Quote:

Details On the PC, different formats of music can play simultaneously. This means that a program might use a MIDI file as a background soundtrack and then use WAVE files for individual sound effects. The sound effects would not interfere with the background music. Playing a second music file with the same format as an already playing piece immediately halts the first piece and starts the second. This can be used to stop a single type of music by playing a short silent piece of music.


In other words. Turing sucks. To get around it, use a different filetype for SFX and BGM. Eg: Mp3 for BGM and Wav for SFX.
8749236




PostPosted: Sat May 28, 2011 7:37 pm   Post subject: RE:How do i play a sound when there is a music on going??

>.<
Thank you, i found out a new way..

process test
Music.PlayFileLoop ("Distant Avalon.wav")
end test
fork test
delay (1)
put "a"
Music.PlayFileReturn ("Sanguineous Soul.wav")
delay(100)

the sound won't stop playing, but when second sound playing, it will cut down the first one, after it finished, first one keep playing until it is finished..
Zren




PostPosted: Sat May 28, 2011 7:49 pm   Post subject: RE:How do i play a sound when there is a music on going??

Use a different filetype. Eg:

Turing:


var chars, lastChars : array char of boolean
Input.KeyDown (chars)

fcn keyDown (c : char) : boolean
    result chars (c) and ~lastChars (c)
end keyDown

process playSound (filename : string)
    Music.PlayFile (filename)
end playSound

fork playSound ("Silkie - Planet X [HQ].mp3")
loop
    lastChars := chars
    Input.KeyDown (chars)
    if keyDown ('s') then
        fork playSound ("firework_9.wav")
    end if
end loop
8749236




PostPosted: Wed Jun 01, 2011 4:14 pm   Post subject: RE:How do i play a sound when there is a music on going??

tried, works well.. thank u : )
copthesaint




PostPosted: Thu Jun 02, 2011 12:16 am   Post subject: Re: How do i play a sound when there is a music on going??

If you need to use multiple music files, you can use this program I made a long time ago Razz. http://compsci.ca/v3/download.php?id=6631

*500*
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  [ 6 Posts ]
Jump to:   


Style:  
Search: