Play sounds in a forced pitch (e.g. A_PlaySoundPitched)

Moderator: GZDoom Developers

Post Reply
XxMiltenXx
Posts: 219
Joined: Wed Jan 08, 2014 8:40 am
Graphics Processor: nVidia with Vulkan support
Location: Germany

Play sounds in a forced pitch (e.g. A_PlaySoundPitched)

Post by XxMiltenXx »

Well, as the title says, I'd like a function where you can specify and force the pitch the sound is played at. Not a fancy way, just changing the sample rate as ZDoom already does.

Maybe it could be done as an extension to the original A_PlaySound:

A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 1.0, bool randompitch = true);

So a pitch of 0.5 would half the sample rate, and randompitch determines whether the random pitching (if enabled and set in SNDINFO) should still be factored in on top of it.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Play sounds in a forced pitch (e.g. A_PlaySoundPitched)

Post by Blue Shadow »

A_PlaySound has been extended with a pitch parameter. A setter function has also been added.
https://github.com/coelckers/gzdoom/com ... 22c2eda5e8
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Play sounds in a forced pitch (e.g. A_PlaySoundPitched)

Post by Major Cooke »

As well as a starting pitch for A_PlaySound directly, too.

I shouldn't have to say this but some people asked me about A_PlaySoundEx, and failed to realized it's deprecated: No. Never. Deprecated means it's no longer going to be updated. End of story. Use A_PlaySound instead.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”