Logging and bug in the gain computations
This commit is contained in:
parent
29488f5d40
commit
4cd9665b48
2 changed files with 8 additions and 3 deletions
|
|
@ -627,7 +627,7 @@ float sfz::Region::getBaseVolumedB() noexcept
|
|||
|
||||
float sfz::Region::getBaseGain() noexcept
|
||||
{
|
||||
return amplitude;
|
||||
return normalizePercents(amplitude);
|
||||
}
|
||||
|
||||
uint32_t sfz::Region::getOffset() noexcept
|
||||
|
|
@ -695,7 +695,7 @@ float crossfadeOut(const Range<T>& crossfadeRange, U value, SfzCrossfadeCurve cu
|
|||
|
||||
float sfz::Region::getNoteGain(int noteNumber, uint8_t velocity) noexcept
|
||||
{
|
||||
float baseGain { 1.0 };
|
||||
float baseGain { 1.0f };
|
||||
|
||||
// Amplitude key tracking
|
||||
baseGain *= db2mag(ampKeytrack * static_cast<float>(noteNumber - ampKeycenter));
|
||||
|
|
@ -739,7 +739,7 @@ float sfz::Region::getCrossfadeGain(const sfz::CCValueArray& ccState) noexcept
|
|||
|
||||
float sfz::Region::velocityCurve(uint8_t velocity) const noexcept
|
||||
{
|
||||
float gain { 1.0 };
|
||||
float gain { 1.0f };
|
||||
|
||||
if (velocityPoints.size() > 0) { // Custom velocity curve
|
||||
auto after = std::find_if(velocityPoints.begin(), velocityPoints.end(), [velocity](auto& val) { return val.first >= velocity; });
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ void sfz::Voice::startVoice(Region* region, int delay, int channel, int number,
|
|||
if (region->volumeCC)
|
||||
volumedB += normalizeCC(ccState[region->volumeCC->first]) * region->volumeCC->second;
|
||||
volumeEnvelope.reset(db2mag(volumedB));
|
||||
DBG("Base volume: " << baseVolumedB << " dB - with modifier: " << volumedB << " dB");
|
||||
|
||||
baseGain = region->getBaseGain();
|
||||
baseGain *= region->getCrossfadeGain(ccState);
|
||||
|
|
@ -68,24 +69,28 @@ void sfz::Voice::startVoice(Region* region, int delay, int channel, int number,
|
|||
if (region->amplitudeCC)
|
||||
gain *= normalizeCC(ccState[region->amplitudeCC->first]) * normalizePercents(region->amplitudeCC->second);
|
||||
amplitudeEnvelope.reset(gain);
|
||||
DBG("Base gain: " << baseGain << " - with modifier: " << gain);
|
||||
|
||||
basePan = normalizeNegativePercents(region->pan);
|
||||
auto pan = basePan;
|
||||
if (region->panCC)
|
||||
pan += normalizeCC(ccState[region->panCC->first]) * normalizeNegativePercents(region->panCC->second);
|
||||
panEnvelope.reset(pan);
|
||||
DBG("Base pan: " << basePan << " - with modifier: " << pan);
|
||||
|
||||
basePosition = normalizeNegativePercents(region->position);
|
||||
auto position = basePosition;
|
||||
if (region->positionCC)
|
||||
position += normalizeCC(ccState[region->positionCC->first]) * normalizeNegativePercents(region->positionCC->second);
|
||||
positionEnvelope.reset(position);
|
||||
DBG("Base position: " << basePosition << " - with modifier: " << position);
|
||||
|
||||
baseWidth = normalizeNegativePercents(region->width);
|
||||
auto width = baseWidth;
|
||||
if (region->widthCC)
|
||||
width += normalizeCC(ccState[region->widthCC->first]) * normalizeNegativePercents(region->widthCC->second);
|
||||
widthEnvelope.reset(width);
|
||||
DBG("Base width: " << baseWidth << " - with modifier: " << width);
|
||||
|
||||
sourcePosition = region->getOffset();
|
||||
floatPosition = static_cast<float>(sourcePosition);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue