Page 1 of 1

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

PostPosted: Sat Dec 30, 2017 10:13 am
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.

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

PostPosted: Thu Jul 25, 2019 4:46 am
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

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

PostPosted: Thu Jul 25, 2019 9:44 am
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.