-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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 AudioStreamPlayer3D
volume calculation for multiple viewports
#94613
base: master
Are you sure you want to change the base?
Conversation
83d3799
to
1c05833
Compare
AudioStreamPlayer3D
calculation for multiple viewportsAudioStreamPlayer3D
volume calculation for multiple viewports
@@ -359,6 +359,13 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() { | |||
cameras.insert(get_viewport()->get_camera_3d()); | |||
|
|||
PhysicsDirectSpaceState3D *space_state = PhysicsServer3D::get_singleton()->space_get_direct_state(world_3d->get_space()); | |||
Area3D *area = _get_overriding_area(); |
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.
Moved here to avoid calling _get_overriding_area
every loop iteration as it stays the same
@kus04e4ek I also want to ask about Audio Stream Player 3D. Sorry if this is off topic, but I asked in thematic communities and didn’t find an answer. If this possibility already exists, please let me know. |
You can also ask in the contributors chat, it's not really a place to ask general questions, but if no one gives you an an answer on the forum, you can ask there.
It should be possible on most platforms, currently Android, iOS and Web have no way to set the different device though.
Currently Godot doesn't provide functionality to use multiple audio devices at the same time. As it's currently not supported you should open a proposal. |
Went with a different solution from #76713, cause the position of the listener is important to compute the volume, so just adding
MAX
wouldn't work.Not quite sure if the solution I came up with is correct: always pick the listener with the biggest
db_att
and if there are multiple ones with the biggestdb_att
choose the one with the biggestmultiplier
among them. The biggestdb_att
is preferred to account for the emission angle, if the emission angle doesn't affect anything (listeners that are being compared are both out of the emission angle, they are both in the emission angle or there's no emission angle) or it affects only a little bit it basically chooses the closest listener. When comparingmultiplier
it just chooses the closest listener. There might be some edge cases when this doen't work (I thinkdb_att
might have less effect thanmultiplier
depending on the sound being played, somultiplier
should be preffered overdb_att
, I'm unsure how to fix something like this and if it's even possible to know for sure that this particular sound will cause issues).Fixes the comment style in
AudioStreamPlayer3D::_update_panning
(as this PR only changesAudioStreamPlayer3D::_update_panning
)