예제 #1
0
    void Awake()
    {
        GeneralVariables.spawnController = this;
        GeneralVariables.uiController.Awake();

        specCamTr = spectatorCamera.transform;

        uiCam             = uiCamera.GetComponent <UICamera>();
        specCamSway       = spectatorCamera.GetComponent <GUISway>();
        distortTransition = spectatorCamera.GetComponent <DistortionEffect>();

        GameObject specRoot = GameObject.FindGameObjectWithTag("SpectatorRoot");

        if (specRoot != null)
        {
            spectatorRoot = specRoot.transform;

            spectatorPositions = new List <Transform>();
            foreach (Transform t in spectatorRoot)
            {
                spectatorPositions.Add(t);
            }

            specIndex = UnityEngine.Random.Range(0, spectatorPositions.Count);
        }

        myAvailableTeamList = new List <Transform>();
        blackSprite.alpha   = 1f;
        FadeInOut(true, 0.7f);
        isTransitioning = false;
        distortTransition.baseIntensity = 0f;
        distortTransition.enabled       = false;
        autoSpectate      = true;
        autoSpectateTimer = Time.time;
    }
예제 #2
0
        private void applyEffectButton_Click(object sender, EventArgs e)
        {
            AudioEffect effect;

            var fs = _signal.SamplingRate;

            var winSize = int.Parse(winSizeTextBox.Text);
            var hopSize = int.Parse(hopSizeTextBox.Text);
            var tsm     = (TsmAlgorithm)tsmComboBox.SelectedIndex;

            var shift = float.Parse(pitchShiftTextBox.Text);

            if (tremoloRadioButton.Checked)
            {
                var freq  = float.Parse(tremoloFrequencyTextBox.Text);
                var index = float.Parse(tremoloIndexTextBox.Text);
                effect = new TremoloEffect(fs, freq, index);
            }
            else if (overdriveRadioButton.Checked)
            {
                var gain = float.Parse(distortionGainTextBox.Text);
                effect = new OverdriveEffect(gain);
            }
            else if (distortionRadioButton.Checked)
            {
                var gain = float.Parse(distortionGainTextBox.Text);
                effect = new DistortionEffect(gain);
            }
            else if (tubeDistortionRadioButton.Checked)
            {
                var gain = float.Parse(distortionGainTextBox.Text);
                var mix  = float.Parse(wetTextBox.Text);
                var dist = float.Parse(distTextBox.Text);
                var q    = float.Parse(qTextBox.Text);
                effect = new TubeDistortionEffect(gain, mix, q, dist);
            }
            else if (echoRadioButton.Checked)
            {
                var delay = float.Parse(echoDelayTextBox.Text);
                var decay = float.Parse(echoDecayTextBox.Text);
                effect = new EchoEffect(fs, delay, decay);
            }
            else if (delayRadioButton.Checked)
            {
                var delay = float.Parse(echoDelayTextBox.Text);
                var decay = float.Parse(echoDecayTextBox.Text);
                effect = new DelayEffect(fs, delay, decay);
            }
            else if (wahwahRadioButton.Checked)
            {
                var lfoFrequency = float.Parse(lfoFreqTextBox.Text);
                var minFrequency = float.Parse(minFreqTextBox.Text);
                var maxFrequency = float.Parse(maxFreqTextBox.Text);
                var q            = float.Parse(lfoQTextBox.Text);
                //effect = new WahwahEffect(fs, lfoFrequency, minFrequency, maxFrequency, q);
                effect = new AutowahEffect(fs, minFrequency, maxFrequency, q);
            }
            else if (flangerRadioButton.Checked)
            {
                var lfoFrequency = float.Parse(lfoFreqTextBox.Text);
                var maxDelay     = float.Parse(maxDelayTextBox.Text);
                effect = new FlangerEffect(fs, maxDelay, lfoFrequency);
            }
            else if (pitchShiftRadioButton.Checked)
            {
                effect = pitchShiftCheckBox.Checked ? new PitchShiftEffect(shift, winSize, hopSize, tsm) : null;
                //effect = pitchShiftCheckBox.Checked ? new WhisperEffect(hopSize, winSize) : null;
                //effect = new MorphEffect(hopSize, winSize);
            }
            else
            {
                var lfoFrequency = float.Parse(lfoFreqTextBox.Text);
                var minFrequency = float.Parse(minFreqTextBox.Text);
                var maxFrequency = float.Parse(maxFreqTextBox.Text);
                var q            = float.Parse(lfoQTextBox.Text);

                var lfo = new SawtoothBuilder()
                          .SetParameter("freq", lfoFrequency)
                          .SetParameter("min", minFrequency)
                          .SetParameter("max", maxFrequency)
                          .SampledAt(_signal.SamplingRate);

                effect = new PhaserEffect(fs, lfo, q);
            }

            if (effect != null)
            {
                effect.Wet = float.Parse(wetTextBox.Text);
                effect.Dry = float.Parse(dryTextBox.Text);

                _filteredSignal = effect.ApplyTo(_signal, FilteringMethod.Auto);

                //DiscreteSignal morph;
                //using (var stream = new FileStream(@"D:\Docs\Research\DATABASE\Dictor1\wav\gtr16khz.wav", FileMode.Open))
                //{
                //    var waveFile = new WaveFile(stream);
                //    morph = waveFile[Channels.Average];
                //}

                //_filteredSignal = ((MorphEffect)effect).ApplyTo(_signal, morph);
            }
            else
            {
                _filteredSignal = Operation.TimeStretch(_signal, shift, tsm);
                //Operation.TimeStretch(_signal, shift, winSize, hopSize, tsm);
            }

            signalAfterFilteringPanel.Signal           = _filteredSignal;
            spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal.Samples);
        }
 //Deregister distortion effect
 public void Deregister(DistortionEffect distortionEffect)
 {
     _distortionEffects.Remove(distortionEffect);
 }
 //Register distortion effect
 public void Register(DistortionEffect distortionEffect)
 {
     _distortionEffects.Add(distortionEffect);
 }
예제 #5
0
        private void applyEffectButton_Click(object sender, EventArgs e)
        {
            IFilter effect;

            if (tremoloRadioButton.Checked)
            {
                var freq  = float.Parse(tremoloFrequencyTextBox.Text);
                var index = float.Parse(tremoloIndexTextBox.Text);
                effect = new TremoloEffect(freq, index);
            }
            else if (overdriveRadioButton.Checked)
            {
                effect = new OverdriveEffect();
            }
            else if (distortionRadioButton.Checked)
            {
                var gain = float.Parse(distortionGainTextBox.Text);
                var mix  = float.Parse(distortionMixTextBox.Text);
                effect = new DistortionEffect(gain, mix);
            }
            else if (tubeDistortionRadioButton.Checked)
            {
                var gain = float.Parse(distortionGainTextBox.Text);
                var mix  = float.Parse(distortionMixTextBox.Text);
                var dist = float.Parse(distTextBox.Text);
                var q    = float.Parse(qTextBox.Text);
                effect = new TubeDistortionEffect(gain, mix, q, dist);
            }
            else if (echoRadioButton.Checked)
            {
                var delay = float.Parse(echoDelayTextBox.Text);
                var decay = float.Parse(echoDecayTextBox.Text);
                effect = new EchoEffect(delay, decay);
            }
            else if (delayRadioButton.Checked)
            {
                var delay = float.Parse(echoDelayTextBox.Text);
                var decay = float.Parse(echoDecayTextBox.Text);
                effect = new DelayEffect(delay, decay);
            }
            else if (wahwahRadioButton.Checked)
            {
                var lfoFrequency = float.Parse(lfoFreqTextBox.Text);
                var minFrequency = float.Parse(minFreqTextBox.Text);
                var maxFrequency = float.Parse(maxFreqTextBox.Text);
                var q            = float.Parse(lfoQTextBox.Text);
                effect = new WahwahEffect(lfoFrequency, minFrequency, maxFrequency, q);
            }
            else if (pitchShiftRadioButton.Checked)
            {
                var shift = float.Parse(pitchShiftTextBox.Text);
                effect = pitchShiftCheckBox.Checked ? new PitchShiftEffect(shift) : null;
            }
            else
            {
                var lfoFrequency = float.Parse(lfoFreqTextBox.Text);
                var minFrequency = float.Parse(minFreqTextBox.Text);
                var maxFrequency = float.Parse(maxFreqTextBox.Text);
                var q            = float.Parse(lfoQTextBox.Text);
                effect = new PhaserEffect(lfoFrequency, minFrequency, maxFrequency, q);
            }

            _filteredSignal = effect != null?
                              effect.ApplyTo(_signal, FilteringOptions.Auto) :
                                  Operation.TimeStretch(_signal, float.Parse(pitchShiftTextBox.Text));

            signalAfterFilteringPanel.Signal           = _filteredSignal;
            spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal.Samples);
        }
예제 #6
0
    void Start()
    {
        base.isLocalPlayer = true;
        GeneralVariables.cachedSpectCam = cachedSpectCam;
        uic       = GeneralVariables.uiController;
        rattleTSS = equipmentRattleSource.GetComponent <TimeScaleSound>();

        healthBar         = uic.healthBar;
        healthText        = uic.healthText;
        shieldBar         = uic.shieldBar;
        shieldText        = uic.shieldText;
        staminaBar        = uic.staminaBar;
        shieldTexture     = uic.shieldTexture;
        ne                = uic.guiCamera.GetComponent <NoiseEffect>();
        disE              = uic.guiCamera.GetComponent <DistortionEffect>();
        staminaBackground = staminaBar.backgroundWidget;
        defStaminaBGCol   = staminaBackground.color;
        bloodyScreen      = uic.bloodyScreen;
        flickeringGUI     = uic.flickeringPanels;
        sa                = uic.screenAdjustment;

        bloodyScreen.material.color = DarkRef.SetAlpha(bloodyScreen.material.color, 0f);

        PlayerReference pr = GeneralVariables.playerRef;

        pm         = GetComponent <PlayerMovement>();
        playerLook = GetComponent <PlayerLook>();
        vignetting = cam.GetComponent <VignettingC>();

        damageBreathBoost  = 0f;
        ne.grainIntensity  = 0f;
        disE.baseIntensity = 0f;
        guiSizeModH        = guiSizeModS = 1f;
        healthBar.value    = 0f;
        shieldBar.value    = 0f;
        breathFactor       = 1f;
        hearingPenalty     = 1f;
        standardFreq       = 5000f;

        wm = pr.wm;
        wc = pr.wc;

        shieldAlpha      = 0f;
        finalShAlpha     = 0f;
        flickerIntensity = 0.5f;
        percent          = 1f;
        shPercent        = 1f;
        recovering       = true;
        canSprint        = true;
        initTime         = Time.time;

        damageIDs       = new List <byte>();
        damageInflicted = new List <int>();
        killerID        = -1;
        headID          = -1;
        lastWeaponID    = -1;
        builtData       = "";

        //Initialize values.
        curHealth = maxHealth;
        curShield = maxShield;
        AntiHackSystem.ProtectInt("maxHealth", maxHealth);
        AntiHackSystem.ProtectInt("maxShield", maxShield);

        oldHealth = curHealth;
        oldShield = curShield;
    }
예제 #7
0
        private void updateSoundEffects(bool newEffects)
        {
            if (_conf.SoundEffects.Count == 0)
            {
                _conf.SoundEffects[AudioEffects.ParamEq] = 1;
            }

            int  i         = 0;
            bool wasPlayed = _sound.Status.Looping || _sound.Status.Playing;
            bool looped    = _sound.Status.Looping;

            if (newEffects)
            {
                EffectDescription[] effs = new EffectDescription[_conf.SoundEffects.Count];
                foreach (AudioEffects eff in _conf.SoundEffects.Keys)
                {
                    switch (eff)
                    {
                    case AudioEffects.Chorus: effs[i].GuidEffectClass = DSoundHelper.StandardChorusGuid; break;

                    case AudioEffects.Compressor: effs[i].GuidEffectClass = DSoundHelper.StandardCompressorGuid; break;

                    case AudioEffects.Distortion: effs[i].GuidEffectClass = DSoundHelper.StandardDistortionGuid; break;

                    case AudioEffects.Echo: effs[i].GuidEffectClass = DSoundHelper.StandardEchoGuid; break;

                    case AudioEffects.Flanger: effs[i].GuidEffectClass = DSoundHelper.StandardFlangerGuid; break;

                    case AudioEffects.Gargle: effs[i].GuidEffectClass = DSoundHelper.StandardGargleGuid; break;

                    case AudioEffects.I3DLevel2Reverb: effs[i].GuidEffectClass = DSoundHelper.StandardInteractive3DLevel2ReverbGuid; break;

                    case AudioEffects.ParamEq: effs[i].GuidEffectClass = DSoundHelper.StandardParamEqGuid; break;

                    case AudioEffects.WavesReverb: effs[i].GuidEffectClass = DSoundHelper.StandardWavesReverbGuid; break;

                    default: break;
                    }
                    i += 1;
                }
                _sound.Stop();
                _sound.SetEffects(effs);
            }
            i = 0;
            foreach (AudioEffects eff in _conf.SoundEffects.Keys)
            {
                float val = (float)_conf.SoundEffects[eff];
                switch (eff)
                {
                case AudioEffects.Chorus:
                    val += 40;
                    ChorusEffect  chorus        = (ChorusEffect)_sound.GetEffects(i);
                    EffectsChorus chorus_params = chorus.AllParameters;
                    chorus_params.Delay     = 10 + val / (float)10; // 15.0f;
                    chorus_params.Depth     = ChorusEffect.DepthMax - 80 + val;
                    chorus_params.Phase     = ChorusEffect.PhaseNegative180;
                    chorus_params.Waveform  = ChorusEffect.WaveTriangle;
                    chorus_params.WetDryMix = val + val / 5 - 20;    // 50.0f;
                    chorus.AllParameters    = chorus_params;
                    break;

                case AudioEffects.Compressor:
                    //CompressorEffect com = (CompressorEffect)_sound.GetEffects(i);
                    //EffectsCompressor ecom = com.AllParameters;
                    // ecom.Threshold = ((CompressorEffect.ThresholdMax - CompressorEffect.ThresholdMin) / 100) * val;

                    //  com.AllParameters = ecom;
                    break;

                case AudioEffects.Distortion:
                    val += 10;
                    DistortionEffect  dis        = (DistortionEffect)_sound.GetEffects(i);
                    EffectsDistortion dis_params = dis.AllParameters;
                    dis_params.Gain                  = -35 + val;
                    dis_params.Edge                  = val - 5;
                    dis_params.PostEqBandwidth       = (float)(val % 99) * 20 + 2000;
                    dis_params.PostEqCenterFrequency = (float)(val % 99) * 20 + 2000;
                    // dis_params.PreLowpassCutoff = (float)(_conf.SoundEffects[eff] + 1) ;
                    dis.AllParameters = dis_params;
                    break;

                case AudioEffects.Gargle:
                    GargleEffect  gar  = (GargleEffect)_sound.GetEffects(i);
                    EffectsGargle egar = (EffectsGargle)gar.AllParameters;
                    egar.RateHz       = (int)val * 25;
                    gar.AllParameters = egar;

                    break;

                case AudioEffects.Echo:
                    /*Interactive3DLevel2ReverbEffect env1 = (Interactive3DLevel2ReverbEffect)_sound.GetEffects(i);
                     * EffectsInteractive3DLevel2Reverb enviroEffects1 = env1.AllParameters;
                     * enviroEffects1.Reflections = 10 * _conf.SoundEffects[eff];
                     * enviroEffects1.Reverb = 2 * _conf.SoundEffects[eff];
                     * enviroEffects1.Diffusion = 0.1f * _conf.SoundEffects[eff];
                     * env1.AllParameters = enviroEffects1;
                     * break;*/
                    EchoEffect  echo        = (EchoEffect)_sound.GetEffects(i);
                    EffectsEcho echo_params = echo.AllParameters;
                    echo_params.LeftDelay  = (_conf.SoundEffects[eff] + 1) * 5; // 250.0f;
                    echo_params.RightDelay = (_conf.SoundEffects[eff] + 1) * 5; // 250.0f;
//echo_params.RightDelay = 1.0f * _conf.SoundEffects[eff];
                    echo_params.Feedback  = val;                                //20;//1  + _conf.SoundEffects[eff] ;// 85.0f;
                    echo_params.PanDelay  = 1;
                    echo_params.WetDryMix = (_conf.SoundEffects[eff]) + 1;
                    echo.AllParameters    = echo_params;
                    break;

                case AudioEffects.Flanger:
                    FlangerEffect  flan  = (FlangerEffect)_sound.GetEffects(i);
                    EffectsFlanger eflan = flan.AllParameters;
                    val += 40;
                    //eflan.Delay = FlangerEffect.DelayMax + 80 - val;
                    eflan.Depth        = FlangerEffect.DepthMax - 80 + val;
                    eflan.Phase        = FlangerEffect.Phase90;
                    eflan.Waveform     = FlangerEffect.WaveTriangle;
                    eflan.WetDryMix    = FlangerEffect.WetDryMixMax - val / 5; // +val / 5 - 20;// 50.0f;
                    flan.AllParameters = eflan;
                    break;

                case AudioEffects.I3DLevel2Reverb:
                    Interactive3DLevel2ReverbEffect  env           = (Interactive3DLevel2ReverbEffect)_sound.GetEffects(i);
                    EffectsInteractive3DLevel2Reverb enviroEffects = env.AllParameters;
                    enviroEffects.DecayHfRatio = 2.0f;
                    enviroEffects.DecayTime    = 20.0f;
                    enviroEffects.Density      = 1.0f;
                    enviroEffects.Diffusion    = 2.0f;
                    enviroEffects.Reflections  = (int)(val / 10);
                    enviroEffects.Reverb       = 2;
                    env.AllParameters          = enviroEffects;
                    break;

                case AudioEffects.ParamEq: break;

                case AudioEffects.WavesReverb:
                    val += 85;
                    WavesReverbEffect  wrev  = (WavesReverbEffect)_sound.GetEffects(i);
                    EffectsWavesReverb ewrev = wrev.AllParameters;
                    //ewrev.ReverbMix = (float)_conf.SoundEffects[eff] / (float)100;
                    ewrev.ReverbTime = val * 20;
                    //ewrev.HighFrequencyRtRatio = (float)val / (float)100;
                    ewrev.ReverbMix = -95.5f + (float)val;    // (val >= 96) ? 0 : val - 96;
                    //MessageBox.Show(String.Format("{0} / {1}, {2} / {3}", WavesReverbEffect.ReverbMixMin, WavesReverbEffect.ReverbTimeMax, WavesReverbEffect.ReverbTimeMin, WavesReverbEffect.ReverbTimeMax));

                    //MessageBox.Show(string.Format("{0} - {1} - {2}", WavesReverbEffect.ReverbTimeMin,WavesReverbEffect.ReverbMixMin, WavesReverbEffect.HighFrequencyRtRatioMin), "");
                    wrev.AllParameters = ewrev;
                    break;

                default: break;
                }
                i += 1;
            }
            if (newEffects && wasPlayed)
            {
                _sound.Play(0, looped ? BufferPlayFlags.Looping : BufferPlayFlags.Default);
            }
        }