public void OnBiquadsChanged(BiquadsChangedEventArgs e)
        {
            EventHandler <BiquadsChangedEventArgs> handler = BiquadsChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        /// <summary>
        /// This function is called when a biquad parameter has been changed
        /// </summary>
        protected virtual void OnChangeBiquads(object sender, BiquadsChangedEventArgs pf)
        {
            var model1 = (PeqDataViewModel)sender;

            IsCustom = true;

            if (pf.PeqField == PeqField.FilterType &&
                !model1.HasBandwidth())
            {
                RemoveBandwith(model1);
            }

            _actionForField[pf.PeqField](pf, model1);
            RedrawMasterLine();
        }
        private void TypeChanged(BiquadsChangedEventArgs bf, PeqDataViewModel vm)
        {
            if ((vm.FilterType != FilterType.LinkWitzHp && vm.FilterType != FilterType.LinkWitzLp && vm.Order < 3) &&
                (bf.RequestFilterType == FilterType.LinkWitzHp || bf.RequestFilterType == FilterType.LinkWitzLp) &&
                (DataModel.PEQ.RequiredBiquads() >= (int)DataModel.SpeakerPeqType))
            {
                bf.Cancel = true;
                vm.ResetType();
                return;
            }

            vm.SetType(bf.RequestFilterType);
            vm.SetOrder(2);
            vm.UpdateFilterType();
            UpdateBiquads(vm);
            SendParamData(vm.PeqDataModel);
        }
        private void OrderChanged(BiquadsChangedEventArgs bf, PeqDataViewModel vm)
        {
            //check if this change fits in current filter:
            //value has to be smaller than current value;
            //the order is odd. In this case half of a biquad is used already;
            //There is space left.
            var oldValue = vm.Order;

            vm.SetOrder(bf.RequestOrder);
            if (DataModel.PEQ.RequiredBiquads() <= (int)DataModel.SpeakerPeqType)
            {
                vm.SetOrder(bf.RequestOrder);
                vm.UpdateFilterType();
                UpdateBiquads(vm);
                SendParamData(vm.PeqDataModel);
            }
            else
            {
                vm.SetOrder(oldValue);
                bf.Cancel = true;
            }
        }
 private void FilterChanged(BiquadsChangedEventArgs bf, PeqDataViewModel vm)
 {
     SendParamData(vm.PeqDataModel);
 }