Audio loops: cant make them start and stop

Get help using Construct 2

Post » Fri Sep 20, 2013 11:32 am

Hello everyone.

While working on a fun project I noticed my experience with auido is limited. I just couldn't do what I describe below. I checked audio manual entry and some tutorials and forum posts, but still keep failing. Would like to ask for your help, ladies and gentlemen...

Here is what I want to do. I have a variable that changes during gameplay from 0 to 4. I have a loop playing in the background, it's fine. Now while the variable is 1, I want to ad another looping sound on top of it... and if the variable is 2, I want to play yet another loop on top of the previous tiers, and if the variable is 3, yet one more loop to add. And when the variable drops back to 2, the top two layers will stop.

variable=0 only "background" sound playing
variable=1 "background" + "eerieloop"
variable=2 "background" + "eerieloop" + "windloop"
variable=3 "background" + "eerieloop" + "windloop" + "rainloop"
variable=4 "background" + "eerieloop" + "windloop" + "rainloop" + "screamsloop"

I tried this:

variable=1
trigger once while true --> play "eerieloop" looping

but it doesn't start to play.

Then I tried addinga global var "previous_variable" and checking each tick for "varieble=1 & previous_variable=0" and play if true, and yet failed again. It just doesn't start playing.

Using chrome, C2 ver 142. All sounds are ogg only. I deleted the wav and the other ones.

Any ideas on how I should aproach this?
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Fri Sep 20, 2013 2:53 pm

This is a limitation of audio streaming. Only one track from the music folder can be played at a time because it streams from the server. Place your music files into the sounds folder and you play multiples. But this means you need to change things a little. You will need to preload these audio files or there will likely be a delay before they play as they must be fully downloaded before they'll play.

Also, when doing layering audio, you're going to want to use the "seek to" action at times to make sure the audio is lined up. You can seek the audio to the playback position of another file, which I believe is documented in the manual.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 38 guests