Merge pull request #285 from jpcima/settings-per-voice
Keep voice settings and restore them after polyphony change
This commit is contained in:
commit
ba0c68f5a1
2 changed files with 28 additions and 5 deletions
|
|
@ -491,11 +491,11 @@ void sfz::Synth::finalizeSfzLoad()
|
|||
regions.resize(currentRegionCount);
|
||||
modificationTime = checkModificationTime();
|
||||
|
||||
for (auto& voice : voices) {
|
||||
voice->setMaxFiltersPerVoice(maxFilters);
|
||||
voice->setMaxEQsPerVoice(maxEQs);
|
||||
voice->prepareSmoothers(maxModifiers);
|
||||
}
|
||||
settingsPerVoice.maxFilters = maxFilters;
|
||||
settingsPerVoice.maxEQs = maxEQs;
|
||||
settingsPerVoice.maxModifiers = maxModifiers;
|
||||
|
||||
applySettingsPerVoice();
|
||||
}
|
||||
|
||||
bool sfz::Synth::loadScalaFile(const fs::path& path)
|
||||
|
|
@ -1205,6 +1205,17 @@ void sfz::Synth::resetVoices(int numVoices)
|
|||
}
|
||||
|
||||
this->numVoices = numVoices;
|
||||
|
||||
applySettingsPerVoice();
|
||||
}
|
||||
|
||||
void sfz::Synth::applySettingsPerVoice()
|
||||
{
|
||||
for (auto& voice : voices) {
|
||||
voice->setMaxFiltersPerVoice(settingsPerVoice.maxFilters);
|
||||
voice->setMaxEQsPerVoice(settingsPerVoice.maxEQs);
|
||||
voice->prepareSmoothers(settingsPerVoice.maxModifiers);
|
||||
}
|
||||
}
|
||||
|
||||
void sfz::Synth::setOversamplingFactor(sfz::Oversampling factor) noexcept
|
||||
|
|
|
|||
|
|
@ -631,6 +631,10 @@ private:
|
|||
* @param numVoices
|
||||
*/
|
||||
void resetVoices(int numVoices);
|
||||
/**
|
||||
* @brief Make the stored settings take effect in all the voices
|
||||
*/
|
||||
void applySettingsPerVoice();
|
||||
|
||||
/**
|
||||
* @brief Render the voice to its designated outputs and effect busses.
|
||||
|
|
@ -702,6 +706,14 @@ private:
|
|||
int noteOffset { 0 };
|
||||
int octaveOffset { 0 };
|
||||
|
||||
// Settings per voice
|
||||
struct SettingsPerVoice {
|
||||
size_t maxFilters { 0 };
|
||||
size_t maxEQs { 0 };
|
||||
ModifierArray<size_t> maxModifiers { 0 };
|
||||
};
|
||||
SettingsPerVoice settingsPerVoice;
|
||||
|
||||
Duration dispatchDuration { 0 };
|
||||
|
||||
Parser parser;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue