Some cleanup of the sustain logic

This commit is contained in:
paulfd 2019-09-17 14:52:47 +02:00
parent de757e0964
commit 90f61b24fb
3 changed files with 4 additions and 4 deletions

View file

@ -28,7 +28,7 @@ namespace sfz {
namespace config {
constexpr float defaultSampleRate { 48000 };
constexpr int defaultSamplesPerBlock { 1024 };
constexpr int preloadSize { 8192 };
constexpr int preloadSize { 8192 * 4 };
constexpr int numChannels { 2 };
constexpr int numVoices { 64 };
constexpr int sustainCC { 64 };

View file

@ -153,7 +153,7 @@ void sfz::Voice::registerNoteOff(int delay, int channel, int noteNumber, uint8_t
if (region->loopMode == SfzLoopMode::one_shot)
return;
if (!region->checkSustain || ccState[config::sustainCC] < config::halfCCThreshold)
if (region->checkSustain && ccState[config::sustainCC] < config::halfCCThreshold)
release(delay);
}
}
@ -163,7 +163,7 @@ void sfz::Voice::registerCC(int delay, int channel [[maybe_unused]], int ccNumbe
if (region == nullptr)
return;
if (ccNumber == config::sustainCC && noteIsOff && ccValue < config::halfCCThreshold)
if (region->checkSustain && noteIsOff && ccNumber == config::sustainCC && ccValue < config::halfCCThreshold)
release(delay);
if (region->amplitudeCC && ccNumber == region->amplitudeCC->first) {

View file

@ -121,7 +121,7 @@ private:
absl::Span<int> indexSpan { absl::MakeSpan(indexBuffer) };
int samplesPerBlock { config::defaultSamplesPerBlock };
double sampleRate { config::defaultSampleRate };
float sampleRate { config::defaultSampleRate };
const CCValueArray& ccState;
ADSREnvelope<float> egEnvelope;