Example #1
0
 public static void SetSingleFilterOutputMultiplierAccent(
     OneFilterRec Spec,
     double Value,
     int AccentNum)
 {
     SetAccentMemberValue(ref Spec.OutputMultiplierAccent, AccentNum, Value);
 }
Example #2
0
        public static void SetSingleFilterGain(
            OneFilterRec Spec,
            double Gain,
            PcodeRec Formula)
        {
#if DEBUG
            if ((Spec.FilterType != FilterTypes.eFilterParametricEQ) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ2) &&
                (Spec.FilterType != FilterTypes.eFilterLowShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterHighShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass2))
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
            if (Spec.GainFormula != null)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.GainFormula = Formula;
            Spec.Gain        = Gain;
        }
Example #3
0
        public static void SetSingleFilterBandwidthOrSlope(
            OneFilterRec Spec,
            double BandwidthOrSlope,
            PcodeRec Formula)
        {
#if DEBUG
            if ((Spec.FilterType != FilterTypes.eFilterSecondOrderResonant) &&
                (Spec.FilterType != FilterTypes.eFilterSecondOrderZero) &&
                (Spec.FilterType != FilterTypes.eFilterButterworthBandpass) &&
                (Spec.FilterType != FilterTypes.eFilterButterworthBandreject) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ2) &&
                (Spec.FilterType != FilterTypes.eFilterLowShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterHighShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass))
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
            if (Spec.BandwidthOrSlopeFormula != null)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.BandwidthOrSlopeFormula = Formula;
            Spec.BandwidthOrSlope        = BandwidthOrSlope;
        }
Example #4
0
 public static void SetSingleFilterCutoffAccent(
     OneFilterRec Spec,
     double Value,
     int AccentNum)
 {
     SetAccentMemberValue(ref Spec.CutoffAccent, AccentNum, Value);
 }
Example #5
0
        /* create a new filter specification record */
        public static OneFilterRec NewSingleFilterSpec(FilterTypes FilterType)
        {
            OneFilterRec Spec = new OneFilterRec();

            Spec.CutoffEnvelope           = NewEnvelope();
            Spec.BandwidthOrSlopeEnvelope = NewEnvelope();
            Spec.OutputEnvelope           = NewEnvelope();
            Spec.CutoffLFO           = NewLFOListSpecifier();
            Spec.BandwidthOrSlopeLFO = NewLFOListSpecifier();
            Spec.OutputLFO           = NewLFOListSpecifier();
            Spec.GainEnvelope        = NewEnvelope();
            Spec.GainLFO             = NewLFOListSpecifier();
            //InitializeAccentZero(out Spec.CutoffAccent);
            //InitializeAccentZero(out Spec.BandwidthOrSlopeAccent);
            //InitializeAccentZero(out Spec.GainAccent);
            //InitializeAccentZero(out Spec.OutputMultiplierAccent);
            Spec.FilterType    = FilterType;
            Spec.FilterScaling = FilterScalings.eFilterDefaultScaling;
            Spec.Channel       = FilterChannels.eFilterBoth;
            Spec.LowpassOrder  = 2;
            Spec.BandpassOrder = 2;
            //Spec.Cutoff = 0;
            //Spec.BandwidthOrSlope = 0;
            //Spec.Gain = 0;
            Spec.OutputMultiplier = 1;
            //Spec.CutoffFormula = null;
            //Spec.BandwidthOrSlopeFormula = null;
            //Spec.GainFormula = null;
            //Spec.OutputMultiplierFormula = null;

            return(Spec);
        }
Example #6
0
 /* add a single filter to the list */
 public static void AppendFilterToSpec(
     FilterSpecRec Filter,
     OneFilterRec Spec)
 {
     Array.Resize(ref Filter.List, Filter.List.Length + 1);
     Filter.List[Filter.List.Length - 1] = Spec;
 }
Example #7
0
        /* set filter scaling mode */
        public static void SetSingleFilterScalingMode(
            OneFilterRec Spec,
            FilterScalings Scaling)
        {
#if DEBUG
            switch (Spec.FilterType)
            {
            default:
                Debug.Assert(false);
                throw new ArgumentException();

            case FilterTypes.eFilterNull:
            case FilterTypes.eFilterFirstOrderLowpass:
            case FilterTypes.eFilterFirstOrderHighpass:
            case FilterTypes.eFilterButterworthLowpass:
            case FilterTypes.eFilterButterworthHighpass:
            case FilterTypes.eFilterButterworthBandpass:
            case FilterTypes.eFilterButterworthBandreject:
            case FilterTypes.eFilterParametricEQ:
            case FilterTypes.eFilterParametricEQ2:
            case FilterTypes.eFilterLowShelfEQ:
            case FilterTypes.eFilterHighShelfEQ:
            case FilterTypes.eFilterResonantLowpass:
            case FilterTypes.eFilterResonantLowpass2:
                if (Scaling != FilterScalings.eFilterDefaultScaling)
                {
                    Debug.Assert(false);
                    throw new ArgumentException();
                }
                break;

            case FilterTypes.eFilterSecondOrderResonant:
                if ((Scaling != FilterScalings.eFilterDefaultScaling) &&
                    (Scaling != FilterScalings.eFilterResonMidbandGain1) &&
                    (Scaling != FilterScalings.eFilterResonNoiseGain1))
                {
                    Debug.Assert(false);
                    throw new ArgumentException();
                }
                break;

            case FilterTypes.eFilterSecondOrderZero:
                if ((Scaling != FilterScalings.eFilterDefaultScaling) &&
                    (Scaling != FilterScalings.eFilterZeroGain1))
                {
                    Debug.Assert(false);
                    throw new ArgumentException();
                }
                break;
            }
#endif
            Spec.FilterScaling = Scaling;
        }
Example #8
0
        public static void SetFilterBroken(
            OneFilterRec Spec,
            bool Broken)
        {
#if DEBUG
            if (Spec.FilterType != FilterTypes.eFilterResonantLowpass2)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.Broken = Broken;
        }
Example #9
0
        public static void SetFilterBandpassOrder(
            OneFilterRec Spec,
            int Order)
        {
#if DEBUG
            if (Spec.FilterType != FilterTypes.eFilterResonantLowpass)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.BandpassOrder = Order;
        }
Example #10
0
        public static void SetSingleFilterOutputMultiplier(
            OneFilterRec Spec,
            double Output,
            PcodeRec Formula)
        {
#if DEBUG
            if (Spec.OutputMultiplierFormula != null)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.OutputMultiplierFormula = Formula;
            Spec.OutputMultiplier        = Output;
        }
Example #11
0
        public static void SetSingleFilterCutoff(
            OneFilterRec Spec,
            double Cutoff,
            PcodeRec Formula)
        {
#if DEBUG
            if (Spec.CutoffFormula != null)
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            Spec.CutoffFormula = Formula;
            Spec.Cutoff        = Cutoff;
        }
Example #12
0
        public static void SetSingleFilterGainAccent(
            OneFilterRec Spec,
            double Value,
            int AccentNum)
        {
#if DEBUG
            if ((Spec.FilterType != FilterTypes.eFilterParametricEQ) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ2) &&
                (Spec.FilterType != FilterTypes.eFilterLowShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterHighShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass2))
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            SetAccentMemberValue(ref Spec.GainAccent, AccentNum, Value);
        }
Example #13
0
        public static void SetSingleFilterBandwidthOrSlopeAccent(
            OneFilterRec Spec,
            double Value,
            int AccentNum)
        {
#if DEBUG
            if ((Spec.FilterType != FilterTypes.eFilterSecondOrderResonant) &&
                (Spec.FilterType != FilterTypes.eFilterSecondOrderZero) &&
                (Spec.FilterType != FilterTypes.eFilterButterworthBandpass) &&
                (Spec.FilterType != FilterTypes.eFilterButterworthBandreject) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ) &&
                (Spec.FilterType != FilterTypes.eFilterParametricEQ2) &&
                (Spec.FilterType != FilterTypes.eFilterLowShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterHighShelfEQ) &&
                (Spec.FilterType != FilterTypes.eFilterResonantLowpass))
            {
                Debug.Assert(false);
                throw new ArgumentException();
            }
#endif
            SetAccentMemberValue(ref Spec.BandwidthOrSlopeAccent, AccentNum, Value);
        }
Example #14
0
 /* set filter channel */
 public static void SetSingleFilterChannel(
     OneFilterRec Spec,
     FilterChannels Channel)
 {
     Spec.Channel = Channel;
 }