Is it possible to set the the volume when playing a sound through an AudioStreamPlayer? The AudioStreamPlayer goes through a bus in a mixer, and is used for other sounds too, and I don’t want to their volumes to be affected. Here’s how I used to do this in Unity:
Thank you, but the volume is intended just for this playthrough of this particular sound, I might play need to play another sound using the same AudioStreamPlayer at another volume later, just like with PlayOneShot().
Then you change the AudioStreamPlayer.stream to point to the other sound and change its volume too with AudioStreamPlayer.volume_db before playing the other sound.
The problem with this approach is that it will cause any sound currently being played to also have its volume affected. I figured there was a similar solution like PlayOneShot() that I just couldn’t find - but perhaps there isn’t.
you can specifically make audiostreamplayer to play only a sound, but problem will be if somehow there need to play that exact sound many times in a single moment, it cant do that. So it really just need to make a new audiostreamplayer for each new sfx sound, queue_free it after it’s done playing
It’s possible to use one AudioStreamPlayer to play a single sound multiple times without cutting off the old one by setting AudioStreamPlayer.max_polyphony to a higher value than the default 1.