Audio random containers does not play new sound if previous sound isn't done playing. Possible workarounds?

  • #1, by nikolaj-de-haanSunday, 30. August 2020, 18:48 3 years ago
    I'm using the audio random containers for several sounds in a game, e.g. gun shots. But I have a problem with the sounds not playing if the previous sound is still playing.

    So if the "tail" of a gun sound is playing and I shoot again, I hear no sound. Is there a workaround for this?

    Thank you! smile

    Newbie

    33 Posts


  • #2, by afrlmeSunday, 30. August 2020, 19:18 3 years ago
    Do you have the mode set to step? If that's not working have you tried using the fade sound container in/out action part to fade out the container first before calling it again?

    Alternatively you could achieve the same thing with action parts

    set random value "some random value" between 1 and 5
    if value "some random value" = 1
     play sound "example_1.ogg"
    elseif value "some random value = 2
     play sound "example_2.ogg"
    ...
    end if

    or even via Lua script...

    local sndz = {
    
     "vispath:sounds/example_1.ogg",
    
     "vispath:sounds/example_2.ogg"
    
    }
    
    
    
    startSound( sndz[math.random(#sndz)] )

    Imperator

    7278 Posts