Exemplo n.º 1
0
        public void SetAGCDecayTime(float decayTimeMilliseconds, AGCType_e mode)
        {
            switch (agc_mode)
            {
            case AGCType_e.agcFast:
                fastdecay = decayTimeMilliseconds;
                break;

            case AGCType_e.agcLong:
                longdecay = decayTimeMilliseconds;
                break;

            case AGCType_e.agcMedium:
                mediumdecay = decayTimeMilliseconds;
                break;

            case AGCType_e.agcSlow:
                slowdecay = decayTimeMilliseconds;
                break;

            case AGCType_e.agcUser:
                userdecay = decayTimeMilliseconds;
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// public void setAgc_mode(int Agc_mode)
        /// Should also add a 'custom' mode where tau_decay can be set, along with tau_attack, maybe
        /// </summary>
        /// <param name="Agc_mode">0 for fixed gain, i.e., AGC is OFF, 1 for 'long', 2 for 'slow', 3 for 'medium', 4 for 'fast'</param>
        public void setAgc_mode(AGCType_e Agc_mode)
        //0 for fixed gain, i.e., AGC is OFF
        {
            if ((agc_mode == 0) && (Agc_mode != 0))
            {
                InitWcpAGC();
            }

            switch (Agc_mode)
            {
            case AGCType_e.agcOff:         //AGC off
                break;

            case AGCType_e.agcLong:         //long
                agcHangEnable = true;
                hangtime      = 2.0;
                tau_decay     = 2.0;
                break;

            case AGCType_e.agcSlow:         //slow
                agcHangEnable = true;
                hangtime      = 1.0;
                tau_decay     = 0.500;
                break;

            case AGCType_e.agcMedium:         //medium
                agcHangEnable = false;
                hangtime      = 0.0;
                tau_decay     = 0.250;
                break;

            case AGCType_e.agcFast:         //fast
                agcHangEnable = false;
                hangtime      = 0.0;
                tau_decay     = 0.050;
                break;

            case AGCType_e.agcUser:         // custom...
                agcHangEnable = true;
                hangtime      = 2.0;
                tau_decay     = 2.0;
                break;

            default:
                agcHangEnable = true;
                hangtime      = 2.0;
                tau_decay     = 2.0;
                break;
            }

            agc_mode = Agc_mode;

            LoadWcpAGC();
        }
Exemplo n.º 3
0
        public float GetAGCDecayTime(AGCType_e mode)
        {
            switch (agc_mode)
            {
            case AGCType_e.agcFast:
                return(fastdecay);

            case AGCType_e.agcLong:
                return(longdecay);

            case AGCType_e.agcMedium:
                return(mediumdecay);

            case AGCType_e.agcSlow:
                return(slowdecay);

            case AGCType_e.agcUser:
                return(userdecay);
            }

            return(0.0F);
        }
Exemplo n.º 4
0
        public WCPAGC(ref DSPBuffer dsp_buffer_obj)
        {
            this.d = dsp_buffer_obj;
            this.s = d.State;

            //initialization
            InitWcpAGC();

            //defaults
            agc_mode             = AGCType_e.agcLong;
            sample_rate          = 48000;
            fixed_gain           = 1000;
            n_tau                = 4;
            tau_attack           = 0.001;
            tau_decay            = 0.250;
            tau_fast_decay       = 0.005;
            tau_fast_backaverage = 0.250;
            pop_ratio            = 5;
            out_targ             = 1.0;
            var_gain             = 1.0;
            max_gain             = 100000.0;
            tau_hang_decay       = 0.100;

#if false
            max_input = 1.0;
#else
            // Warren NR0V reports that this change needs to be made in order for things to be
            // in the right position on the screen and other factors.
            max_input = 500.0;
#endif

            hang_thresh       = 0.01;
            hangtime          = 0.250;
            tau_hang_backmult = 0.500;

            //setup calculated variables
            LoadWcpAGC();
        }