コード例 #1
0
ファイル: RUVoice.cs プロジェクト: disi/RUVoice
 public void SetChar(CharacterComponent myChar)
 {
     this.audioChar     = myChar;
     this.myAudioSource = this.audioChar.GetAudioSource(CharacterComponent.AudioSourceType.Character);
     highPassFilter     = this.myAudioSource.gameObject.GetComponent <AudioHighPassFilter>();
     lowPassFilter      = this.myAudioSource.gameObject.GetComponent <AudioLowPassFilter>();
     distortion         = this.myAudioSource.gameObject.GetComponent <AudioDistortionFilter>();
     if (!highPassFilter)
     {
         highPassFilter = this.myAudioSource.gameObject.AddComponent <AudioHighPassFilter>();
     }
     if (!lowPassFilter)
     {
         lowPassFilter = this.myAudioSource.gameObject.AddComponent <AudioLowPassFilter>();
     }
     if (!distortion)
     {
         distortion = this.myAudioSource.gameObject.AddComponent <AudioDistortionFilter>();
     }
     highPassFilter.cutoffFrequency  = Main.ruVoiceSettings.highPassFilterValue;
     lowPassFilter.cutoffFrequency   = Main.ruVoiceSettings.lowPassFilterValue;
     lowPassFilter.lowpassResonanceQ = Main.ruVoiceSettings.lowpassResonanceQValue;
     highPassFilter.cutoffFrequency  = Main.ruVoiceSettings.highPassFilterCutoffFrequencyValue;
     distortion.distortionLevel      = Main.ruVoiceSettings.distortionFilterValue;
     this.SetAudioPitch();
     this.SetAudioVolume();
 }
コード例 #2
0
 /// <summary>
 /// Add effects knobs to panel.  Attempts to recycle existing filters.
 /// </summary>
 /// <param name="select">Select multiple knobs via logical OR.
 /// e.g. Knobs.distortion | Knobs.reverb</param>
 /// <remarks>TODO Figure out a way to make filters chain (lowpass LAST).</remarks>
 public void AddKnobs(Knobs select)
 {
     if ((select & Knobs.distortion) == Knobs.distortion)
     {
         distortion = gameObj.GetComponent <AudioDistortionFilter>();
         if (distortion == null)
         {
             Log.dbg("Adding distortion filter");
             distortion = gameObj.AddComponent <AudioDistortionFilter>();
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         reverb = gameObj.GetComponent <AudioReverbFilter>();
         if (reverb == null)
         {
             Log.dbg("Adding reverb filter");
             reverb = gameObj.AddComponent <AudioReverbFilter>();
         }
     }
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         lowpass = gameObj.GetComponent <AudioLowPassFilter>();
         if (lowpass == null)
         {
             Log.dbg("Adding low-pass filter");
             lowpass = gameObj.AddComponent <AudioLowPassFilter>();
         }
         lowpass.lowpassResonaceQ = 0f;
     }
 }
コード例 #3
0
 void Start()
 {
     audioSource      = GetComponent <AudioSource>();
     distortionFilter = GetComponent <AudioDistortionFilter>();
     lowPassFilter    = GetComponent <AudioLowPassFilter>();
     echoFilter       = GetComponent <AudioEchoFilter>();
 }
コード例 #4
0
 void Start()
 {
     radioSource              = GetComponent <AudioSource>();
     echoFilter               = GetComponent <AudioEchoFilter>();
     distortionFilter         = GetComponent <AudioDistortionFilter>();
     distortionFilter.enabled = false;
     echoFilter.enabled       = false;
 }
コード例 #5
0
        private void save_shared_settings_filter(ConfigNode node, AudioDistortionFilter distortionFilter)
        {
            ConfigNode _filter = new ConfigNode();

            _filter = new ConfigNode();
            _filter.AddValue("enabled", distortionFilter.enabled);
            _filter.AddValue("distortion_level", distortionFilter.distortionLevel);
            node.SetNode("DISTORTION", _filter, true);
        }
コード例 #6
0
 void Start()
 {
     spawnPoints   = GameObject.FindGameObjectsWithTag("Spawners");
     spawnInterval = timeSpawn;
     planetSkin    = defaultCharObj;
     Invoke("SetDefaultSkin", 0.1f);
     gameSound = _earth.gameObject.GetComponent <AsteroidSounds>();
     audDist   = _earth.gameObject.GetComponent <AudioDistortionFilter>();
 }
コード例 #7
0
ファイル: AIMovement.cs プロジェクト: EvanMcConnell/pack
 // Start is called before the first frame update
 void Start()
 {
     audioDistortionFilter = GetComponent <AudioDistortionFilter>();
     agent              = GetComponent <NavMeshAgent>();
     currentState       = aiStates.patrolling;
     transform.position = points[0].transform.position;
     nextPoint          = 1;
     destination        = points[nextPoint];
 }
コード例 #8
0
    public override UnityEngine.Component CreateComponent(GameObject gameObject)
    {
        AudioDistortionFilter audioDistortionFilter = gameObject.GetComponent <AudioDistortionFilter>();

        if (audioDistortionFilter == null)
        {
            audioDistortionFilter = gameObject.AddComponent <AudioDistortionFilter>();
        }
        return(audioDistortionFilter);
    }
コード例 #9
0
    // Use this for initialization

    void Start()
    {
        oceanBox = GameObject.Find("OceanBox");
//		filter = gameObject.GetComponent<AudioReverbFilter> ();
        distFilter     = ocean.GetComponent <AudioDistortionFilter> ();
        audioSour      = gameObject.GetComponent <AudioSource> ();
        audioSour.loop = false;
        StartCoroutine(InvokePlayRandomHelp());
        PlayRandomHelp();
    }
コード例 #10
0
 private void load_shared_settings_filter(ConfigNode node, AudioDistortionFilter distortionFilter)
 {
     if (node.HasValue("enabled"))
     {
         distortionFilter.enabled = Boolean.Parse(node.GetValue("enabled"));
     }
     if (node.HasValue("distortion_level"))
     {
         distortionFilter.distortionLevel = Single.Parse(node.GetValue("distortion_level"));
     }
 }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     //Tutorial();
     timer            = 0.0f; totalTimer = 0.0f; upBase = 0.0f; leftBase = 0.0f; rightBase = 0.0f;
     leftTrack.volume = leftBase; upTrack.volume = upBase; rightTrack.volume = rightBase;
     leftTrack.Play(); rightTrack.Play(); upTrack.Play();
     leftDis  = leftTrack.GetComponent <AudioDistortionFilter>();
     rightDis = rightTrack.GetComponent <AudioDistortionFilter>();
     upDis    = upTrack.GetComponent <AudioDistortionFilter>();
     leftDis.distortionLevel = 0.0f; rightDis.distortionLevel = 0.0f; upDis.distortionLevel = 0.0f;
 }
コード例 #12
0
    void Start()
    {
        rbLowPass    = GameObject.Find("MainCamera").GetComponent <AudioLowPassFilter>();
        rbDistortion = GameObject.Find("MainCamera").GetComponent <AudioDistortionFilter>();
        rbEcho       = GameObject.Find("MainCamera").GetComponent <AudioEchoFilter>();

        rbLowPass.enabled    = false;
        rbDistortion.enabled = false;
        rbEcho.enabled       = false;

        inCave = false;
    }
    public static SAudioDistortionFilter Serialize(this AudioDistortionFilter _audioDistortionFilter)
    {
        SAudioDistortionFilter returnVal = new SAudioDistortionFilter
        {
            ExistsOnObject = (_audioDistortionFilter == null) ? false : true,
            Enabled        = _audioDistortionFilter.enabled,

            distortionLevel = _audioDistortionFilter.distortionLevel
        };

        return(returnVal);
    }
コード例 #14
0
 // Update is called once per frame
 void Update()
 {
     Current_Distort = Indicator.distort;
     Current_Reverb  = Indicator.reverb;
     Num.text        = Math.Round(Current_Distort.distortionLevel, 2).ToString();
     Num2.text       = Math.Round(Current_Reverb.reverbLevel, 2).ToString();
     Num3.text       = Math.Round(Current_Reverb.decayTime, 2).ToString();
     Num4.text       = Math.Round(Indicator.CurrentFreq, 2).ToString();
     loopSpeed       = Loop.speed;
     Divide_Num      = 2 / (double)loopSpeed;
     Final_Num       = 60 / Divide_Num;
     Num5.text       = Final_Num.ToString();
 }
    public static AudioDistortionFilter Deserialize(this SAudioDistortionFilter _audioDistortionFilter, ref GameObject _gameObject)
    {
        if (_audioDistortionFilter.ExistsOnObject == false)
        {
            return(null);
        }

        AudioDistortionFilter returnVal = _gameObject.GetComponent <AudioDistortionFilter>();

        returnVal.enabled = _audioDistortionFilter.Enabled;

        returnVal.distortionLevel = _audioDistortionFilter.distortionLevel;
        return(returnVal);
    }
コード例 #16
0
    IEnumerator FadeDist(AudioDistortionFilter audioDist, float maxValue, float fadeTime)
    {
        // run once when calling start couroutine
        float curDist = audioDist.distortionLevel;

        // updates every frame untill it reaches the exact fadeTime
        for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / fadeTime)
        {
            audioDist.distortionLevel = Mathf.Lerp(curDist, maxValue, t);


            yield return(null);
        }
    }
コード例 #17
0
 public void Refresh()
 {
     // Init references
     if (_instrument == null)
     {
         _instrument = Instrument.AllInstruments[_instrumentIndex];
     }
     _source     = MusicManager.Instance.GetAudioSource(_instrument);
     _distortion = _source.GetComponent <AudioDistortionFilter>();
     _tremolo    = _source.GetComponent <AudioTremoloFilter>();
     _chorus     = _source.GetComponent <AudioChorusFilter>();
     _flanger    = _source.GetComponent <AudioFlangerFilter>();
     _echo       = _source.GetComponent <AudioEchoFilter>();
     _reverb     = _source.GetComponent <AudioReverbFilter>();
 }
コード例 #18
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }
        DontDestroyOnLoad(gameObject);

        audioSources     = GetComponents <AudioSource>();
        distortionFilter = GetComponent <AudioDistortionFilter>();
    }
コード例 #19
0
ファイル: AudioClipPlayer.cs プロジェクト: pavel-fadrhonc/of2
        public void SetFilters(AudioManagerCategory cat)
        {
            if (cat.UseLowPassFilter)
            {
                AudioLowPassFilter filter = EnableFilter <AudioLowPassFilter>(EAudioFilter.LowPass);
                cat.AudioFilters.LowPass.SetToFilter(filter);
            }

            if (cat.UseHighPassFilter)
            {
                AudioHighPassFilter filter = EnableFilter <AudioHighPassFilter>(EAudioFilter.HighPass);
                cat.AudioFilters.HighPass.SetToFilter(filter);
            }

            if (cat.UseChorusFilter)
            {
                AudioChorusFilter filter = EnableFilter <AudioChorusFilter>(EAudioFilter.Chorus);
                cat.AudioFilters.Chorus.SetToFilter(filter);
            }

            if (cat.UseDistortionFilter)
            {
                AudioDistortionFilter filter = EnableFilter <AudioDistortionFilter>(EAudioFilter.Distortion);
                cat.AudioFilters.Distortion.SetToFilter(filter);
            }

            if (cat.UseEchoFilter)
            {
                AudioEchoFilter filter = EnableFilter <AudioEchoFilter>(EAudioFilter.Echo);
                cat.AudioFilters.Echo.SetToFilter(filter);
            }

            if (cat.UseReverbFilter)
            {
                AudioReverbFilter filter = EnableFilter <AudioReverbFilter>(EAudioFilter.Reverb);
                cat.AudioFilters.Reverb.SetToFilter(filter);
            }

            if (cat.UseFadeIn)
            {
                m_FadeInData = cat.AudioFilters.FadeIn;
            }

            if (cat.UseFadeOut)
            {
                m_FadeOutData = cat.AudioFilters.FadeOut;
            }
        }
コード例 #20
0
 void Start()
 {
     naviScreen           = GameObject.FindGameObjectWithTag("Navi").GetComponent <Renderer>();
     radioSource          = gameObject.GetComponent(typeof(AudioSource)) as AudioSource;
     songSource           = GameObject.Find("FavSong").GetComponent(typeof(AudioSource)) as AudioSource;
     songSource.volume    = 0;
     showSource           = GameObject.Find("Comedy").GetComponent(typeof(AudioSource)) as AudioSource;
     showSource.volume    = 0;
     trafficSource        = GameObject.Find("Traffic").GetComponent(typeof(AudioSource)) as AudioSource;
     trafficSource.volume = 0;
     noiseSource          = GameObject.Find("Noise").GetComponent(typeof(AudioSource)) as AudioSource;
     adf      = gameObject.GetComponent(typeof(AudioDistortionFilter)) as AudioDistortionFilter;
     aef      = gameObject.GetComponent(typeof(AudioEchoFilter)) as AudioEchoFilter;
     keyboard = gameObject.GetComponentInChildren(typeof(Crosstales.Radio.Demo.KeyboardController)) as Crosstales.Radio.Demo.KeyboardController;
     gui      = gameObject.GetComponentInChildren(typeof(Crosstales.Radio.Demo.GUIPlayStation)) as Crosstales.Radio.Demo.GUIPlayStation;
 }
コード例 #21
0
 void Start()
 {
     Sets                           = SetPoint;
     distort                        = Sets[thisFreq].df;
     reverb                         = Sets[thisFreq].rf;
     slider.value                   = (float)Sets[thisFreq].pt.GetComponent <Frequency>().frequency;
     slider_DST.value               = distort.distortionLevel;
     slider_RVB.value               = reverb.reverbLevel;
     slider_RVB2.value              = 0;
     slider_BPM.value               = (float)Loop.speed;
     Button_slider.localPosition    = new Vector3(slider.value / 1500, Button_slider.position.y, Button_slider.position.z);
     Mini_slider_DST.localPosition  = new Vector3(Mini_slider_DST.localPosition.x, Mini_slider_DST.localPosition.y, slider_DST.value);
     Mini_slider_RVB.localPosition  = new Vector3(Mini_slider_RVB.localPosition.x, Mini_slider_RVB.localPosition.y, slider_RVB.value / 2000);
     Mini_slider_RVB2.localPosition = new Vector3(Mini_slider_RVB2.localPosition.x, Mini_slider_RVB2.localPosition.y, slider_RVB2.value / 20);
     Mini_slider_BPM.localPosition  = new Vector3(Mini_slider_BPM.localPosition.x, Mini_slider_BPM.localPosition.y, slider_BPM.value / 10);
 }
コード例 #22
0
    static int _CreateAudioDistortionFilter(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            AudioDistortionFilter obj = new AudioDistortionFilter();
            LuaScriptMgr.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: AudioDistortionFilter.New");
        }

        return(0);
    }
コード例 #23
0
        void Awake()
        {
            _audioSrc  = GetComponent <AudioSource>();
            soundIcons = GetComponentInChildren <SoundIcons>();

            filterLowPass    = GetComponent <AudioLowPassFilter>();
            filterHighPass   = GetComponent <AudioHighPassFilter>();
            filterDistortion = GetComponent <AudioDistortionFilter>();
            filterPhaser     = GetComponent <AudioPhaser>();

            filterLowPass.enabled    = false;
            filterHighPass.enabled   = false;
            filterDistortion.enabled = false;
            filterPhaser.setEnabled(false);

            markerTrigger.triggerDelegate = this;
        }
コード例 #24
0
 public override void UpdateParameters()
 {
     if (_distortionLevel.HasReachedTarget())
     {
         return;
     }
     FabricTimer.Get();
     for (int i = 0; i < _dspInstances.Count; i++)
     {
         AudioDistortionFilter audioDistortionFilter = _dspInstances[i] as AudioDistortionFilter;
         if ((bool)audioDistortionFilter)
         {
             audioDistortionFilter.distortionLevel = _distortionLevel.GetValue();
         }
     }
     base.UpdateParameters();
 }
コード例 #25
0
    // Use this for initialization
    void Start()
    {
        // warn if there is no audio source on this GameObject
        // as this script will throw an exception and break if there isn't
        if (GetComponent <AudioSource>() == null)
        {
            Debug.Log("AudioManipulator Warning: There is no AudioSource on this GameObject. This script will not work.");
        }

        // add a distortion filter if there wasn't one already
        if (GetComponent <AudioDistortionFilter>() == null)
        {
            _distortionFilter = gameObject.AddComponent <AudioDistortionFilter>();
        }

        _distortionFilter.distortionLevel = 0f;
    }
コード例 #26
0
 public void Right()
 {
     Point.material = OFF;
     thisFreq++;
     thisFreq                       = thisFreq % Sets.Count;
     Point                          = Sets[thisFreq].indication;
     distort                        = Sets[thisFreq].df;
     reverb                         = Sets[thisFreq].rf;
     slider.value                   = (float)Sets[thisFreq].pt.GetComponent <Frequency>().frequency;
     slider_DST.value               = distort.distortionLevel;
     slider_RVB.value               = reverb.reverbLevel;
     slider_RVB2.value              = reverb.decayTime;
     Button_slider.localPosition    = new Vector3(slider.value / 1500, Button_slider.position.y, Button_slider.position.z);
     Mini_slider_DST.localPosition  = new Vector3(Mini_slider_DST.localPosition.x, Mini_slider_DST.localPosition.y, slider_DST.value);
     Mini_slider_RVB.localPosition  = new Vector3(Mini_slider_RVB.localPosition.x, Mini_slider_RVB.localPosition.y, slider_RVB.value / 2000);
     Mini_slider_RVB2.localPosition = new Vector3(Mini_slider_RVB2.localPosition.x, Mini_slider_RVB2.localPosition.y, slider_RVB2.value / 20);
     Point.material                 = ON;
 }
コード例 #27
0
ファイル: MusicControl.cs プロジェクト: ToxicMask/Gamecine
 // Start is called before the first frame update
 void Start()
 {
     if (levelMusic == null)
     {
         levelMusic = GetComponent <AudioSource>();
     }
     if (musicEchoFilter == null)
     {
         musicEchoFilter = GetComponent <AudioEchoFilter>();
     }
     if (musicLowFilter == null)
     {
         musicLowFilter = GetComponent <AudioLowPassFilter>();
     }
     if (musicDistortion == null)
     {
         musicDistortion = GetComponent <AudioDistortionFilter>();
     }
 }
コード例 #28
0
 // Update is called once per frame
 void Update()
 {
     distort = Sets[thisFreq].df;
     reverb  = Sets[thisFreq].rf;
     if (slider_RVB.value == 0)
     {
         reverb.enabled = false;
     }
     else if (slider_RVB.value > 0)
     {
         reverb.enabled = true;
     }
     if (slider_RVB2.value <= 1)
     {
         reverb.enabled = false;
     }
     else if (slider_RVB2.value > 1)
     {
         reverb.enabled = true;
     }
     CurrentFreq = (float)Sets[thisFreq].pt.GetComponent <Frequency>().frequency;
 }
コード例 #29
0
    static int set_distortionLevel(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name distortionLevel");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index distortionLevel on a nil value");
            }
        }

        AudioDistortionFilter obj = (AudioDistortionFilter)o;

        obj.distortionLevel = (float)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
コード例 #30
0
        // -----------------------------------

        void Awake()
        {
            _audioSrc        = GetComponent <AudioSource>();
            soundIcons       = GetComponentInChildren <SoundIcons>();
            followCameraYPos = GetComponent <FollowMainCameraYPosition>();

            resonance = GetComponent <ResonanceAudioSource>();

            filterLowPass    = GetComponent <AudioLowPassFilter>();
            filterHighPass   = GetComponent <AudioHighPassFilter>();
            filterDistortion = GetComponent <AudioDistortionFilter>();
            filterEcho       = GetComponent <AudioEchoFilter>();
            filterPhaser     = GetComponent <AudioPhaser>();

            filterLowPass.enabled    = false;
            filterHighPass.enabled   = false;
            filterDistortion.enabled = false;
            filterEcho.enabled       = false;
            filterPhaser.setEnabled(false);

            followCameraYPos.enabled      = false;
            markerTrigger.triggerDelegate = this;
        }