-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AudioStreamRandomizer.random_volume_offset_db
not working
#82478
Fix AudioStreamRandomizer.random_volume_offset_db
not working
#82478
Conversation
|
e971842
to
7299ac0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just a naming suggestion. I feel kind of silly that I didn't hook that up originally but I'm glad someone noticed and fixed it 😅
Couldn't we just apply the volume shift here[1]? Leave the code that sets it where it is and just multiply the values returned by [1] https://github.com/godotengine/godot/blob/master/servers/audio/audio_stream.cpp#L811C3-L811C3 |
I tried, it didn't work out. The output sound is glitch. |
7299ac0
to
57a300c
Compare
57a300c
to
dc35c9d
Compare
Just to confirm, what I was suggesting it to save the value of |
@ellenhp Sorry for my misunderstanding and thank you for your suggestion.
And regarding special-case the randomizer stream, I do agree we should try our best to avoid |
Ah! Okay, I see now. Can you try doing something more like this:
The mix function returns an integer representing the number of samples it actually mixed into the provided buffer, and the samples themselves are written directly to the array provided in |
Tested locally, it worked! |
dc35c9d
to
34eba41
Compare
AudioStreamRandomizer.random_volume_offset_db
not working
Thanks! |
Fixes #82469
Note:I did not quite obey the rule of OOP here but I think it's fine. Add a dedicated virtual method for getting the volume seems a little overkill.