# HG changeset patch # User Chris Cannam # Date 1445342046 -3600 # Node ID e94719f941ba86d53732cd872904ab6193b2c5b2 # Parent 7fb1a7199e5b63513b2a21453db2fc67e622e473 Return maximum through getNormalizedMagnitudesAt to avoid having to make more than one call diff -r 7fb1a7199e5b -r e94719f941ba data/fft/FFTapi.h --- a/data/fft/FFTapi.h Wed Oct 14 10:19:48 2015 +0100 +++ b/data/fft/FFTapi.h Tue Oct 20 12:54:06 2015 +0100 @@ -75,7 +75,7 @@ fftf_free(m_output); } - std::vector > process(std::vector in) const { + std::vector > process(const std::vector &in) const { const int hs = m_size/2; for (int i = 0; i < hs; ++i) { m_input[i] = in[i + hs]; diff -r 7fb1a7199e5b -r e94719f941ba data/model/FFTModel.cpp --- a/data/model/FFTModel.cpp Wed Oct 14 10:19:48 2015 +0100 +++ b/data/model/FFTModel.cpp Tue Oct 20 12:54:06 2015 +0100 @@ -155,7 +155,7 @@ return true; } -bool +float FFTModel::getNormalizedMagnitudesAt(int x, float *values, int minbin, int count) const { if (!getMagnitudesAt(x, values, minbin, count)) return false; @@ -169,7 +169,7 @@ values[i] /= max; } } - return true; + return max; } bool diff -r 7fb1a7199e5b -r e94719f941ba data/model/FFTModel.h --- a/data/model/FFTModel.h Wed Oct 14 10:19:48 2015 +0100 +++ b/data/model/FFTModel.h Tue Oct 20 12:54:06 2015 +0100 @@ -102,7 +102,7 @@ void getValuesAt(int x, int y, float &real, float &imaginary) const; bool isColumnAvailable(int x) const; bool getMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; - bool getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; + float getNormalizedMagnitudesAt(int x, float *values, int minbin = 0, int count = 0) const; // returns maximum of unnormalized magnitudes bool getPhasesAt(int x, float *values, int minbin = 0, int count = 0) const; bool getValuesAt(int x, float *reals, float *imaginaries, int minbin = 0, int count = 0) const;