From 90f61b24fb0a53d1055d9d4523e64a00dcc64adc Mon Sep 17 00:00:00 2001 From: paulfd Date: Tue, 17 Sep 2019 14:52:47 +0200 Subject: [PATCH] Some cleanup of the sustain logic --- sfizz/Config.h | 2 +- sfizz/Voice.cpp | 4 ++-- sfizz/Voice.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sfizz/Config.h b/sfizz/Config.h index 73fcd757..20b97e2c 100644 --- a/sfizz/Config.h +++ b/sfizz/Config.h @@ -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 }; diff --git a/sfizz/Voice.cpp b/sfizz/Voice.cpp index 3132cb3e..ee05e07e 100644 --- a/sfizz/Voice.cpp +++ b/sfizz/Voice.cpp @@ -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) { diff --git a/sfizz/Voice.h b/sfizz/Voice.h index 86fa6b80..42b18bcc 100644 --- a/sfizz/Voice.h +++ b/sfizz/Voice.h @@ -121,7 +121,7 @@ private: absl::Span indexSpan { absl::MakeSpan(indexBuffer) }; int samplesPerBlock { config::defaultSamplesPerBlock }; - double sampleRate { config::defaultSampleRate }; + float sampleRate { config::defaultSampleRate }; const CCValueArray& ccState; ADSREnvelope egEnvelope;