summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/inputprocessor.cc5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b656f48..6278ecb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,7 +36,7 @@ libdg_la_CPPFLAGS = \
$(SNDFILE_CFLAGS) $(PTHREAD_CFLAGS)
libdg_la_LIBADD = \
- $(SNDFILE_LIBS) $(PTHREAD_LIBS) libzr.la libpugi.la
+ $(SNDFILE_LIBS) $(PTHREAD_LIBS) libzr.la libpugi.la -lm
libdg_la_SOURCES = \
audiocachefile.cc \
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc
index 4bafb1d..19e76a5 100644
--- a/src/inputprocessor.cc
+++ b/src/inputprocessor.cc
@@ -27,6 +27,7 @@
#include "inputprocessor.h"
#include <list>
+#include <cmath>
#include <hugin.hpp>
@@ -285,7 +286,9 @@ bool InputProcessor::processOnset(event_t& event, std::size_t pos,
event_sample.offset = (event.offset + pos) * resample_ratio;
if(settings.normalized_samples.load() && sample->getNormalized())
{
- event_sample.scale *= event.velocity;
+ // To amortize with the non-normalized perceived sample power
+ // the velocity is square-rooted.
+ event_sample.scale *= std::sqrt(event.velocity);
}
}
}