Howdy everyone,
I was about to create the audio environment for a game.
In order to do so, I wanted to script it, because it allows for more and better control of the sound.
So what I did was, Setup the node:
Then I loaded some sounds and linked the buses,
Till now, it works. you click play, and it plays, no problem. Now we link it with the animations,
now, when we play the game. and play the animation. we hear a gun shot, awesome.
Now i reach the point to script the sound for better control.
func soundplayer(node):
var audio = node.get_node('Skeleton/AudioStreamPlayer2D')
var reverb = AudioServer.get_bus_effect(1, 0)
var play_time = audio.get_playback_position()
print(audio, " ", reverb)
print(AudioServer.get_bus_volume_db(1), " <1 -- 0> ", AudioServer.get_bus_volume_db(0))
if audio:
if play_time != 0:
print(play_time)
else:
print("no audio stream")
We call it every frame,
soundplayer($Player)
And the result is surprising.
AudioStreamPlayer2D:<AudioStreamPlayer2D#54274296405> <AudioEffectReverb#-9223372014037761388>
-0.52601301670074 <1 -- 0> -1.91699004173279
This output is consistent, nothing changes whatsoever, doesn't matter which kind of sound is played.
Whereof I, AT LEAST, expected the audioserver's volume to change. which it didn't
Yet the busses work, the reverb effect alters the sounds played.
But GDScript doesn't seem to "work"
Am I facing a bug?
The editor is running in Compatability.