Пример #1
0
        public override void Init(bool setToDefaultValues = false)
        {
            FSystem.LockDsp();
            Bands.Clear();

            var gainValues = !setToDefaultValues && EqualizerSettings != null ? EqualizerSettings.GainValues : null;

            foreach (var value in EqDefaultValues)
            {
                var band = GetEqualizerBand(IsEnabled, value[0], value[1], value[2]);

                if (band == null)
                {
                    continue;
                }
                ((FmodEqualizerBand)band).PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName == "Gain")
                    {
                        SaveEqualizerSettings();
                    }
                };

                if (gainValues != null && gainValues.TryGetValue(band.BandCaption, out float savedValue))
                {
                    band.Gain = savedValue;
                }
                Bands.Add(band);
            }
            FSystem.UnlockDsp();
        }
Пример #2
0
        public override void DeInit()
        {
            FSystem.LockDsp();

            foreach (var band in Bands)
            {
                band.Remove();
            }

            FSystem.UnlockDsp();
        }