Audio loops: cant make them start and stop

0 favourites
  • 2 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)