mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 00:56:33 +01:00
export analysis: include true-peak positions.
This commit is contained in:
parent
a60312cfea
commit
50145a93e6
2 changed files with 12 additions and 1 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
#define __ardour_export_analysis_h__
|
#define __ardour_export_analysis_h__
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
|
@ -53,6 +54,7 @@ namespace ARDOUR {
|
||||||
, have_loudness (other.have_loudness)
|
, have_loudness (other.have_loudness)
|
||||||
, have_dbtp (other.have_dbtp)
|
, have_dbtp (other.have_dbtp)
|
||||||
, n_channels (other.n_channels)
|
, n_channels (other.n_channels)
|
||||||
|
, truepeakpos (other.truepeakpos)
|
||||||
{
|
{
|
||||||
memcpy (peaks, other.peaks, sizeof(peaks));
|
memcpy (peaks, other.peaks, sizeof(peaks));
|
||||||
memcpy (spectrum, other.spectrum, sizeof(spectrum));
|
memcpy (spectrum, other.spectrum, sizeof(spectrum));
|
||||||
|
|
@ -74,6 +76,7 @@ namespace ARDOUR {
|
||||||
|
|
||||||
PeakData peaks[2][800];
|
PeakData peaks[2][800];
|
||||||
float spectrum[800][200];
|
float spectrum[800][200];
|
||||||
|
std::set<framecnt_t> truepeakpos[2]; // bins with >= -1dBTB
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr;
|
typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr;
|
||||||
|
|
|
||||||
|
|
@ -248,13 +248,21 @@ Analyser::result ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned cmask = _result.n_channels - 1; // [0, 1]
|
||||||
for (unsigned int c = 0; c < _channels; ++c) {
|
for (unsigned int c = 0; c < _channels; ++c) {
|
||||||
if (!_dbtp_plugin[c]) { continue; }
|
if (!_dbtp_plugin[c]) { continue; }
|
||||||
Vamp::Plugin::FeatureSet features = _dbtp_plugin[c]->getRemainingFeatures ();
|
Vamp::Plugin::FeatureSet features = _dbtp_plugin[c]->getRemainingFeatures ();
|
||||||
if (!features.empty () && features.size () == 1) {
|
if (!features.empty () && features.size () == 2) {
|
||||||
_result.have_dbtp = true;
|
_result.have_dbtp = true;
|
||||||
float p = features[0][0].values[0];
|
float p = features[0][0].values[0];
|
||||||
if (p > _result.truepeak) { _result.truepeak = p; }
|
if (p > _result.truepeak) { _result.truepeak = p; }
|
||||||
|
|
||||||
|
for (std::vector<float>::const_iterator i = features[1][0].values.begin();
|
||||||
|
i != features[1][0].values.end(); ++i) {
|
||||||
|
const framecnt_t pk = (*i) / _spp;
|
||||||
|
const unsigned int cc = c & cmask;
|
||||||
|
_result.truepeakpos[cc].insert (pk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue