Added REDUCE_LOUDNESS_FACTOR for avoiding digital clipping.

pull/32/head
Holger Wirtz 5 years ago
parent be7e58962f
commit 048b55c4a2
  1. 3
      .gitignore
  2. BIN
      .swp
  3. 3
      config.h
  4. 3
      dexed.cpp

3
.gitignore vendored

@ -30,3 +30,6 @@
*.exe
*.out
*.app
#
*.swp

BIN
.swp

Binary file not shown.

@ -96,7 +96,8 @@
#else
#define AUDIO_MEM 384
#endif
#define REDUCE_LOUDNESS 2
#define REDUCE_LOUDNESS 0
#define REDUCE_LOUDNESS_FACTOR 0.65
#else // IF TEENSY_AUDIO_BOARD
#define SGTL5000_LINEOUT_LEVEL 29
#if AUDIO_BLOCK_SAMPLES == 64

@ -156,6 +156,9 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
#endif
float f = static_cast<float>(clip_val >> REDUCE_LOUDNESS) / 0x7fff;
#if defined(REDUCE_LOUDNESS_FACTOR)
f *= REDUCE_LOUDNESS_FACTOR;
#endif
if (f > 1.0)
{
f = 1.0;

Loading…
Cancel
Save