Apply a small base gain to avoid clipping

This commit is contained in:
paulfd 2019-08-28 17:22:45 +02:00
parent 02a8b56ce1
commit 35ad102a6a
3 changed files with 9 additions and 1 deletions

View file

@ -59,7 +59,7 @@ namespace Default
inline constexpr Range<uint8_t> ccTriggerValueRange{ 0, 127 };
// Performance parameters: amplifier
inline constexpr float volume { 0.0 };
inline constexpr float volume { -3.0 };
inline constexpr Range<float> volumeRange { -144.0, 6.0 };
inline constexpr Range<float> volumeCCRange { -144.0, 6.0 };
inline constexpr float amplitude { 100.0 };

View file

@ -88,6 +88,12 @@ public:
::applyGain<Type>(gain, rightBuffer);
}
void applyGain(Type gain) noexcept
{
::applyGain<Type>(gain, leftBuffer);
::applyGain<Type>(gain, rightBuffer);
}
void readInterleaved(absl::Span<const Type> input) noexcept
{
ASSERT(input.size() <= static_cast<size_t>(numChannels * numFrames));

View file

@ -135,6 +135,8 @@ public:
egEnvelope.getBlock(tempSpan1.first(numSamples));
buffer.applyGain(tempSpan1);
buffer.applyGain(baseGain);
if (!egEnvelope.isSmoothing())
reset();
}