picking soundfont no longer crashes synth
This commit is contained in:
parent
374394330f
commit
568495ea74
|
@ -196,21 +196,22 @@ void FluidSynthModel::initialise() {
|
||||||
fluid_mod_set_amount(mod.get(), 1000.0f);
|
fluid_mod_set_amount(mod.get(), 1000.0f);
|
||||||
fluid_synth_add_default_mod(synth.get(), mod.get(), FLUID_SYNTH_ADD);
|
fluid_synth_add_default_mod(synth.get(), mod.get(), FLUID_SYNTH_ADD);
|
||||||
|
|
||||||
valueTree.sendPropertyChangeMessage("soundFontPath");
|
valueTreeState.state.sendPropertyChangeMessage("soundFontPath");
|
||||||
|
// valueTree.sendPropertyChangeMessage("soundFontPath");
|
||||||
|
|
||||||
// initialised = true;
|
// initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluidSynthModel::valueTreePropertyChanged(ValueTree& treeWhosePropertyHasChanged,
|
void FluidSynthModel::valueTreePropertyChanged(ValueTree& treeWhosePropertyHasChanged,
|
||||||
const Identifier& property) {
|
const Identifier& property) {
|
||||||
if (&treeWhosePropertyHasChanged == &valueTree) {
|
// if (&treeWhosePropertyHasChanged == &valueTree) {
|
||||||
if (property == Identifier("soundFontPath")) {
|
if (property == Identifier("soundFontPath")) {
|
||||||
String soundFontPath{treeWhosePropertyHasChanged.getProperty("soundFontPath", "")};
|
String soundFontPath{treeWhosePropertyHasChanged.getProperty("soundFontPath", "")};
|
||||||
if (soundFontPath.isNotEmpty()) {
|
if (soundFontPath.isNotEmpty()) {
|
||||||
loadFont(soundFontPath);
|
loadFont(soundFontPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluidSynthModel::setControllerValue(int controller, int value) {
|
void FluidSynthModel::setControllerValue(int controller, int value) {
|
||||||
|
@ -318,7 +319,8 @@ void FluidSynthModel::onFileNameChanged(const String &absPath, int bank, int pre
|
||||||
}
|
}
|
||||||
unloadAndLoadFont(absPath);
|
unloadAndLoadFont(absPath);
|
||||||
changePreset(bank, preset);
|
changePreset(bank, preset);
|
||||||
valueTree.setPropertyExcludingListener(this, "soundFontPath", absPath, nullptr);
|
valueTreeState.state.setPropertyExcludingListener(this, "soundFontPath", absPath, nullptr);
|
||||||
|
// valueTree.setPropertyExcludingListener(this, "soundFontPath", absPath, nullptr);
|
||||||
// sharedParams.setSoundFontPath(absPath);
|
// sharedParams.setSoundFontPath(absPath);
|
||||||
eventListeners.call(&FluidSynthModel::Listener::fontChanged, this, absPath);
|
eventListeners.call(&FluidSynthModel::Listener::fontChanged, this, absPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user