S_ChangeSoundVolume has no sanity check for volume specified, thus having negative values leads to OpenAL errors which left me confused for few days.
Some sort of warning or "max(volume, 0)", would be really neat.
S_ChangeSoundVolume negative volume
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Re: S_ChangeSoundVolume negative volume
What are you doing to change it? There's already max checkers in place.
Re: S_ChangeSoundVolume negative volume
Actually, I'm using A_SoundVolume where the volume parameter is from a variable.
But still, I really don't see any checks in the source code. Not in A_SoundVolume or S_ChangeSoundVolume or OpenALSoundRenderer::ChannelVolume.
Code: Select all
double soundVolume;
double soundFadeSpeed;
Code: Select all
soundVolume -= soundFadeSpeed;
A_SoundVolume(CHAN_7, soundVolume);
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: S_ChangeSoundVolume negative volume
Yeah, this definitely needs checking.
Re: S_ChangeSoundVolume negative volume
This problem has been around since forever, BTW - even before ZScript existed. I always ran into this when doing sound stuff through ACS if I incorrectly calculated the volume to play.
Re: S_ChangeSoundVolume negative volume
I absolutely cannot stress enough the utter importance of specific information like this in bug reports! I figured that the modding functions might be the case but if I had the actual function names like this, I could have gone through it a whole lot quicker. If I had a sample of DECORATE code already prepared that abuses this function - it would have gone yet even quicker than that.RaveYard wrote:But still, I really don't see any checks in the source code. Not in A_SoundVolume or S_ChangeSoundVolume or OpenALSoundRenderer::ChannelVolume.
Please include stuff like this in your reports in the future.
Re: S_ChangeSoundVolume negative volume
Is there a different effect if you did
instead? Just curious.
Code: Select all
volume = clamp(volume, 0.0, 1.0);
Re: S_ChangeSoundVolume negative volume
Yeah it would mean that the "clamp" function would actually have to be defined somewhere.
I could have easily done it that way - but not knowing whether or not it was available, I figured it was easier and less time consuming for me to just do it manually.
I could have easily done it that way - but not knowing whether or not it was available, I figured it was easier and less time consuming for me to just do it manually.