[C#] Dynamic DSP.setParameter


(launcher) #1

Hi, I want to play sound with effect.

In example, I’m using low and highpass, I want to set the parameters of two effect with the mouse location (x, y).

I used DSP.reset() and DSP.setParameter(), but, there is a problem.

If I moved the mouse faster and faster, the Sound is not smooth.

The original sound is played between time of the code reset() and setParameter() .

Therefore I can hear a sound like spark( ‘tick! tick!’).

I want to make it smooth.

Is there any way??

 private void mouse_effect_move(object sender, MouseEventArgs e)
        {
            
            int i;
            i = e.Y / 10;

            dsplowpass.reset();
            dsphighpass.reset();

            if (i < 9)
            {
                dsphighpass.setParameter(0, 6310 - 700 * i);
                //dsphighpass.setParameter(1, 1);
                
            }
            else
            {
                dsplowpass.setParameter(0, 22000 - 2200 * (i - 9));
                //dsplowpass.setParameter(1, 1);
            }
            
        }

(launcher) #2

its my current code.


(Mathew Block) #3

Using DSP::reset is usually reserved for when you are reusing a DSP on a different FMOD::Sound and you want to reset any state. You shouldn’t call it when you are simply updating parameters.


(launcher) #4

should I use DSP.remove ??


(Mathew Block) #5

No, the DSP::setParameter is sufficient on its own.


(launcher) #6

You mean do not use DSP::remove(), do use just DSP::setParameter?


(Mathew Block) #7

Yes


(launcher) #8

Thank you. I thought, the effect piled up when use just setParameter. I fixed thx.