Exemple #1
0
        /// <param name="random">This parameter will be mutated. Be aware of network-safety!</param>
        public float SelectPitch(XorShift random)
        {
            // Pitch variance:
            var cuePitch = pitch;

            if (minPitch.HasValue && maxPitch.HasValue)
            {
                // NOTE: This is wrong because it is non-linear. But I can't be bothered fixing it at this point. -AR
                var   p           = 1 + cuePitch; // XNA normalizes on 0.0
                var   min         = p * minPitch.GetValueOrDefault();
                var   max         = p * maxPitch.GetValueOrDefault();
                float randomValue = random._NetworkUnsafe_UseMeForAudioOnly_NextSingle();
                MathHelper.Lerp(min, max, randomValue);
                cuePitch = pitch - 1;
            }

            return(cuePitch);
        }