[Added] $PitchSet for SNDINFO

Moderator: GZDoom Developers

$PitchSet for SNDINFO

Postby Major Cooke » Thu Jul 23, 2020 1:51 pm

Pull Request

Sets the specific pitch for the direct logical sound. This only works for actual sound definitions.

One thing I found myself in need of recently is the ability to replace sounds, but they have different pitch elements which means A_StartSound will also need to be changed on the mod's side in order to reflect the update. AKA I'd have to replace the actor if I wanted to modify the sound's played pitch. And I'd rather not set up an elaborate system in ZScript as well that would act as a randomizer when this can suffice perfectly.

PitchSet overrides PitchShiftRange if the value > 0.0, and overridden by A_StartSound if the pitch parameter is > 0.0.

Example:
Code: Select allExpand view
Explo1   dsbarexp
Explo2   dsbarexp
Explo3   dsbarexp
Explo4   dsbarexp

$pitchset Explo1 1.25
$pitchset Explo2 1.5
$pitchset Explo3 0.75
$pitchset Explo4 0.5

$random Explo { Explo1 Explo2 Explo3 Explo4 }


When you enter 'playsound explo' in console, it'll randomize between the four different pitch-set explosion sounds and play them at their defined pitch settings.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: $PitchSet for SNDINFO

Postby Graf Zahl » Fri Jul 24, 2020 12:06 am

Normally I would have asked for a small demo but this looked simple enough to merge it as-is.
Yes, definitely a useful addition.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: $PitchSet for SNDINFO

Postby Major Cooke » Fri Jul 24, 2020 12:23 am

Awesome!

I had originally planned on a $pitchsetrange so people could reduce the amount of definitions if they wanted but I wasn't sure how good that would've worked out since it would involve a randomizer with a float, and I'm not quite certain how to deal with that on the C++ side.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: $PitchSet for SNDINFO

Postby Matt » Fri Jul 24, 2020 3:52 pm

If someone loaded something like the OP example, but also another SNDINFO after that that replaced Explo4 with another sound but didn't specify the pitch, that new sound will play at its original pitch, right?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: $PitchSet for SNDINFO

Postby Major Cooke » Fri Jul 24, 2020 4:39 pm

It follows the same rules as volume/pitch shift/limits.

If they reset when the sound is redefined, then so will PitchSet. If they don't, then it won't.

And I'd rather not change it from how it currently is because too many mods are reliant on their behavior.

$alias for certain will not adhere to anything but the original definition because that's all it is - a renaming, so it will use the original definitions volume/limits/pitch no matter what.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests