Add a bend step factor in the voice
This commit is contained in:
parent
5d94521af9
commit
c763e819bb
2 changed files with 10 additions and 4 deletions
|
|
@ -105,6 +105,7 @@ void sfz::Voice::startVoice(Region* region, int delay, int channel, int number,
|
||||||
sourcePosition = region->getOffset();
|
sourcePosition = region->getOffset();
|
||||||
initialDelay = delay + static_cast<uint32_t>(region->getDelay() * sampleRate);
|
initialDelay = delay + static_cast<uint32_t>(region->getDelay() * sampleRate);
|
||||||
baseFrequency = midiNoteFrequency(number);
|
baseFrequency = midiNoteFrequency(number);
|
||||||
|
bendStepFactor = centsFactor(region->bendStep);
|
||||||
prepareEGEnvelope(initialDelay, value);
|
prepareEGEnvelope(initialDelay, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,8 +372,10 @@ void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
||||||
auto rightCoeffs = tempSpan2.first(buffer.getNumFrames());
|
auto rightCoeffs = tempSpan2.first(buffer.getNumFrames());
|
||||||
|
|
||||||
fill<float>(jumps, pitchRatio * speedRatio);
|
fill<float>(jumps, pitchRatio * speedRatio);
|
||||||
if (region->bendStep > 1)
|
if (region->bendStep > 1){
|
||||||
pitchBendEnvelope.getQuantizedBlock(bends, region->bendStep);
|
pitchBendEnvelope.getQuantizedBlock(bends, bendStepFactor);
|
||||||
|
DBG("Last bend value " << bends.back());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pitchBendEnvelope.getBlock(bends);
|
pitchBendEnvelope.getBlock(bends);
|
||||||
|
|
||||||
|
|
@ -459,8 +462,10 @@ void sfz::Voice::fillWithGenerator(AudioSpan<float> buffer) noexcept
|
||||||
const float step = baseFrequency * twoPi<float> / sampleRate;
|
const float step = baseFrequency * twoPi<float> / sampleRate;
|
||||||
fill<float>(jumps, step);
|
fill<float>(jumps, step);
|
||||||
|
|
||||||
if (region->bendStep > 1)
|
if (region->bendStep > 1){
|
||||||
pitchBendEnvelope.getQuantizedBlock(bends, region->bendStep);
|
pitchBendEnvelope.getQuantizedBlock(bends, bendStepFactor);
|
||||||
|
DBG("Last bend value " << bends.back());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pitchBendEnvelope.getBlock(bends);
|
pitchBendEnvelope.getBlock(bends);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,7 @@ private:
|
||||||
LinearEnvelope<float> positionEnvelope;
|
LinearEnvelope<float> positionEnvelope;
|
||||||
LinearEnvelope<float> widthEnvelope;
|
LinearEnvelope<float> widthEnvelope;
|
||||||
MultiplicativeEnvelope<float> pitchBendEnvelope;
|
MultiplicativeEnvelope<float> pitchBendEnvelope;
|
||||||
|
float bendStepFactor { centsFactor(1) };
|
||||||
|
|
||||||
HistoricalBuffer<float> powerHistory { config::powerHistoryLength };
|
HistoricalBuffer<float> powerHistory { config::powerHistoryLength };
|
||||||
LEAK_DETECTOR(Voice);
|
LEAK_DETECTOR(Voice);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue