The Audio Distortion Filter distorts the sound from an AudioSource or sounds reaching the AudioListener.

Inheritance: Behaviour
 static public int get_distortionLevel(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AudioDistortionFilter self = (UnityEngine.AudioDistortionFilter)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.distortionLevel);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 /// <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)
         {
             //Debug.Log("ASE -- Adding distortion filter");
             distortion = gameObj.AddComponent<AudioDistortionFilter>();
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         reverb = gameObj.GetComponent<AudioReverbFilter>();
         if (reverb == null)
         {
             //Debug.Log("ASE -- Adding reverb filter");
             reverb = gameObj.AddComponent<AudioReverbFilter>();
         }
     }
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         lowpass = gameObj.GetComponent<AudioLowPassFilter>();
         if (lowpass == null)
         {
             //Debug.Log("ASE -- Adding low-pass filter");
             lowpass = gameObj.AddComponent<AudioLowPassFilter>();
         }
         lowpass.lowpassResonaceQ = 0f;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.AudioDistortionFilter audioDistortionFilter = (UnityEngine.AudioDistortionFilter)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "distortionLevel":
                    audioDistortionFilter.distortionLevel = reader.ReadProperty <System.Single> ();
                    break;

                case "enabled":
                    audioDistortionFilter.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    audioDistortionFilter.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    audioDistortionFilter.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    audioDistortionFilter.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
Esempio n. 4
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.AudioDistortionFilter o;
     o = new UnityEngine.AudioDistortionFilter();
     pushObject(l, o);
     return(1);
 }
Esempio n. 5
0
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.AudioDistortionFilter audioDistortionFilter = (UnityEngine.AudioDistortionFilter)value;
     writer.WriteProperty("distortionLevel", audioDistortionFilter.distortionLevel);
     writer.WriteProperty("enabled", audioDistortionFilter.enabled);
     writer.WriteProperty("tag", audioDistortionFilter.tag);
     writer.WriteProperty("name", audioDistortionFilter.name);
     writer.WriteProperty("hideFlags", audioDistortionFilter.hideFlags);
 }
Esempio n. 6
0
    static public int set_distortionLevel(IntPtr l)
    {
        UnityEngine.AudioDistortionFilter o = (UnityEngine.AudioDistortionFilter)checkSelf(l);
        float v;

        checkType(l, 2, out v);
        o.distortionLevel = v;
        return(0);
    }
 static public int get_distortionLevel(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter self = (UnityEngine.AudioDistortionFilter)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.distortionLevel);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 8
0
 static public int get_distortionLevel(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter self = (UnityEngine.AudioDistortionFilter)checkSelf(l);
         pushValue(l, self.distortionLevel);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.AudioDistortionFilter o;
			o=new UnityEngine.AudioDistortionFilter();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Esempio n. 10
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter o;
         o = new UnityEngine.AudioDistortionFilter();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.AudioDistortionFilter o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.AudioDistortionFilter();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter o;
         o = new UnityEngine.AudioDistortionFilter();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter o;
         o=new UnityEngine.AudioDistortionFilter();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Esempio n. 14
0
 static public int set_distortionLevel(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter self = (UnityEngine.AudioDistortionFilter)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.distortionLevel = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_distortionLevel(IntPtr l)
 {
     try {
         UnityEngine.AudioDistortionFilter self = (UnityEngine.AudioDistortionFilter)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.distortionLevel = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
// fields

// properties
    static void AudioDistortionFilter_distortionLevel(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.AudioDistortionFilter _this = (UnityEngine.AudioDistortionFilter)vc.csObj;
            var result = _this.distortionLevel;
            JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
        }
        else
        {
            System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
            UnityEngine.AudioDistortionFilter _this = (UnityEngine.AudioDistortionFilter)vc.csObj;
            _this.distortionLevel = arg0;
        }
    }
    void Start()
    {
        m_gameManag = GameObject.FindGameObjectWithTag("GameManager");

        m_gramoManag = m_gameManag.GetComponent<GramoManager>();

        m_dustManag = m_gameManag.GetComponent<DustManager>();

        m_HighPassFilter = m_AudioSource1.GetComponent<AudioHighPassFilter>();
        m_HighPassFilter.cutoffFrequency = 600;

        m_DistortionFilter = m_AudioSource1.GetComponent<AudioDistortionFilter>();
        m_DistortionFilter.distortionLevel = 0.8f;

        m_AudioSource1.volume = 0.00f;
        m_AudioSource2.volume = 1.00f;

        m_AudioSource1.Play();
        m_AudioSource2.Play();
    }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     _audio = GetComponent<AudioSource>();
     _distort = GetComponent<AudioDistortionFilter>();
 }
Esempio n. 19
0
 private void reset_distortion_filter(AudioDistortionFilter adf)
 {
     //reset distortion filter to default
     foreach (ConfigNode filter in filter_defaults.nodes)
     {
         if (filter.name == "DISTORTION")
         {
             if (filter.HasValue("distortion_level")) adf.distortionLevel = Single.Parse(filter.GetValue("distortion_level"));
         }
     }
 }
Esempio n. 20
0
 static public int get_distortionLevel(IntPtr l)
 {
     UnityEngine.AudioDistortionFilter o = (UnityEngine.AudioDistortionFilter)checkSelf(l);
     pushValue(l, o.distortionLevel);
     return(1);
 }
Esempio n. 21
0
        private int combined_filter_settings_gui(int sel_filter, AudioChorusFilter acf, AudioDistortionFilter adf, AudioEchoFilter aef, AudioHighPassFilter ahpf, AudioLowPassFilter alpf, AudioReverbFilter arf, int reverb_preset_index)
        {
            //chatter and beep settings window guis both call this function

            GUIContent _content = new GUIContent();

            if (sel_filter == 0)
            {
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Enable";
                _content.tooltip = "Turn chorus filter on/off";
                acf.enabled = GUILayout.Toggle(acf.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset chorus filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_chorus_filter(acf);
                GUILayout.EndHorizontal();

                _content.text = "Dry mix: " + (acf.dryMix * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of original signal to pass to output";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.dryMix = GUILayout.HorizontalSlider(acf.dryMix, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Wet mix 1: " + (acf.wetMix1 * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of 1st chorus tap";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.wetMix1 = GUILayout.HorizontalSlider(acf.wetMix1, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Wet mix 2: " + (acf.wetMix2 * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of 2nd chorus tap";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.wetMix2 = GUILayout.HorizontalSlider(acf.wetMix2, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Wet mix 3: " + (acf.wetMix3 * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of 3rd chorus tap";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.wetMix3 = GUILayout.HorizontalSlider(acf.wetMix3, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Delay: " + acf.delay.ToString("F2") + " ms";
                _content.tooltip = "Chorus delay in ms";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.delay = GUILayout.HorizontalSlider(acf.delay, 0.1f, 100f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Rate: " + acf.rate.ToString("F2") + " Hz";
                _content.tooltip = "Chorus modulation rate in Hz";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.rate = GUILayout.HorizontalSlider(acf.rate, 0, 20f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Depth: " + (acf.depth * 100).ToString("F0") + "%";
                _content.tooltip = "Chorus modulation depth";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                acf.depth = GUILayout.HorizontalSlider(acf.depth, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy Chorus";
                _content.tooltip = "Copy chorus values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    chorus_clipboard = new ConfigNode();
                    chorus_clipboard.AddValue("dry_mix", acf.dryMix);
                    chorus_clipboard.AddValue("wet_mix_1", acf.wetMix1);
                    chorus_clipboard.AddValue("wet_mix_2", acf.wetMix2);
                    chorus_clipboard.AddValue("wet_mix_3", acf.wetMix3);
                    chorus_clipboard.AddValue("delay", acf.delay);
                    chorus_clipboard.AddValue("rate", acf.rate);
                    chorus_clipboard.AddValue("depth", acf.depth);

                    if (debugging) Debug.Log("[CHATR] chorus filter values copied to chorus clipboard");
                }
                if (chorus_clipboard != null)
                {
                    _content.text = "Load Chorus";
                    _content.tooltip = "Load chorus values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        acf.dryMix = Single.Parse(chorus_clipboard.GetValue("dry_mix"));
                        acf.wetMix1 = Single.Parse(chorus_clipboard.GetValue("wet_mix_1"));
                        acf.wetMix2 = Single.Parse(chorus_clipboard.GetValue("wet_mix_2"));
                        acf.wetMix3 = Single.Parse(chorus_clipboard.GetValue("wet_mix_3"));
                        acf.delay = Single.Parse(chorus_clipboard.GetValue("delay"));
                        acf.rate = Single.Parse(chorus_clipboard.GetValue("rate"));
                        acf.depth = Single.Parse(chorus_clipboard.GetValue("depth"));

                        if (debugging) Debug.Log("[CHATR] chorus filter values loaded from chorus clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            else if (sel_filter == 1)
            {
                //Distortion
                _content.text = "Enable";
                _content.tooltip = "Turn distortion filter on/off";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                adf.enabled = GUILayout.Toggle(adf.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset distortion filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_distortion_filter(adf);
                GUILayout.EndHorizontal();

                _content.text = "Distortion level: " + (adf.distortionLevel * 100).ToString("F0") + "%";
                _content.tooltip = "Distortion value";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                adf.distortionLevel = GUILayout.HorizontalSlider(adf.distortionLevel, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy Dist";
                _content.tooltip = "Copy distortion values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    dist_clipboard = new ConfigNode();
                    dist_clipboard.AddValue("distortion_level", adf.distortionLevel);
                    if (debugging) Debug.Log("[CHATR] distortion filter values copied to distortion clipboard");
                }
                if (dist_clipboard != null)
                {
                    _content.text = "Load Dist";
                    _content.tooltip = "Load distortion values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        adf.distortionLevel = Single.Parse(dist_clipboard.GetValue("distortion_level"));
                        if (debugging) Debug.Log("[CHATR] distortion filter values loaded from distortion clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            else if (sel_filter == 2)
            {
                //Echo
                _content.text = "Enable";
                _content.tooltip = "Turn echo filter on/off";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                aef.enabled = GUILayout.Toggle(aef.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset echo filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_echo_filter(aef);
                GUILayout.EndHorizontal();

                _content.text = "Delay: " + aef.delay.ToString("F0") + " ms";
                _content.tooltip = "Echo delay in ms";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aef.delay = GUILayout.HorizontalSlider(aef.delay, 10f, 5000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Decay ratio: " + aef.decayRatio.ToString("F2");
                _content.tooltip = "Echo decay per delay";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aef.decayRatio = GUILayout.HorizontalSlider(aef.decayRatio, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Dry mix: " + (aef.dryMix * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of original signal to pass to output";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aef.dryMix = GUILayout.HorizontalSlider(aef.dryMix, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Wet mix: " + (aef.wetMix * 100).ToString("F0") + "%";
                _content.tooltip = "Volume of echo signal to pass to output";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                aef.wetMix = GUILayout.HorizontalSlider(aef.wetMix, 0, 1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy Echo";
                _content.tooltip = "Copy echo values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    echo_clipboard = new ConfigNode();
                    echo_clipboard.AddValue("delay", aef.delay);
                    echo_clipboard.AddValue("decay_ratio", aef.decayRatio);
                    echo_clipboard.AddValue("dry_mix", aef.dryMix);
                    echo_clipboard.AddValue("wet_mix", aef.wetMix);
                    if (debugging) Debug.Log("[CHATR] echo filter values copied to echo clipboard");
                }
                if (echo_clipboard != null)
                {
                    _content.text = "Load Echo";
                    _content.tooltip = "Load echo values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        aef.delay = Single.Parse(echo_clipboard.GetValue("delay"));
                        aef.decayRatio = Single.Parse(echo_clipboard.GetValue("decay_ratio"));
                        aef.dryMix = Single.Parse(echo_clipboard.GetValue("dry_mix"));
                        aef.wetMix = Single.Parse(echo_clipboard.GetValue("wet_mix"));
                        if (debugging) Debug.Log("[CHATR] echo filter values loaded from echo clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            else if (sel_filter == 3)
            {
                //Highpass
                _content.text = "Enable";
                _content.tooltip = "Turn highpass filter on/off";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                ahpf.enabled = GUILayout.Toggle(ahpf.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset highpass filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_highpass_filter(ahpf);
                GUILayout.EndHorizontal();

                _content.text = "Cutoff freq: " + ahpf.cutoffFrequency.ToString("F2") + " Hz";
                _content.tooltip = "Highpass cutoff frequency in Hz";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                ahpf.cutoffFrequency = GUILayout.HorizontalSlider(ahpf.cutoffFrequency, 10f, 22000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Resonance Q: " + ahpf.highpassResonanceQ.ToString("F2");
                _content.tooltip = "Highpass self-resonance dampening";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                ahpf.highpassResonanceQ = GUILayout.HorizontalSlider(ahpf.highpassResonanceQ, 1f, 10f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy HiPass";
                _content.tooltip = "Copy highpass values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    hipass_clipboard = new ConfigNode();
                    hipass_clipboard.AddValue("cutoff_freq", ahpf.cutoffFrequency);
                    hipass_clipboard.AddValue("resonance_q", ahpf.highpassResonanceQ);
                    if (debugging) Debug.Log("[CHATR] highpass filter values copied to highpass clipboard");
                }
                if (hipass_clipboard != null)
                {
                    _content.text = "Load HiPass";
                    _content.tooltip = "Load highpass values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        ahpf.cutoffFrequency = Single.Parse(hipass_clipboard.GetValue("cutoff_freq"));
                        ahpf.highpassResonanceQ = Single.Parse(hipass_clipboard.GetValue("resonance_q"));
                        if (debugging) Debug.Log("[CHATR] highpass filter values loaded from highpass clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            else if (sel_filter == 4)
            {
                //Lowpass
                _content.text = "Enable";
                _content.tooltip = "Turn lowpass filter on/off";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                alpf.enabled = GUILayout.Toggle(alpf.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset lowpass filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_lowpass_filter(alpf);
                GUILayout.EndHorizontal();

                _content.text = "Cutoff freq: " + alpf.cutoffFrequency.ToString("F2") + " Hz";
                _content.tooltip = "Lowpass cutoff frequency in Hz";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                alpf.cutoffFrequency = GUILayout.HorizontalSlider(alpf.cutoffFrequency, 10f, 22000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Resonance Q: " + alpf.lowpassResonanceQ.ToString("F2");
                _content.tooltip = "Lowpass self-resonance dampening";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                alpf.lowpassResonanceQ = GUILayout.HorizontalSlider(alpf.lowpassResonanceQ, 1f, 10f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy LoPass";
                _content.tooltip = "Copy lowpass values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    lopass_clipboard = new ConfigNode();
                    lopass_clipboard.AddValue("cutoff_freq", alpf.cutoffFrequency);
                    lopass_clipboard.AddValue("resonance_q", alpf.lowpassResonanceQ);
                    if (debugging) Debug.Log("[CHATR] lowpass filter values copied to lowpass clipboard");
                }
                if (lopass_clipboard != null)
                {
                    _content.text = "Load LoPass";
                    _content.tooltip = "Load lowpass values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        alpf.cutoffFrequency = Single.Parse(lopass_clipboard.GetValue("cutoff_freq"));
                        alpf.lowpassResonanceQ = Single.Parse(lopass_clipboard.GetValue("resonance_q"));
                        if (debugging) Debug.Log("[CHATR] lowpass filter values loaded from lowpass clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            else if (sel_filter == 5)
            {
                //Reverb
                _content.text = "Enable";
                _content.tooltip = "Turn reverb filter on/off";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                arf.enabled = GUILayout.Toggle(arf.enabled, _content, GUILayout.ExpandWidth(true));
                _content.text = "Default";
                _content.tooltip = "Reset reverb filter to default";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false))) reset_reverb_filter(arf);
                GUILayout.EndHorizontal();

                //Presets
                AudioReverbPreset[] preset_array = Enum.GetValues(typeof(AudioReverbPreset)) as AudioReverbPreset[];
                List<AudioReverbPreset> preset_list = new List<AudioReverbPreset>();

                foreach (var val in preset_array)
                {
                    if (val.ToString() != "Off" && val.ToString() != "User") preset_list.Add(val);  //Off and User have separate buttons
                }

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label("Current preset: " + arf.reverbPreset.ToString(), GUILayout.ExpandWidth(true));

                //off button
                //_content.text = "Off";
                //_content.tooltip = "Turn reverb off";
                //if (GUILayout.Button(_content, GUILayout.ExpandWidth(true)))
                //{
                //    arf.reverbPreset = AudioReverbPreset.Off;
                //    if (debugging) Debug.Log("[CHATR] reverb turned off");
                //}

                //user button
                _content.text = "User";
                _content.tooltip = "User reverb settings";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    arf.reverbPreset = AudioReverbPreset.User;
                    if (debugging) Debug.Log("[CHATR] reverb set to User");
                }

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                if (GUILayout.Button("◄", GUILayout.ExpandWidth(true)))
                {
                    //need separate preset indices for chatter and each beep
                    reverb_preset_index--;
                    if (reverb_preset_index < 0) reverb_preset_index = preset_list.Count - 1;
                    if (debugging) Debug.Log("[CHATR] reverb_preset_index = " + reverb_preset_index);
                }
                _content.text = preset_list[reverb_preset_index].ToString();
                _content.tooltip = "Click to apply";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(true)))
                {
                    arf.reverbPreset = preset_list[reverb_preset_index];
                    if (debugging) Debug.Log("[CHATR] reverb preset set to " + arf.reverbPreset.ToString());
                }

                if (GUILayout.Button("►", GUILayout.ExpandWidth(true)))
                {
                    reverb_preset_index++;
                    if (reverb_preset_index >= preset_list.Count) reverb_preset_index = 0;
                    if (debugging) Debug.Log("[CHATR] reverb_preset_index = " + reverb_preset_index);
                }

                GUILayout.EndHorizontal();

                //GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                //GUILayout.Label("source.reverbPreset = " + arf.reverbPreset.ToString());
                //GUILayout.EndHorizontal();

                _content.text = "Dry level: " + arf.dryLevel.ToString("F0") + " mB";
                _content.tooltip = "Mix level of dry signal in output in mB";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.dryLevel = GUILayout.HorizontalSlider(arf.dryLevel, -10000f, 0, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Room: " + arf.room.ToString("F0") + " mB";
                _content.tooltip = "Room effect level at low frequencies in mB";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.room = GUILayout.HorizontalSlider(arf.room, -10000f, 0, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Room HF: " + arf.roomHF.ToString("F0") + " mB";
                _content.tooltip = "Room effect high-frequency level in mB";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.roomHF = GUILayout.HorizontalSlider(arf.roomHF, -10000f, 0, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Room LF: " + arf.roomLF.ToString("F0") + " mB";
                _content.tooltip = "Room effect low-frequency level in mB";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.roomLF = GUILayout.HorizontalSlider(arf.roomLF, -10000f, 0, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Room roll-off: " + arf.roomRolloff.ToString("F2");
                _content.tooltip = "Rolloff factor for room effect";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.roomRolloff = GUILayout.HorizontalSlider(arf.roomRolloff, 0, 10f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Decay time: " + (arf.decayTime * 100).ToString("F0") + " s";
                _content.tooltip = "Reverb decay time at low-frequencies";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.decayTime = GUILayout.HorizontalSlider(arf.decayTime, 0.1f, 20f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Decay HF ratio: " + arf.decayHFRatio.ToString("F0");
                _content.tooltip = "HF to LF decay time ratio";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.decayHFRatio = GUILayout.HorizontalSlider(arf.decayHFRatio, 0.1f, 2f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Reflections level: " + arf.reflectionsLevel.ToString("F0") + " mB";
                _content.tooltip = "Early reflections level relative to room effect";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.reflectionsLevel = GUILayout.HorizontalSlider(arf.reflectionsLevel, -10000f, 1000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Reflections delay: " + arf.reflectionsDelay.ToString("F0") + " mB";
                _content.tooltip = "Late reverberation level relative to room effect";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.reflectionsDelay = GUILayout.HorizontalSlider(arf.reflectionsDelay, -10000f, 2000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Reverb level: " + arf.reverbLevel.ToString("F0") + " mB";
                _content.tooltip = "Late reverberation level relative to room effect";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.reverbLevel = GUILayout.HorizontalSlider(arf.reverbLevel, -10000f, 2000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Reverb delay: " + (arf.reverbDelay * 100).ToString("F0") + " s";
                _content.tooltip = "Late reverb delay time rel. to first reflection";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.reverbDelay = GUILayout.HorizontalSlider(arf.reverbDelay, 0, 0.1f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Diffusion: " + arf.diffusion.ToString("F0") + "%";
                _content.tooltip = "Reverb diffusion (echo density)";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.diffusion = GUILayout.HorizontalSlider(arf.diffusion, 0, 100f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "Density: " + arf.density.ToString("F0") + "%";
                _content.tooltip = "Reverb density (modal density)";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.density = GUILayout.HorizontalSlider(arf.density, 0, 100f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "HF reference: " + arf.hfReference.ToString("F0") + " Hz";
                _content.tooltip = "Reference high frequency in Hz";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.hfReference = GUILayout.HorizontalSlider(arf.hfReference, 20f, 20000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                _content.text = "LF reference: " + arf.lfReference.ToString("F0") + " Hz";
                _content.tooltip = "Reference low-frequency in Hz";
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                GUILayout.Label(_content, GUILayout.ExpandWidth(true));
                arf.lfReference = GUILayout.HorizontalSlider(arf.lfReference, 20f, 1000f, GUILayout.Width(90f));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                _content.text = "Copy Reverb";
                _content.tooltip = "Copy reverb values to clipboard";
                if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                {
                    reverb_clipboard = new ConfigNode();
                    reverb_clipboard.AddValue("reverb_preset", arf.reverbPreset);
                    reverb_clipboard.AddValue("dry_level", arf.dryLevel);
                    reverb_clipboard.AddValue("room", arf.room);
                    reverb_clipboard.AddValue("room_hf", arf.roomHF);
                    reverb_clipboard.AddValue("room_lf", arf.roomLF);
                    reverb_clipboard.AddValue("room_rolloff", arf.roomRolloff);
                    reverb_clipboard.AddValue("decay_time", arf.decayTime);
                    reverb_clipboard.AddValue("decay_hf_ratio", arf.decayHFRatio);
                    reverb_clipboard.AddValue("reflections_level", arf.reflectionsLevel);
                    reverb_clipboard.AddValue("reflections_delay", arf.reflectionsDelay);
                    reverb_clipboard.AddValue("reverb_level", arf.reverbLevel);
                    reverb_clipboard.AddValue("reverb_delay", arf.reverbDelay);
                    reverb_clipboard.AddValue("diffusion", arf.diffusion);
                    reverb_clipboard.AddValue("density", arf.density);
                    reverb_clipboard.AddValue("hf_reference", arf.hfReference);
                    reverb_clipboard.AddValue("lf_reference", arf.lfReference);
                    if (debugging) Debug.Log("[CHATR] reverb filter values copied to reverb clipboard");
                }
                if (reverb_clipboard != null)
                {
                    _content.text = "Load Reverb";
                    _content.tooltip = "Load reverb values from clipboard";
                    if (GUILayout.Button(_content, GUILayout.ExpandWidth(false)))
                    {
                        arf.reverbPreset = (AudioReverbPreset)Enum.Parse(typeof(AudioReverbPreset), reverb_clipboard.GetValue("reverb_preset"));
                        arf.dryLevel = Single.Parse(reverb_clipboard.GetValue("dry_level"));
                        arf.room = Single.Parse(reverb_clipboard.GetValue("room"));
                        arf.roomHF = Single.Parse(reverb_clipboard.GetValue("room_hf"));
                        arf.roomLF = Single.Parse(reverb_clipboard.GetValue("room_lf"));
                        arf.roomRolloff = Single.Parse(reverb_clipboard.GetValue("room_rolloff"));
                        arf.decayTime = Single.Parse(reverb_clipboard.GetValue("decay_time"));
                        arf.decayHFRatio = Single.Parse(reverb_clipboard.GetValue("decay_hf_ratio"));
                        arf.reflectionsLevel = Single.Parse(reverb_clipboard.GetValue("reflections_level"));
                        arf.reflectionsDelay = Single.Parse(reverb_clipboard.GetValue("reflections_delay"));
                        arf.reverbLevel = Single.Parse(reverb_clipboard.GetValue("reverb_level"));
                        arf.reverbDelay = Single.Parse(reverb_clipboard.GetValue("reverb_delay"));
                        arf.diffusion = Single.Parse(reverb_clipboard.GetValue("diffusion"));
                        arf.density = Single.Parse(reverb_clipboard.GetValue("density"));
                        arf.hfReference = Single.Parse(reverb_clipboard.GetValue("hf_reference"));
                        arf.lfReference = Single.Parse(reverb_clipboard.GetValue("lf_reference"));
                        if (debugging) Debug.Log("[CHATR] reverb filter values loaded from reverb clipboard");
                    }
                }
                GUILayout.EndHorizontal();
            }
            return reverb_preset_index;
        }
Esempio n. 22
0
	//Pull information fro gameobject
	void pullInformation()
	{

		//Filters
		//Echo
		echoFilter = soundReference.GetComponent<AudioEchoFilter> ();
		if (echoFilter) {
			echoToggle.isOn = true;
			echoOptions.GetComponent<echoScript> ().filterReference = echoFilter;
		}
		 else 
			echoToggle.isOn = false;
		//Chorus
		chorusFilter = soundReference.GetComponent<AudioChorusFilter> ();
		if (chorusFilter) {
			chorusToggle.isOn = true;
			chorusOptions.GetComponent<chorusScript> ().filterReference = chorusFilter;
		}
		else
			chorusToggle.isOn = false;
		//Reverb
		reverbFilter = soundReference.GetComponent<AudioReverbFilter> ();
		if (reverbFilter) {
			reverbToggle.isOn = true;
			reverbOptions.GetComponent<reverbScript> ().filterReference = reverbFilter;
		}
		else
			reverbToggle.isOn = false;
		//Distortion
		distortionFilter = soundReference.GetComponent<AudioDistortionFilter> ();
		if (distortionFilter) {
			distortionToggle.isOn = true;
			distortionOptions.GetComponent<distortionScript> ().filterReference = distortionFilter;
		}
		else
			distortionToggle.isOn = false;

		//Volume
		volumeSlider.value = sourceSound.volume;
		volumeText.text = volumeSlider.value.ToString();
		//Pitch
		pitchSlider.value = sourceSound.pitch;
		pitchText.text = pitchSlider.value.ToString();

		//Start & end
		startTime.text = soundReference.GetComponent<soundScript> ().startTime.ToString ();
		endTime.text = soundReference.GetComponent<soundScript> ().endTime.ToString ();


	}
Esempio n. 23
0
	void distortionChanged()
	{
		//Distortion
		if (distortionToggle.isOn) {
			if(!distortionFilter)
			{
				if (groupName == "") {
					distortionFilter = soundReference.AddComponent<AudioDistortionFilter> ();

				}
				else
				{
					foreach (AudioSource a in includedGroup) {
						a.gameObject.AddComponent<AudioDistortionFilter> ();
					}
					//use first one as reference
					distortionFilter = includedGroup[0].gameObject.GetComponent<AudioDistortionFilter>();
				}
				distortionOptions.GetComponent<distortionScript> ().filterReference = distortionFilter;
			}
			distortionOptions.SetActive (true);
		} else {
			if(distortionFilter)
			{
				if(groupName == ""){
					Component.Destroy(soundReference.GetComponent<AudioDistortionFilter>());
				}
				else{
					foreach (AudioSource a in includedGroup) {
						Component.Destroy (a.gameObject.GetComponent<AudioDistortionFilter> ());
					}
				}
				distortionFilter = null;
				distortionOptions.GetComponent<distortionScript> ().filterReference = null;
			}
			distortionOptions.SetActive (false);
		}
	}
 public override void OnEnable() => Component = gameObject.GetComponent <UnityEngine.AudioDistortionFilter>();
Esempio n. 25
0
        //Main
        public void Awake()
        {
            if (debugging) Debug.Log("[CHATR] Awake() starting...");

            // Setup & callbacks for KSP Application Launcher
            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIApplicationLauncherReady);
            GameEvents.onGameSceneLoadRequested.Add(OnSceneChangeRequest);

            //set a path to save/load settings
            settings_path = AssemblyLoader.loadedAssemblies.GetPathByType(typeof(chatterer)) + "/"; //returns "X:/full/path/to/GameData/Chatterer/Plugins/PluginData/chatterer"

            if (Directory.Exists(settings_path))
            {
                if (debugging) Debug.Log("[CHATR] " + settings_path + " exists");
            }
            else
            {
                if (debugging) Debug.Log("[CHATR] " + settings_path + " does not exist");
                Directory.CreateDirectory(settings_path);
                if (debugging) Debug.Log("[CHATR] " + settings_path + " created");
            }

            //Filters need to be added here BEFORE load_settings() or nullRef when trying to apply filter settings to non-existant filters
            chatter_player.name = "rbr_chatter_player";
            initial_chatter = chatter_player.AddComponent<AudioSource>();
            initial_chatter.volume = chatter_vol_slider;
            initial_chatter.panLevel = 0;   //set as 2D audio
            response_chatter = chatter_player.AddComponent<AudioSource>();
            response_chatter.volume = chatter_vol_slider;
            response_chatter.panLevel = 0;
            chatter_chorus_filter = chatter_player.AddComponent<AudioChorusFilter>();
            chatter_chorus_filter.enabled = false;
            chatter_distortion_filter = chatter_player.AddComponent<AudioDistortionFilter>();
            chatter_distortion_filter.enabled = false;
            chatter_echo_filter = chatter_player.AddComponent<AudioEchoFilter>();
            chatter_echo_filter.enabled = false;
            chatter_highpass_filter = chatter_player.AddComponent<AudioHighPassFilter>();
            chatter_highpass_filter.enabled = false;
            chatter_lowpass_filter = chatter_player.AddComponent<AudioLowPassFilter>();
            chatter_lowpass_filter.enabled = false;
            chatter_reverb_filter = chatter_player.AddComponent<AudioReverbFilter>();
            chatter_reverb_filter.enabled = false;

            //AAE
            load_AAE_background_audio();
            load_AAE_soundscape_audio();

            if (aae_soundscapes_exist)
            {
                aae_soundscape = aae_soundscape_player.AddComponent<AudioSource>();
                aae_soundscape.panLevel = 0;
                aae_soundscape.volume = 0.3f;
                set_soundscape_clip();
                new_soundscape_loose_timer_limit();
            }

            //AAE EVA breathing
            aae_breathing = aae_ambient_player.AddComponent<AudioSource>();
            aae_breathing.panLevel = 0;
            aae_breathing.volume = 1.0f;
            aae_breathing.loop = true;
            string breathing_path = "Chatterer/Sounds/AAE/effect/breathing";
            if (GameDatabase.Instance.ExistsAudioClip(breathing_path))
            {
                aae_breathing_exist = true;
                aae_breathing.clip = GameDatabase.Instance.GetAudioClip(breathing_path);
                if (debugging) Debug.Log("[CHATR] " + breathing_path + " loaded OK");
            }
            else
            {
                if (debugging) Debug.LogWarning("[CHATR] " + breathing_path + " not found");
            }

            //AAE airlock
            aae_airlock = aae_ambient_player.AddComponent<AudioSource>();
            aae_airlock.panLevel = 0;
            aae_airlock.volume = 1.0f;
            string airlock_path = "Chatterer/Sounds/AAE/effect/airlock";
            if (GameDatabase.Instance.ExistsAudioClip(airlock_path))
            {
                aae_airlock_exist = true;
                aae_airlock.clip = GameDatabase.Instance.GetAudioClip(airlock_path);
                if (debugging) Debug.Log("[CHATR] " + airlock_path + " loaded OK");
            }
            else
            {
                if (debugging) Debug.LogWarning("[CHATR] " + airlock_path + " not found");
            }

            //AAE wind
            aae_wind = aae_ambient_player.AddComponent<AudioSource>();
            aae_wind.panLevel = 0;
            aae_wind.volume = 1.0f;
            string wind_path = "Chatterer/Sounds/AAE/wind/mario1298__weak-wind";
            if (GameDatabase.Instance.ExistsAudioClip(wind_path))
            {
                aae_wind_exist = true;
                aae_wind.clip = GameDatabase.Instance.GetAudioClip(wind_path);
                if (debugging) Debug.Log("[CHATR] " + wind_path + " loaded OK");
            }
            else
            {
                if (debugging) Debug.LogWarning("[CHATR] " + wind_path + " not found");
            }

            //yepyep
            yep_yepsource = aae_ambient_player.AddComponent<AudioSource>();
            yep_yepsource.panLevel = 0;
            yep_yepsource.volume = 1.0f;

            //AAE landing
            landingsource = aae_ambient_player.AddComponent<AudioSource>();
            landingsource.panLevel = 0;
            landingsource.volume = 0.5f;
            string landing_path = "Chatterer/Sounds/AAE/loop/suspense1";
            if (GameDatabase.Instance.ExistsAudioClip(landing_path))
            {
                landingsource.clip = GameDatabase.Instance.GetAudioClip(landing_path);
                if (debugging) Debug.Log("[CHATR] " + landing_path + " loaded OK");
            }
            else
            {
                if (debugging) Debug.LogWarning("[CHATR] " + landing_path + " not found");
            }

            load_beep_audio();      //this must run before loading settings (else no beep clips to assign to sources))

            if (GameDatabase.Instance.ExistsTexture("Chatterer/Textures/line_512x4")) line_512x4 = GameDatabase.Instance.GetTexture("Chatterer/Textures/line_512x4", false);
            else Debug.LogWarning("Texture 'line_512x4' is missing!");

            load_plugin_settings();

            if (http_update_check) get_latest_version();

            load_quindar_audio();
            quindar1 = chatter_player.AddComponent<AudioSource>();
            quindar1.volume = quindar_vol_slider;
            quindar1.panLevel = 0;
            quindar1.clip = quindar_clip;
            quindar2 = chatter_player.AddComponent<AudioSource>();
            quindar2.volume = quindar_vol_slider;
            quindar2.panLevel = 0;
            quindar2.clip = quindar_clip;

            initialize_new_exchange();

            load_sstv_audio();
            sstv_player.name = "rbr_sstv_player";
            sstv = sstv_player.AddComponent<AudioSource>();
            sstv.volume = sstv_vol_slider;
            sstv.panLevel = 0;

            new_sstv_loose_timer_limit();

            create_filter_defaults_node();

            build_skin_list();

            if (debugging) Debug.Log("[CHATR] Awake() has finished...");
        }
Esempio n. 26
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.AudioDistortionFilter audioDistortionFilter = SaveGameType.CreateComponent <UnityEngine.AudioDistortionFilter> ();
     ReadInto(audioDistortionFilter, reader);
     return(audioDistortionFilter);
 }