-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fixed "Memory leak and crash when falling asleep with a radio on #32968" #33297
Fixed "Memory leak and crash when falling asleep with a radio on #32968" #33297
Conversation
Maybe we should make channel enum to get rid of all these magic numbers? |
Moved `outdoor_blizzard` closer to other `outdoor` sounds. Added missing check for "Outdoor blizzard" in `sfx::do_ambient`. Added check "is channel playing" inside of `play_ambient_variant_sound`. May not be necessary, leads to double checks. Just to be sure? Fixed playing `radio`/`chatter` as `play_ambient_variant_sound`.
…annel). Reordered `danger` channels. Fixed `init_sound` groups assignment. Avoid pitching a sound when it is not required: like when only angle is set, but no pitch. Changed default pitch to -1.0 (as `not pitch`). Probably make steps for pitch and cache picthed sound effects for optimization?. Added error handling in `play sound` functions. Added loops parameter to `play_ambient_variant_sound` function. Added `stop_sound_effect_timed` to stop sound effect after a given time. Altered active radio "choose what to play" algorithm. Some chance to play static or chatter, but only once (should not be annoying).
UPDATE: Added enums for channels & groups of sound effects. |
Found an issue with "@" soundpack on my system:
The last file
Probably related: |
Summary
SUMMARY: Bugfixes "Memory leak and crash when falling asleep with a radio on #32968"
Purpose of change
Fixes #32968
Describe the solution
Fixed by checking if the
radio
channel (number 21) is already playing something.Assumed that a single channel should not be spammed with more sound.
UPDATE: found
Channel assignments
insfx::do_ambient
.Describe alternatives you've considered
Check other usage of this channel.
Check other channels too.
Check
sdlsound.cpp
: if the memory allocated for a sound is always released?Additional context
UPDATE:
Allocating memory in
do_pitch_shift
, using in:play_variant_sound
play_variant_sound_pitch
play_ambient_variant_sound
Should be freed after the channel is finished.
play_ambient_variant_sound
is relatively safe, since it has achannel
parameter. So this channel could be checked before playing the sound.The other two functions has
angle
, but notchannel
. So the sound will be played on first available channel.Suggestion:
channel
to two other functions.