0 votes

TL;DR - I want to enable a reverb effect when my player is underground but not effect any currently playing sounds.

I have a simple platformer and sometimes the player goes underground. So when the player's Y position is at the right place I do the following

AudioServer.set_bus_effect_enabled(bus_effects, 0, true)

This works pretty good. The issue is if my player makes a sound while on one side of the position check, then goes to the other side, the effect is changed mid way through. So, for example, if my player jumps while inside the cave, but lands outside, the echo of the jump gets cut off and it sounds weird. I did Find this question but in testing this method out I found that the reported volume levels when an effect wasn't playing were not always -200. In fact, they weren't always even the same value. So I don't think that's reliable way of checking if a sound is playing. Any thoughts would be greatly appreciated.

Thanks All!!

in Engine by (21 points)

if my player jumps while inside the cave, but lands outside, the echo of the jump gets cut off and it sounds weird.

Can you make the sound hold until the player character is outside of the cave? Until the player is outside the cave, have the echo sound effect in place.

That's what I would like to do. Now, once the player leaves the cave area, the effect is turned off, but that change is applied in real time, so any sounds still playing now have the effect removed, and it works in reverse too. making a sound outside the cave area starts without an echo, but once you cross into the cave, the echo is applied. After more thinking about it all day, I'm wondering if i can maybe poll all the AudioStreamPlayer2D nodes to see if they are playing, and if so, don't apply the effect until they are all stopped.

1 Answer

0 votes

OK, got it working. If anyone knows a better way please let me know.
I simply created a separate bus for the echo effect and piped it through the main effects bus so that my volume control code didn't have to be redone. I did have to rewrite how I play effect by adding a simple check to see if I'm underground, but that wasn't too hard. Now, when i jump outside a cave, the sound plays through the normal bus and if I go into the cave and play a sound the new sound goes over the echo bus, so both can play at the same time without one effect or the other canceling the other out. I'm pretty happy with the results.

by (21 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.