Fix bug in AudioStreamPlaybackPolyphonic where stream IDs returned from play_stream
may not work (MSVC)
#86054
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Intended to fix this bug: #86053
The docs state that invoking
play_stream
on an instance ofAudioStreamPlaybackPolyphonic
returns an integer ID that can be used to control the volume or stop playback of a given stream, but in GDScript none of these IDs work.While debugging I noticed that the _find_stream method seems to have platform-dependent behavior because an implicitly typed enum value is used as a bitmask. This line here appears to be the problem:
godot/scene/resources/audio_stream_polyphonic.cpp
Line 228 in 6882e50
The usage here seems to be casting ID_MASK undesirably on my system; the result of
p_id & ID_MASK
is always exactly equal to p_id. My guess is that MSVC is reading 0xFFFFFFFF as -1 and then casting that up to an int64_t also with the value of -1. Added an explicit type to the enum that should remove this ambiguity.My compiler version is: Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x64
Bugsquad edit: