S_ChangeSoundVolume negative volume

Bugs that have been investigated and resolved somehow.

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.
Post Reply
RaveYard
Posts: 186
Joined: Fri Apr 12, 2013 10:51 am

S_ChangeSoundVolume negative volume

Post by RaveYard »

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. :wink:
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: S_ChangeSoundVolume negative volume

Post by Rachael »

What are you doing to change it? There's already max checkers in place.
RaveYard
Posts: 186
Joined: Fri Apr 12, 2013 10:51 am

Re: S_ChangeSoundVolume negative volume

Post by RaveYard »

Actually, I'm using A_SoundVolume where the volume parameter is from a variable.

Code: Select all

	double soundVolume;
	double soundFadeSpeed;

Code: Select all

	soundVolume -= soundFadeSpeed;
	A_SoundVolume(CHAN_7, soundVolume);
But still, I really don't see any checks in the source code. Not in A_SoundVolume or S_ChangeSoundVolume or OpenALSoundRenderer::ChannelVolume. :(
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: S_ChangeSoundVolume negative volume

Post by Graf Zahl »

Yeah, this definitely needs checking.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: S_ChangeSoundVolume negative volume

Post by Nash »

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.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: S_ChangeSoundVolume negative volume

Post by Rachael »

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. :(
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.

Please include stuff like this in your reports in the future.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: S_ChangeSoundVolume negative volume

Post by Nash »

Is there a different effect if you did

Code: Select all

volume = clamp(volume, 0.0, 1.0);
 
instead? Just curious.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: S_ChangeSoundVolume negative volume

Post by Rachael »

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.
Post Reply

Return to “Closed Bugs [GZDoom]”