public override void process_int(BlueWave.Interop.Asio.Channel input1, BlueWave.Interop.Asio.Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
        {
            Channel       s;
            float         ratio;
            int           count;
            VibratoParams vp;

            s     = input1;
            count = input1.BufferSize;

            vp = (VibratoParams)parameters;
            int i = 0;

            while (count > 0)
            {
                ratio = sys.VIBRATO_THRESHOLD + (vp.phase_buffer[vp.vibrato_phase] * vp.vibrato_amplitude);
                s[i]  = s[i] * (ratio / sys.VIBRATO_THRESHOLD);

                vp.vibrato_phase++;

                if (vp.vibrato_phase >= vp.vibrato_speed ||
                    vp.vibrato_phase > sys.MAX_VIBRATO_BUFSIZE)
                {
                    vp.vibrato_phase = 0;
                }

                i++;
                count--;
            }
        }
        public override void process_int(BlueWave.Interop.Asio.Channel input1, BlueWave.Interop.Asio.Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
        {
            if (parameters.enable)
            {
                // struct effect *p, struct data_block *db
                ChorusParams cp;
                int          count;
                Channel      s;
                int          dly = 0;
                float        AngInc,
                             Ang;
                float tmp,
                      tot,
                      rgn;
                int currchannel = 0;

                cp = (ChorusParams)this.parameters;

                s     = input1;
                count = input1.BufferSize;

                //#define MaxDly ((int)cp->depth * 8)
                int MaxDly = (cp.depth * 8);
                AngInc = cp.speed / 1000.0f;
                Ang    = cp.ang;

                /*
                 * process the samples
                 */
                int ii = 0;
                while (0 < count)
                {
                    tmp  = s[ii];
                    tmp *= cp.dry;
                    tmp /= 256;
                    switch (cp.mode)
                    {
                    case 0:             /* chorus */
                        dly = MaxDly * (1024 + sys.sinLookUp[(int)cp.ang]);
                        break;

                    case 1:             /* flange */
                        dly = 16 * MaxDly * (1024 + sys.sinLookUp[(int)Ang] / 16);
                        break;
                    }
                    ;
                    dly /= 2048;
                    Ang += AngInc;
                    if (Ang >= 359.0f)
                    {
                        Ang = 0.0f;
                    }
                    if (dly < 0)
                    {
                        dly = 0;
                    }

                    tot  = cp.memory[currchannel].backbuff_get(dly);
                    tot *= cp.wet;
                    tot /= 256;
                    tot += tmp;

                    rgn =
                        (cp.memory[currchannel].backbuff_get(dly) * cp.regen) / 256 + s[ii];


                    cp.memory[currchannel].backbuff_add(rgn);
                    s[ii] = tot;


                    ii++;
                    count--;
                }

                cp.ang = Ang;
            }
        }
 public override void process_int(Channel input1, Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
        public override void process_int(Channel input1, BlueWave.Interop.Asio.Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
        {
//            reverb_filter(struct effect *p, struct data_block *db)
//{
            ReverbParams dr;
            Channel      s;
            int          Dry,
                         Wet,
                         Rgn,
                         dd,
                         count;

            float[] Old,
            Old2
            ;
            float tmp, Out,
                  tot;

            dr = (ReverbParams)parameters;

            s     = input1;
            count = input1.BufferSize;

            /*
             * get delay
             */
            dd = dr.delay;
            dd = (dd < 1) ? 1 : ((dd >= dr.history.nChunks) ? dr.history.nChunks - 1 : dd);

            /*
             * get parms
             */
            Dry = dr.dry;
            Wet = dr.wet;
            Rgn = dr.regen;

            Old = dr.history.reverbBuffer_getChunk(dd);

            if (Old == null)
            {
                MessageBox.Show("no old data");
            }
            Old2 = Old;
            int i = 0, oldi = 0;

            while (count > 0)
            {
                /*
                 * mix Old and In into Out, based upon Wet/Dry
                 * then mix Out and In back into In, based upon Rgn/1
                 */
                tmp  = s[i];
                tmp *= Dry;
                tmp /= 256;
                try
                {
                    tot = Old[i];
                }
                catch (Exception)
                {
                    //    MessageBox.Show("exception in old");
                    tot = 1;
                }

                tot *= Wet;
                tot /= 256;
                tot += tmp;
                Out  = tot;

                tot *= Rgn;
                tot /= 256;
                tot += s[i];

                s[i] = tot;
                i++;
                oldi++;
                count--;
            }


            float[] tobeadde = new float[s.BufferSize];
            for (int l = 0; l < s.BufferSize; l++)
            {
                tobeadde[l] = s[l];
            }

            dr.history.reverbBuffer_addChunk(tobeadde);
            Old2 = null;
        }
Exemple #5
0
        public override void process_int(BlueWave.Interop.Asio.Channel input1, BlueWave.Interop.Asio.Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
        {
//            sustain_filter(struct effect *p, struct data_block *db)
//{

            int           count;
            Channel       s, db;
            SustainParams ds;
            float         volAccum,
                          tmp;
            float CompW1;
            float CompW2;
            float gateFac;
            float compFac;

            ds    = (SustainParams)parameters;
            db    = input1;
            count = db.BufferSize;
            s     = db;

            volAccum = ds.volaccum;
            CompW1   = ds.sust / 100.0f;
            CompW2   = 1.0f - CompW1;

            int i = 0;

            while (count > 0)
            {
                tmp = s[i];

                /*
                 * update volAccum
                 */
                tmp       = (tmp < 0) ? -tmp : tmp;
                volAccum  = (256 - ds.noise) * volAccum + ds.noise * tmp;
                volAccum /= 256;

                /*
                 * handle compression
                 */
                compFac = 30000.0f / (float)volAccum;
                compFac = CompW1 * compFac + CompW2;

                /*
                 * handle gate
                 */
                if (ds.threshold <= 1.0f)
                {
                    gateFac = 1.0f;
                }
                else
                {
                    gateFac = (volAccum > (ds.threshold * 100)) ? 1.0f :
                              ((float)(volAccum) / (float)(ds.threshold * 100));
                }

                /*
                 * process signal...
                 */
                tmp  = ((float)(s[i]) * compFac * gateFac);
                s[i] = tmp;
                i++;
                count--;
            }
            ds.volaccum = (int)volAccum;
        }
Exemple #6
0
        public override void process_int(BlueWave.Interop.Asio.Channel input1, BlueWave.Interop.Asio.Channel left_op1, BlueWave.Interop.Asio.Channel right_op1)
        {
            if (parameters.enable)
            {
                DelayParams dp;
                int         i,
                            count,
                            current_decay;
                Channel s;

                dp = (DelayParams)this.parameters;

                s     = input1;
                count = s.BufferSize;

                int j = 0;
                while (count > 0)
                {
                    /*
                     * add sample to history
                     */
                    dp.history[dp.index++] = s[j];

                    /*
                     * wrap around
                     */
                    if (dp.index == dp.delay_size)
                    {
                        dp.index = 0;
                    }

                    current_decay = dp.delay_decay;
                    for (i = 0; i < dp.delay_count; i++)
                    {
                        if (dp.index >= dp.idelay[i])
                        {
                            if (dp.index - dp.idelay[i] ==
                                dp.delay_start + i * dp.delay_step)
                            {
                                dp.idelay[i]++;
                            }
                        }
                        else if (dp.delay_size + dp.index - dp.idelay[i] ==
                                 dp.delay_start + i * dp.delay_step)
                        {
                            dp.idelay[i]++;
                        }
                        if (dp.idelay[i] == dp.delay_size)
                        {
                            dp.idelay[i] = 0;
                        }

                        s[j]         += dp.history[dp.idelay[i]] * current_decay / 1000;
                        current_decay = current_decay * dp.delay_decay / 1000;
                    }

                    j++;
                    count--;
                }
            }
        }