MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / UpdatePitch

Function UpdatePitch

pcsx2/SPU2/Mixer.cpp:237–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237static void __forceinline UpdatePitch(uint coreidx, uint voiceidx)
238{
239 V_Voice& vc(Cores[coreidx].Voices[voiceidx]);
240 s32 pitch;
241
242 // [Air] : re-ordered comparisons: Modulated is much more likely to be zero than voice,
243 // and so the way it was before it's have to check both voice and modulated values
244 // most of the time. Now it'll just check Modulated and short-circuit past the voice
245 // check (not that it amounts to much, but eh every little bit helps).
246 if ((vc.Modulated == 0) || (voiceidx == 0))
247 pitch = vc.Pitch;
248 else
249 pitch = std::clamp((vc.Pitch * (32768 + Cores[coreidx].Voices[voiceidx - 1].OutX)) >> 15, 0, 0x3fff);
250
251 pitch = std::min(pitch, 0x3FFF);
252 vc.SP += pitch;
253}
254
255static __forceinline void CalculateADSR(V_Core& thiscore, uint voiceidx)
256{

Callers 1

MixVoiceFunction · 0.85

Calls 2

clampFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected