コード例 #1
0
        private void UpdateLaserEffects()
        {
            if (!AreLasersActive)
            {
                // mute both channels always if no lasers are active
                m_audioController.SetEffectMix(6, 0);
                m_audioController.SetEffectMix(7, 0);
            }
            else
            {
                // Update active laser positions for both lasers if either is active
                currentActiveLaserAlphas[0] = currentActiveLasers[0] ? LaserAlpha(0) : 0;
                currentActiveLaserAlphas[1] = currentActiveLasers[1] ? LaserAlpha(1) : 0;

                float alpha;
                if (currentActiveLasers[0] && currentActiveLasers[1])
                {
                    alpha = Math.Max(currentActiveLaserAlphas[0], currentActiveLaserAlphas[1]);
                }
                else if (currentActiveLasers[0])
                {
                    alpha = currentActiveLaserAlphas[0];
                }
                else
                {
                    alpha = currentActiveLaserAlphas[1];
                }

                m_audioController.UpdateEffect(6, CurrentQuarterNodeDuration, alpha);
                m_audioController.SetEffectMix(6, GetEffectMix(currentLaserEffectDef, laserGain, alpha));
            }

            float LaserAlpha(int index) => GetTempRollValue(m_audio.Position, index + 6, out float _, index == 1);
コード例 #2
0
        private void UpdateLaserEffects()
        {
            if (!AreLasersActive)
            {
                m_audioController.SetEffectMix(6, 0);
                return;
            }

            float LaserAlpha(int index)
            {
                return(GetTempRollValue(m_audio.Position, index + 6, out float _, index == 1));
            }

            if (currentActiveLasers[0])
            {
                currentActiveLaserAlphas[0] = LaserAlpha(0);
            }
            if (currentActiveLasers[1])
            {
                currentActiveLaserAlphas[1] = LaserAlpha(1);
            }

            float alpha;

            if (currentActiveLasers[0] && currentActiveLasers[1])
            {
                alpha = Math.Max(currentActiveLaserAlphas[0], currentActiveLaserAlphas[1]);
            }
            else if (currentActiveLasers[0])
            {
                alpha = currentActiveLaserAlphas[0];
            }
            else
            {
                alpha = currentActiveLaserAlphas[1];
            }

            m_audioController.UpdateEffect(6, CurrentQuarterNodeDuration, alpha);

            float mix = laserGain;

            if (currentLaserEffectDef != null)
            {
                if (currentLaserEffectDef.Type == EffectType.PeakingFilter)
                {
                    mix *= BASE_LASER_MIX;
                    if (alpha < 0.1f)
                    {
                        mix *= alpha / 0.1f;
                    }
                    else if (alpha > 0.8f)
                    {
                        mix *= 1 - (alpha - 0.8f) / 0.2f;
                    }
                }
                else
                {
                    switch (currentLaserEffectDef.Type)
                    {
                    case EffectType.Gate:
                    case EffectType.Retrigger:
                    case EffectType.TapeStop:
                        mix = 1.0f;
                        break;

                    case EffectType.HighPassFilter:
                    case EffectType.LowPassFilter:
                        break;
                    }
                }
            }

            m_audioController.SetEffectMix(6, mix);
        }