Similar to A_SoundVolume, but this would modify the pitch instead, and perhaps have slightly extended functionality.
My use case would be a chaingun where the spin rate can change based on user inputs, but not instantaneously; the spin rate would settle on a new speed over a brief period. This new function would then be used to constantly match the pitch of the looping electric motor sound effect with the visual spin rate. Doing this manually with the existing functions would be very cumbersome and laborous, I think.
Another, more common use case would be a car engine sound, where you would be constantly evaluating the engine revolutions, matching the pitch of the looping sound accordingly.
Probably a "nice to have" addition to this function would be pitch change interpolation, because the more the pitch instantly changes, the more noticable and jarring the change sounds. So perhaps as a function parameter, you could set the time period in tics or seconds, over which the change in pitch should complete? Or perhaps you could set a hard limit X for the pitch change rate, so that the pitch could not change by more than X per tic (or second).
Set pitch of a playing sound
Moderator: GZDoom Developers
Re: Set pitch of a playing sound
The pitch controlling functionality has been recently added.
The latter part of the request (interpolated pitch changes) probably still stands, though I have to test this new addition to find out if it's actually a necessary feature. But I assume attempting to manually interpolate pitch changes by dividing the change over a range of tics, and progressively modifying the pitch each tic (which should be the finest control possible for the modder), will still produce discernible "steps" in the heard pitch. And manually doing this between the individual tics isn't possible at all.
The latter part of the request (interpolated pitch changes) probably still stands, though I have to test this new addition to find out if it's actually a necessary feature. But I assume attempting to manually interpolate pitch changes by dividing the change over a range of tics, and progressively modifying the pitch each tic (which should be the finest control possible for the modder), will still produce discernible "steps" in the heard pitch. And manually doing this between the individual tics isn't possible at all.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Set pitch of a playing sound
Correct. You cannot adjust the pitch between tics. That's not going to be possible. Sorry.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Set pitch of a playing sound
This got added in the mean time.