guess we shouldn't take the easy route of defaulting to 0, since the other parts of fluidsynthmodel are diligent enough to grab their initial values from the value tree (even if it's all-but-certain that the value tree won't have been inited yet)

This commit is contained in:
Alex Birch 2019-07-30 21:52:44 +01:00
parent 7dd9bb4c22
commit 21caa98fd8
No known key found for this signature in database
GPG Key ID: 305EB1F98D44ACBA

View File

@ -82,11 +82,23 @@ void FluidSynthModel::initialise() {
fluid_synth_set_gain(synth.get(), 2.0); fluid_synth_set_gain(synth.get(), 2.0);
// note: fluid_chan.c#fluid_channel_init_ctrl() // note: fluid_chan.c#fluid_channel_init_ctrl()
// all SOUND_CTRL are inited with value of 64, not zero. // > Just like panning, a value of 64 indicates no change for sound ctrls
// "Just like panning, a value of 64 indicates no change for sound ctrls" // --
// and yet, I'm finding that default modulators start at MIN, so we are forced to start at 0 and climb from there // so, advice is to leave everything at 64
for (const auto &[controller, param]: controllerToParam) { // and yet, I'm finding that default modulators start at MIN,
setControllerValue(static_cast<int>(controller), 0); // i.e. we are forced to start at 0 and climb from there
// --
// let's loop through all audio params that we manage,
// restore them to whatever value we have stored for them
// (which by default would be 0)
// super likely to be 0 regardless, since JuicySFAudioProcessor::initialise()
// runs earlier than JuicySFAudioProcessor::setStateInformation()
for (const auto &[controller, parameterID]: controllerToParam) {
RangedAudioParameter *param{valueTreeState.getParameter(parameterID)};
jassert(dynamic_cast<AudioParameterInt*>(param) != nullptr);
AudioParameterInt* castParam{dynamic_cast<AudioParameterInt*>(param)};
int value{castParam->get()};
setControllerValue(static_cast<int>(controller), value);
} }
// http://www.synthfont.com/SoundFont_NRPNs.PDF // http://www.synthfont.com/SoundFont_NRPNs.PDF