0
0

Hi all,

I’m new to FMOD but had no problem in setting up a simple example that loads a wave file and plays it back through a built-in dsp effect.

Now I tried to make a custom dsp effect which seemed to work fine in the first place, but it seems that I can only change one parameter of the effect. When I try to change a second parameter I get the following error message:
37 : An Invalid parameter was passed to this function.

Here’s how I do:

[code:r5klqg7y]
// Custom effect ...
FMOD::DSP *stateVariableFilter;
FMOD_DSP_DESCRIPTION dspDescription;
memset(&dspDescription, 0, sizeof(FMOD_DSP_DESCRIPTION));
strcpy(dspDescription.name, "FMOD_DSP_STATEVARIABLE");
dspDescription.channels = 0; // 0 = whatever comes in, else specify.
dspDescription.read = stateVariableFilterProcess;
dspDescription.setparameter = stateVariableFilterSetParameter;

FMOD_DSP_PARAMETERDESC cutOff;
cutOff.defaultval = 5000.0f;
cutOff.description = "filter cutOff frequency";
cutOff.min = 0.0f;
cutOff.max = 22000.0f;

FMOD_DSP_PARAMETERDESC resonance;
resonance.defaultval = 0.5f;
resonance.description = "filter resonance";
resonance.min = 0.0f;
resonance.max = 1.0f;

dspDescription.paramdesc = new FMOD_DSP_PARAMETERDESC[2];
dspDescription.paramdesc[0] = cutOff;
dspDescription.paramdesc[1] = resonance;

dspDescription.userdata = (void *)0x12345678;

result = system->createDSP(&dspDescription, &stateVariableFilter);
FmodErrorCheck(result);

// Add the effect to the network ...
result = system->addDSP(stateVariableFilter, 0);
[/code:r5klqg7y]

And later:

[code:r5klqg7y]
result = stateVariableFilter->setParameter(FMOD_DSP_CUTOFF, 500.0f);
FmodErrorCheck(result);
system->update();

Sleep(50);

result = stateVariableFilter->setParameter(FMOD_DSP_RESONANCE, 1.0f);
FmodErrorCheck(result);
system->update();
[/code:r5klqg7y]

SETPARAMCALLBACK:

[code:r5klqg7y]
FMOD_RESULT F_CALLBACK stateVariableFilterSetParameter(FMOD_DSP_STATE *dsp_state, int index, float value)
{
switch(index)
{
case FMOD_DSP_CUTOFF:
filterLeft2->setFrequency(value);
filterRight2->setFrequency(value);
break;
case FMOD_DSP_RESONANCE:
filterLeft2->setResonance(value);
filterRight2->setResonance(value);
break;
}

return FMOD_OK;

}
[/code:r5klqg7y]

I do not have any problems in changing the cutOff frequency, but as soon I try to change the resonance I get the error message.
Could anyone help me with this, please?

Thank you in advance!
Thomas

  • You must to post comments
0
0

[code:f5aqmne7]dspDescription.numparameters = 2;[/code:f5aqmne7]

was missing …

Thank you!
Thomas

  • You must to post comments
0
0

makes sense.. good to see you’re up and running!

  • You must to post comments
0
0

Thanks Brett!

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.