S_ChangeSoundVolume negative volume

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: S_ChangeSoundVolume negative volume

Re: S_ChangeSoundVolume negative volume

by Rachael » Fri Nov 10, 2017 7: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.

Re: S_ChangeSoundVolume negative volume

by Nash » Fri Nov 10, 2017 7:29 am

Is there a different effect if you did

Code: Select all

volume = clamp(volume, 0.0, 1.0);
 
instead? Just curious.

Re: S_ChangeSoundVolume negative volume

by Rachael » Fri Nov 10, 2017 6: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.

Re: S_ChangeSoundVolume negative volume

by Nash » Fri Nov 10, 2017 3: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.

Re: S_ChangeSoundVolume negative volume

by Graf Zahl » Fri Nov 10, 2017 2:25 am

Yeah, this definitely needs checking.

Re: S_ChangeSoundVolume negative volume

by RaveYard » Fri Nov 10, 2017 1:52 am

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

Re: S_ChangeSoundVolume negative volume

by Rachael » Thu Nov 09, 2017 4:55 pm

What are you doing to change it? There's already max checkers in place.

S_ChangeSoundVolume negative volume

by RaveYard » Thu Nov 09, 2017 4: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:

Top