Exemplo n.º 1
0
        void Set(ConditionVariables cv)
        {
            SoundEffectSettings ap = new SoundEffectSettings(cv);

            // we have no control over values, user could have messed them up, and it excepts if out of range

            trackBarEM.Enabled = trackBarEF.Enabled = trackBarED.Enabled = checkBoxE.Checked = ap.echoenabled;
            try
            {
                trackBarEM.Value = ap.echomix;
                trackBarEF.Value = ap.echofeedback;
                trackBarED.Value = ap.echodelay;
            } catch { }

            trackBarCM.Enabled = trackBarCF.Enabled = trackBarCD.Enabled = trackBarCDp.Enabled = checkBoxC.Checked = ap.chorusenabled;
            try
            {
                trackBarCM.Value  = ap.chorusmix;
                trackBarCF.Value  = ap.chorusfeedback;
                trackBarCD.Value  = ap.chorusdelay;
                trackBarCDp.Value = ap.chorusdepth;
            } catch { }

            trackBarRM.Enabled = trackBarRT.Enabled = trackBarRH.Enabled = checkBoxR.Checked = ap.reverbenabled;
            try
            {
                trackBarRM.Value = ap.reverbmix;
                trackBarRT.Value = ap.reverbtime;
                trackBarRH.Value = ap.reverbhfratio;
            } catch { }

            trackBarDG.Enabled = trackBarDE.Enabled = trackBarDC.Enabled = trackBarDW.Enabled = checkBoxD.Checked = ap.distortionenabled;
            try
            {
                trackBarDG.Value = ap.distortiongain;
                trackBarDE.Value = ap.distortionedge;
                trackBarDC.Value = ap.distortioncentrefreq;
                trackBarDW.Value = ap.distortionfreqwidth;
            } catch { }

            trackBarGF.Enabled = checkBoxG.Checked = ap.gargleenabled;
            try
            {
                trackBarGF.Value = ap.garglefreq;
            }
            catch { }

            trackBarPitch.Enabled = checkBoxP.Checked = ap.pitchshiftenabled;
            try
            {
                trackBarPitch.Value = ap.pitchshift;
            }
            catch { }

            checkBoxCustomNone.Checked = ap.OverrideNone;

            EDDiscovery.EDDTheme.Instance.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont);
        }
Exemplo n.º 2
0
        public ConditionVariables GetEffects()
        {
            SoundEffectSettings ap = new SoundEffectSettings();

            if (checkBoxE.Checked)
            {
                ap.echomix      = trackBarEM.Value;
                ap.echofeedback = trackBarEF.Value;
                ap.echodelay    = trackBarED.Value;
            }

            if (checkBoxC.Checked)
            {
                ap.chorusmix      = trackBarCM.Value;
                ap.chorusfeedback = trackBarCF.Value;
                ap.chorusdelay    = trackBarCD.Value;
                ap.chorusdepth    = trackBarCDp.Value;
            }

            if (checkBoxR.Checked)
            {
                ap.reverbmix     = trackBarRM.Value;
                ap.reverbtime    = trackBarRT.Value;
                ap.reverbhfratio = trackBarRH.Value;
            }

            if (checkBoxD.Checked)
            {
                ap.distortiongain       = trackBarDG.Value;
                ap.distortionedge       = trackBarDE.Value;
                ap.distortioncentrefreq = trackBarDC.Value;
                ap.distortionfreqwidth  = trackBarDW.Value;
            }

            if (checkBoxG.Checked)
            {
                ap.garglefreq = trackBarGF.Value;
            }

            if (checkBoxP.Checked)
            {
                ap.pitchshift = trackBarPitch.Value;
            }

            if (checkBoxCustomNone.Checked)
            {
                ap.OverrideNone = true;
            }

            return(ap.values);
        }
Exemplo n.º 3
0
        static private void ApplyEffects(ref IWaveSource src, ConditionVariables effect)
        {
            if (effect != null)
            {
                SoundEffectSettings ap = new SoundEffectSettings(effect);

                int extend = 0;
                if (ap.echoenabled)
                {
                    extend = ap.echodelay * 2;
                }
                if (ap.chorusenabled)
                {
                    extend = Math.Max(extend, 50);
                }
                if (ap.reverbenabled)
                {
                    extend = Math.Max(extend, 50);
                }

                if (extend > 0)
                {
                    //System.Diagnostics.Debug.WriteLine("Extend by " + extend + " ms due to effects");
                    src = src.AppendSource(x => new ExtendWaveSource(x, extend));
                }

                if (ap.chorusenabled)
                {
                    src = src.AppendSource(x => new DmoChorusEffect(x)
                    {
                        WetDryMix = ap.chorusmix, Feedback = ap.chorusfeedback, Delay = ap.chorusdelay, Depth = ap.chorusdepth
                    });
                }

                if (ap.reverbenabled)
                {
                    src = src.AppendSource(x => new DmoWavesReverbEffect(x)
                    {
                        InGain = 0, ReverbMix = ap.reverbmix, ReverbTime = ((float)ap.reverbtime) / 1000.0F, HighFrequencyRTRatio = ((float)ap.reverbhfratio) / 1000.0F
                    });
                }

                if (ap.distortionenabled)
                {
                    src = src.AppendSource(x => new DmoDistortionEffect(x)
                    {
                        Gain = ap.distortiongain, Edge = ap.distortionedge, PostEQCenterFrequency = ap.distortioncentrefreq, PostEQBandwidth = ap.distortionfreqwidth
                    });
                }

                if (ap.gargleenabled)
                {
                    src = src.AppendSource(x => new DmoGargleEffect(x)
                    {
                        RateHz = ap.garglefreq
                    });
                }

                if (ap.echoenabled)
                {
                    src = src.AppendSource(x => new DmoEchoEffect(x)
                    {
                        WetDryMix = ap.echomix, Feedback = ap.echofeedback, LeftDelay = ap.echodelay, RightDelay = ap.echodelay
                    });
                }

                if (ap.pitchshiftenabled)
                {
                    ISampleSource srs = src.ToSampleSource();
                    srs = srs.AppendSource(x => new PitchShifter(x)
                    {
                        PitchShiftFactor = ((float)ap.pitchshift) / 100.0F
                    });
                    src = srs.ToWaveSource();
                }
            }
        }