Exemplo n.º 1
0
        public override void process_int(Channel input1, Channel left_op1, Channel right_op1)
        {
            // (struct effect *p, struct data_block *db)

            Channel      db = input1;
            PhasorParams pp = (PhasorParams)this.parameters;

            RCFilter.LC_filter(db, db.BufferSize, sys.HIGHPASS, pp.f, pp.fd);

            if (pp.bandpass != 0)
            {
                RCFilter.RC_bandpass(db, db.BufferSize, (pp.fd));
            }

            pp.f += pp.df;
            if (pp.f >= pp.freq_high || pp.f <= pp.freq_low)
            {
                pp.df = -pp.df;
            }

            RCFilter.RC_set_freq(pp.f, (pp.fd));
        }
Exemplo n.º 2
0
        public override void process_int(Channel input1, Channel left_op1, Channel right_op1)
        {
            if (this.parameters.enable)
            {
                Effect  p  = this;
                Channel db = input1;

                int count,
                    currchannel = 0;
                Channel          s;
                DistortionParams dp;

                dp = (DistortionParams)this.parameters;

                /*
                 * sat clips derivative by limiting difference between samples. Use lastval
                 * member to store last sample for seamlessness between chunks.
                 */
                count = db.BufferSize;
                s     = input1;;

                RCFilter.RC_highpass(input1, input1.BufferSize, dp.fd);

                int i = 0;
                while (count > 0)
                {
                    /*
                     * apply drive
                     */
                    input1[i] *= dp.drive;
                    //   input1[i] /= 16;

                    /*
                     * apply sat
                     */



                    if ((s[i] - dp.lastval[currchannel]) > dp.sat)
                    {
                        s[i] = dp.lastval[currchannel] + dp.sat;
                    }
                    else if ((dp.lastval[currchannel] - s[i]) > dp.sat)
                    {
                        s[i] = dp.lastval[currchannel] - dp.sat;
                    }

                    dp.lastval[currchannel] = input1[i];


                    input1[i] *= dp.level;
                    //input1[i] /= 256;

                    // debug

                    count--;
                    i++;
                }

                RCFilter.LC_filter(db, db.BufferSize, sys.LOWPASS, dp.lowpass, dp.noise);
            }
        }