[Added] $PitchSet additional parameter: Randomization

Moderator: GZDoom Developers

$PitchSet additional parameter: Randomization

Postby Major Cooke » Tue Jul 28, 2020 4:47 pm

Pull Request

Adding a second float now turns it into a randomized pitch between those two values. If it's not specified, it defaults to 0, which means it'll use the first parameter always.

Here's a test example. Plug this into a sndinfo, then type "playsound Explo" a bunch of times to hear the results.
Code: Select allExpand view
Explo   dsbarexp
$pitchset Explo 0.5 1.25
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: $PitchSet additional parameter: Randomization

Postby Major Cooke » Wed Jul 29, 2020 10:37 am

Also I forgot to clarify what this solves.

1. While I could copy and paste definitions and simply rename them in SNDINFO, it's a waste and makes it look very messy. If I have 10 sounds used with 10 various settings of pitch in an attempt to 'maximize' the amount of pitch randomizing, I'll have to make 100 definitions.

2. Yes, there is A_StartSound's pitch parameter - I did indeed put it in, and I could use it. But I have customizable sound packs that I'd like to use in turn and the only way to properly use those is if I also replaced the actors for them, which I do not want to do, since they'll screw with people's ability to create addons (the replacing would be needed to give the pitch variables different ranges, even if the name is kept).

That or create an elaborate sound system which holds information either within a set of structs or arrays of objects to find the sounds, get the pitch range and use that - however I don't think that'll work because last I checked, I couldn't convert a name/string to a sound and vice versa. Whatever the case, it gets ugly really fast, and it's a waste of more resources because one has to traverse arrays/dictionaries to find the sounds. Not good.

-----

So that's what this solves: the need to spend extra time and the risk of a headache coming up with a nightmare-ish system which requires addon developers to create their own subsystem just to override the sound's pitch via ZScript.
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