Remove the synth recreations

This commit is contained in:
Paul Fd 2020-03-15 14:04:22 +01:00
parent 5e40e31c83
commit ac93e0cbd3

View file

@ -48,10 +48,6 @@ tresult PLUGIN_API SfizzVstProcessor::initialize(FUnknown* context)
fprintf(stderr, "[sfizz] new synth\n"); fprintf(stderr, "[sfizz] new synth\n");
_synth.reset(new sfz::Sfizz); _synth.reset(new sfz::Sfizz);
if (!_synth) {
fprintf(stderr, "[sfizz] Could not create synth!\n");
return kResultFalse;
}
return result; return result;
} }
@ -114,16 +110,8 @@ tresult PLUGIN_API SfizzVstProcessor::setActive(TBool state)
{ {
sfz::Sfizz* synth = _synth.get(); sfz::Sfizz* synth = _synth.get();
if (!synth) { if (!synth)
fprintf(stderr, "[sfizz] Synth was destroyed? Trying to recreate...\n"); return kResultFalse;
synth = new sfz::Sfizz;
if (!synth) {
fprintf(stderr, "[sfizz] Something is very wrong\n");
return kResultFalse;
}
_synth.reset(synth);
syncStateToSynth();
}
if (state) { if (state) {
_synth->setSampleRate(processSetup.sampleRate); _synth->setSampleRate(processSetup.sampleRate);