diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-06 04:13:09 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-06 04:13:09 +0100 |
commit | 4674dd85343845b90914439fe049a67102980ad9 (patch) | |
tree | fc4a2503cd0bd7ae911fcf85c669c87adf486fe6 /libs/vamp-plugins | |
parent | b92de5a2fe6afb1f6757a2e9288224cfed9e62d7 (diff) |
Increase accuracy of analyzed true-peak positions
Diffstat (limited to 'libs/vamp-plugins')
-rw-r--r-- | libs/vamp-plugins/TruePeak.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libs/vamp-plugins/TruePeak.cpp b/libs/vamp-plugins/TruePeak.cpp index 9a9f6f93d8..ff5e7562ca 100644 --- a/libs/vamp-plugins/TruePeak.cpp +++ b/libs/vamp-plugins/TruePeak.cpp @@ -593,12 +593,18 @@ VampTruePeak::process(const float *const *inputBuffers, return FeatureSet(); } - _meter.process (inputBuffers[0], m_blockSize); - - // TODO optional (not rt safe) - if (_meter.read () >= .89125 /* -1dBTP */) { - long f = Vamp::RealTime::realTime2Frame (timestamp, m_rate); - _above_m1.values.push_back ((float) f); + size_t remain = m_blockSize; + size_t processed = 0; + while (remain > 0) { + size_t to_proc = std::min ((size_t)48, remain); + _meter.process (&inputBuffers[0][processed], to_proc); + processed += to_proc; + remain -= to_proc; + + if (_meter.read () >= .89125 /* -1dBTP */) { + long f = Vamp::RealTime::realTime2Frame (timestamp, m_rate); + _above_m1.values.push_back ((float) (f + processed)); + } } return FeatureSet(); |