Hi all,
I am working on a plugin and its all working well but I wanted to use an integer parameter instead of a float and using ceiling on it so i can have the fun strings in the ui for each mode and more responsive behavior. I can’t seem to figure out how to use it correctly though, I’m getting it to build and display the different strings from a const char* array, but when doing the usual m_target_parameter changes it doesnt seem to change on the dial movement. Changing the default uses it well, so I know it has to do something with the m_target and m_current paramaterization. Any help would be awesome!! Thank u :3
Here are some key snippets from my code
const int FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_MIN = 0;
const int FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_MAX = 2;
const int FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_DEFAULT = 0;
const char* spreadToggle[3] = { “off”, “on”, “test”};
//in DSPdescription
FMOD_DSP_INIT_PARAMDESC_INT(p_playback_spread, “rate spread”, “”, “playback rate randomization”, FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_MIN, FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_MAX, FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_DEFAULT, true, spreadToggle);
//public in grainstate class
void setRateSpread(int);
int rateSpread() const {
return m_target_playback_spread;
}
//private in grainstate class
int m_target_playback_spread;
int m_current_playback_spread;
//in grainstate()
m_target_playback_spread(FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD_DEFAULT),
//in reset
m_current_playback_spread = m_target_playback_spread;
void FMODGrainState::setRateSpread(int spread) {
m_current_playback_spread = spread;
m_ramp_samples_left = FMOD_GRAIN_RAMPCOUNT;
}
//in FMOD_Noise_dspsetparamint()
case FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD:
state->setRateSpread(value);
return FMOD_OK;
//in FMOD_Noise_dspgetparamint()
case FMOD_GRAIN_PARAM_GRAIN_PLAYBACK_SPREAD:
*value = state->rateSpread();
return FMOD_OK;
*edit : for reference i have a bunch of other float parameters that go through more or less the same thing and work fine