Some cleanup of the sustain logic
This commit is contained in:
parent
de757e0964
commit
90f61b24fb
3 changed files with 4 additions and 4 deletions
|
|
@ -28,7 +28,7 @@ namespace sfz {
|
||||||
namespace config {
|
namespace config {
|
||||||
constexpr float defaultSampleRate { 48000 };
|
constexpr float defaultSampleRate { 48000 };
|
||||||
constexpr int defaultSamplesPerBlock { 1024 };
|
constexpr int defaultSamplesPerBlock { 1024 };
|
||||||
constexpr int preloadSize { 8192 };
|
constexpr int preloadSize { 8192 * 4 };
|
||||||
constexpr int numChannels { 2 };
|
constexpr int numChannels { 2 };
|
||||||
constexpr int numVoices { 64 };
|
constexpr int numVoices { 64 };
|
||||||
constexpr int sustainCC { 64 };
|
constexpr int sustainCC { 64 };
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ void sfz::Voice::registerNoteOff(int delay, int channel, int noteNumber, uint8_t
|
||||||
if (region->loopMode == SfzLoopMode::one_shot)
|
if (region->loopMode == SfzLoopMode::one_shot)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!region->checkSustain || ccState[config::sustainCC] < config::halfCCThreshold)
|
if (region->checkSustain && ccState[config::sustainCC] < config::halfCCThreshold)
|
||||||
release(delay);
|
release(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +163,7 @@ void sfz::Voice::registerCC(int delay, int channel [[maybe_unused]], int ccNumbe
|
||||||
if (region == nullptr)
|
if (region == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ccNumber == config::sustainCC && noteIsOff && ccValue < config::halfCCThreshold)
|
if (region->checkSustain && noteIsOff && ccNumber == config::sustainCC && ccValue < config::halfCCThreshold)
|
||||||
release(delay);
|
release(delay);
|
||||||
|
|
||||||
if (region->amplitudeCC && ccNumber == region->amplitudeCC->first) {
|
if (region->amplitudeCC && ccNumber == region->amplitudeCC->first) {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ private:
|
||||||
absl::Span<int> indexSpan { absl::MakeSpan(indexBuffer) };
|
absl::Span<int> indexSpan { absl::MakeSpan(indexBuffer) };
|
||||||
|
|
||||||
int samplesPerBlock { config::defaultSamplesPerBlock };
|
int samplesPerBlock { config::defaultSamplesPerBlock };
|
||||||
double sampleRate { config::defaultSampleRate };
|
float sampleRate { config::defaultSampleRate };
|
||||||
|
|
||||||
const CCValueArray& ccState;
|
const CCValueArray& ccState;
|
||||||
ADSREnvelope<float> egEnvelope;
|
ADSREnvelope<float> egEnvelope;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue