
-----------------------------------
VB_User
Mon Apr 14, 2003 8:21 pm

Playing two sounds at once
-----------------------------------
Hey i am adding sound to my mortal kombat clone and i am having some trouble. I want it so that the background music is playing but there are also sound effects. I can only get on or the other to work. If anyone can tell me how to play two sounds at once that would be great.

Thanks alot

-----------------------------------
Blade
Mon Apr 14, 2003 8:49 pm


-----------------------------------
with a process... have the sound playing in the background then you can play other sounds as well
process bgmusic
loop
Music.PlayFile("themusic.mp3")
end loop
end bgmusic
fork bgmusic

-----------------------------------
jamez
Mon Apr 14, 2003 8:50 pm

asdf
-----------------------------------
i just fooled around with music.playfile and i dont think its possilbe :/

-----------------------------------
jamez
Mon Apr 14, 2003 8:50 pm


-----------------------------------
no blade, that doesnt work.  when it goes to play the SFX it stops playing the BGM.  test code before you post it :)

-----------------------------------
Blade
Mon Apr 14, 2003 9:36 pm


-----------------------------------
Details   The Turing 4.0.2 software can play files in the following audio formats: WAVE (.wav) files, MIDI files (.midi or .mid), and MP3 files (.mp3). In general, MIDI files are the most efficient and thus are the preferred form for longer music pieces like background music. WAVE files can record anything, not just music, so are often used for sound effects.
thats what it says in the help file... also, if you are running windows 98 you cant play more than one file at the same time... so try running a midi and an mp3 at the same time... dont accuse me for giving you false info, just because it isn't what you arent looking for.. jeez man

-----------------------------------
Asok
Mon Apr 14, 2003 9:39 pm


-----------------------------------
let me just say I have had much better experiences with Turing when using mp3s as opposed to midis. MIDIs seem to cause a lot more lag.

-----------------------------------
Blade
Mon Apr 14, 2003 9:44 pm


-----------------------------------
lol i dunno, i know with windows 98 you cant play more than 1 wav file at the same time... i think thats what his problem may be (i'm not sure about xp, some times it does, sometimes it doesnt)..

-----------------------------------
Asok
Mon Apr 14, 2003 9:46 pm


-----------------------------------
I'm not totally sure, but it also might be a sound card issue

-----------------------------------
jamez
Mon Apr 14, 2003 9:48 pm


-----------------------------------
shoudlnt be for me i can have kazaa playing music, winamp playing music, and DoD sfx playing all at once.  i think its just turing doesnt output more than 1 sounds at once.

-----------------------------------
Blade
Mon Apr 14, 2003 9:49 pm


-----------------------------------
i just did it with a midi!

-----------------------------------
Blade
Mon Apr 14, 2003 9:53 pm


-----------------------------------
could i see the code you are using for it.. it may help

-----------------------------------
VB_User
Mon Apr 14, 2003 10:20 pm


-----------------------------------
process liu
loop
Music.PlayFile("C:/Sprite/mk2deadpool.mid")
end loop
end liu



process BG
loop
Music.PlayFile("C:/Sprites/liu.wav")
end loop
end BG




fork liu
fork BG



thast my code. It will only play the liu.wav file and not the midi

-----------------------------------
Blade
Mon Apr 14, 2003 10:22 pm


-----------------------------------
i just tested that code with my midi, and wav, and it works fine...

-----------------------------------
Asok
Mon Apr 14, 2003 10:23 pm


-----------------------------------
found your error

look at your file path

one is in "Sprite" directory the other is in "Sprites" there is a typo with one of them so double check :)

-----------------------------------
VB_User
Tue Apr 15, 2003 4:12 pm


-----------------------------------
Ok now i have another problem. I made it so when you hit the left arrow key it plays the sound but it will only play the sound once. if i hit the key again it doesnt play.

-----------------------------------
Asok
Tue Apr 15, 2003 4:18 pm


-----------------------------------
again, showing your code would help. Please just post the code whenever you have a problem with the actual code, it saves a lot of frustration.

-----------------------------------
Blade
Tue Apr 15, 2003 4:43 pm


-----------------------------------
i'm assuming that your problem is not being able to play a file more than once... so i used this code to test it...
var anykey:string(1)
loop
getch(anykey)
if(anykey = "a")then
Music.PlayFile("c:/share/MegaMan2.wav")
end if
end loop
and it worked fine for me, the only thing with this is that you'll have to wait until the file is done being played for anything else to execute... like if you have
var anykey:string(1)
loop
getch(anykey)
if(anykey = "a")then
Music.PlayFile("c:/share/MegaMan2.wav")
put "it's now done playing"
end if
end loop
you will not see the its now done playing until, it has actually stopped playing the file

if you want it to be able to keep executing the program while its playing files, then you'll have to use a process

-----------------------------------
VB_User
Tue Apr 15, 2003 5:51 pm


-----------------------------------
Ya but i want it so that two sounds are playing and it plays more then once. Try doing that. It doesnt work for me.
