I investigated the issue a bit more by copying the grenade sounds from Wolfenstein: Blade of Agony and the definitions for the sounds from its SNDINFO lump, and then copying the entire SNDINFO lump from Wolfenstein: Blade of Agony into a small test mod, and disabling tags like $volume and $rolloff using sed. It turns out disabling $rolloff tags fixed the issue, and looking into the code, it seems as though the global rolloff was always being changed, or that rolloff was picking up a garbage pointer.
Fixes#1849
Due to C++ conversion rules this was a bit too volatile. There's really not enough places where being able to pass a string directly into the sound API was beneficial - the two most frequent functions now got overloaded variants.
This works similar to MAPINFO: The first definition in a file declares the format, all later ones must be the same.
This change in syntax increases robustness significantly because it avoids the problems with the original syntax not being able to detect badly formatted names.
This solves two problems:
* The linked list is too slow, a map is better. A map cannot be used with statically allocated CVARs because order of initialization is undefined.
* The current CVAR system is an unordered mishmash of static variables and dynamically allocated ones and the means of identification are unsafe. With this everything is allocated on the heap so it can all be handled the same by the cleanup code.
Mainly to avoid problems with Raze, but eliminating this constructor lets us catch erroneous local definitions via 'auto', which can cause major problems if left undetected.
- Just set init for SoundClass to empty.
- Removed code block from SetActorProperty for APROP_Soundclass that does nothing
- Lower-cased soundclass in FSerializer
- Created a new const char to read the player's soundclass. If the playerpawn returns NAME_None for it's default, then it will set defaultsoundclass to "player". After running the skin code, the function now returns defaultsoundclass or soundclass, depending if soundclass is empty or not.
- Renamed GetSoundClass to S_GetSoundClass
- SoundClass is instantiated to "" by default. Since this property is only used when it is not empty (otherwise GetSoundClass just defaults to player), we can get away with this.
- We may want the soundclass to remain the same if we explicitly set it to the same one that is currently used (say, we set SoundClass to "Caleb" so all other skins can use it)
- GetActorProperty for APROP_SoundClass just calls GetSoundClass,
- CheckActorProperty also just runs GetSoundClass
- GetSoundClass is no longer a static method. We needed to access it in other places.
- Made renovations to GetSoundClass. First of all, SoundClass is no longer instantiated there. Secondly, skinned sounds are now returned if SoundClass is empty. Thirdly, "sclass" in this method will return the default soundclass of the player pawn or SoundClass, depending on if SoundClass is empty. Finally, sclass will retrieve "player" if it is empty.
- I couldn't simply init SoundClass to NAME_SoundClass, even after converting it to the appropriate type. Probably because NAME_SoundClass hasn't been parsed from decorate yet. Instead, I change it to NAME_SoundClass through GetSoundClass if it's valid and currently "player".
- The skin checker code in GetSoundClass now checks if the SoundClass is equal to NAME_SoundClass. This mechanism exists so that way reverting the SoundClass to NAME_SoundClass processes the skin soundclass code. If it's different, the code is not processed.
- Just returns sclass. This is never null, so there's no need to check if so.
- S_FindSkinnedSound just uses GetSoundClass. This makes sure skins are checked.
- Gave default init value to SoundClass as "Player"
- Changed SoundClass detection to use the if/else structure
- Checked for null pointer in S_FindSkinnedSound when reading the player's sound class
The real issue is that the number of unattenuated sounds was unchecked and the near limit never kicked in.
To do this properly it is necessary to adjust the limit distance by the attenuation - zero attenuation must mean infinite distance and for high attenuations the distance must be lowered for limiting to work as intended.
The limit for the Doom boss sounds was increased to 4 to compensate for this change.
# Conflicts:
# src/common/audio/sound/oalsound.cpp
It's possible for an actor to call Destroy() in a ZScript method (such
as Tick()) and then subsequently call A_StartSound() to play a sound.
Generally speaking this doesn't happen within a given class, but with a
class hierarchy, Destroy() may be called unbeknownst to a mod developer.
Even though checking bDestroyed is likely good practice, this ensures
that sounds won't be started on actors flagged for cleanup.
- Sets the direct pitch of the sound to the specific float. Default is 0.0, meaning do not set a specific pitch. Regular pitch is 1.0.
- Only works for direct sound definitions.
- Overrides $PitchShift unless value is <= 0.0
- Overridden by A_StartSound's pitch parameter if the value > 0.0.
src/sound/s_advsound.cpp:953:9: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
src/sound/s_advsound.cpp:1264:20: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
src/sound/s_advsound.cpp:1426:6: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]