Ejemplo n.º 1
0
        private void Init(FMOD.System system, bool setToDefaultValues = false)
        {
            var result = system.lockDSP();

            result.ERRCHECK();

            this.Bands.Clear();
            var gainValues = !setToDefaultValues && this.smpSettings.PlayerSettings.EqualizerSettings != null ? this.smpSettings.PlayerSettings.EqualizerSettings.GainValues : null;

            foreach (var value in EqDefaultValues)
            {
                var band = EqualizerBand.GetEqualizerBand(system, this.IsEnabled, value[0], value[1], value[2]);
                if (band != null)
                {
                    float savedValue;
                    if (gainValues != null && gainValues.TryGetValue(band.BandCaption, out savedValue))
                    {
                        band.Gain = savedValue;
                    }
                    this.Bands.Add(band);
                }
            }

            result = system.unlockDSP();
            result.ERRCHECK();
        }
Ejemplo n.º 2
0
        public static EqualizerBand GetEqualizerBand(FMOD.System system, bool isActive, float centerValue, float bandwithValue, float gainValue)
        {
            FMOD.DSPConnection dspConnTemp = null;
            FMOD.DSP           dspParamEq  = null;

            if (isActive)
            {
                var result = system.createDSPByType(FMOD.DSP_TYPE.PARAMEQ, ref dspParamEq);
                if (!result.ERRCHECK())
                {
                    return(null);
                }

                result = system.addDSP(dspParamEq, ref dspConnTemp);
                if (!result.ERRCHECK())
                {
                    return(null);
                }

                result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.CENTER, centerValue);
                if (!result.ERRCHECK())
                {
                    return(null);
                }

                result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.BANDWIDTH, bandwithValue);
                if (!result.ERRCHECK())
                {
                    return(null);
                }

                result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.GAIN, gainValue);
                if (!result.ERRCHECK())
                {
                    return(null);
                }

                result = dspParamEq.setActive(true);
                if (!result.ERRCHECK())
                {
                    return(null);
                }
            }

            var band = new EqualizerBand(dspParamEq, centerValue, gainValue, isActive);

            return(band);
        }
Ejemplo n.º 3
0
        public static EqualizerBand GetEqualizerBand(FMOD.System system, bool isActive, float centerValue, float bandwithValue, float gainValue)
        {
            FMOD.DSPConnection dspConnTemp = null;
              FMOD.DSP dspParamEq = null;

              if (isActive) {
            var result = system.createDSPByType(FMOD.DSP_TYPE.PARAMEQ, ref dspParamEq);
            if (!result.ERRCHECK()) {
              return null;
            }

            result = system.addDSP(dspParamEq, ref dspConnTemp);
            if (!result.ERRCHECK()) {
              return null;
            }

            result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.CENTER, centerValue);
            if (!result.ERRCHECK()) {
              return null;
            }

            result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.BANDWIDTH, bandwithValue);
            if (!result.ERRCHECK()) {
              return null;
            }

            result = dspParamEq.setParameter((int)FMOD.DSP_PARAMEQ.GAIN, gainValue);
            if (!result.ERRCHECK()) {
              return null;
            }

            result = dspParamEq.setActive(true);
            if (!result.ERRCHECK()) {
              return null;
            }
              }

              var band = new EqualizerBand(dspParamEq, centerValue, gainValue, isActive);
              return band;
        }