[Fixed] S_ChangeSoundVolume negative volume

Bugs that have been investigated and resolved somehow.

Moderators: Developers, ZDoom.org Team

S_ChangeSoundVolume negative volume

Postby RaveYard » Thu Nov 09, 2017 5:45 pm

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:
RaveYard
 
Joined: 12 Apr 2013

Re: S_ChangeSoundVolume negative volume

Postby Rachael » Thu Nov 09, 2017 5:55 pm

What are you doing to change it? There's already max checkers in place.
User avatar
Rachael
Not all elves needs a stocking hat...
 
Joined: 13 Jan 2004

Re: S_ChangeSoundVolume negative volume

Postby RaveYard » Fri Nov 10, 2017 2:52 am

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

Code: Select allExpand view
   double soundVolume;
   double soundFadeSpeed;

Code: Select allExpand view
   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. :(
RaveYard
 
Joined: 12 Apr 2013

Re: S_ChangeSoundVolume negative volume

Postby Graf Zahl » Fri Nov 10, 2017 3:25 am

Yeah, this definitely needs checking.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: S_ChangeSoundVolume negative volume

Postby Nash » Fri Nov 10, 2017 4:10 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: S_ChangeSoundVolume negative volume

Postby Rachael » Fri Nov 10, 2017 7:59 am

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
Rachael
Not all elves needs a stocking hat...
 
Joined: 13 Jan 2004

Re: S_ChangeSoundVolume negative volume

Postby Nash » Fri Nov 10, 2017 8:29 am

Is there a different effect if you did

Code: Select allExpand view

volume 
clamp(volume0.01.0);
 


instead? Just curious.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: S_ChangeSoundVolume negative volume

Postby Rachael » Fri Nov 10, 2017 8:31 am

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.
User avatar
Rachael
Not all elves needs a stocking hat...
 
Joined: 13 Jan 2004


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest