changeset 1200:825d0d7641ba spectrogram-minor-refactor

Restore phase display
author Chris Cannam
date Thu, 04 Aug 2016 14:02:56 +0100
parents 4d0d94ba2ea7
children 6f7a440b6218
files data/model/FFTModel.cpp data/model/FFTModel.h
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Wed Aug 03 16:16:23 2016 +0100
+++ b/data/model/FFTModel.cpp	Thu Aug 04 14:02:56 2016 +0100
@@ -103,6 +103,16 @@
     return move(col);
 }
 
+FFTModel::Column
+FFTModel::getPhases(int x) const
+{
+    auto cplx = getFFTColumn(x);
+    Column col;
+    col.reserve(cplx.size());
+    for (auto c: cplx) col.push_back(arg(c));
+    return move(col);
+}
+
 float
 FFTModel::getMagnitudeAt(int x, int y) const
 {
--- a/data/model/FFTModel.h	Wed Aug 03 16:16:23 2016 +0100
+++ b/data/model/FFTModel.h	Thu Aug 04 14:02:56 2016 +0100
@@ -76,6 +76,7 @@
     virtual float getMinimumLevel() const { return 0.f; } // Can't provide
     virtual float getMaximumLevel() const { return 1.f; } // Can't provide
     virtual Column getColumn(int x) const; // magnitudes
+    virtual Column getPhases(int x) const;
     virtual QString getBinName(int n) const;
     virtual bool shouldUseLogValueScale() const { return true; }
     virtual int getCompletion() const {
@@ -95,6 +96,8 @@
     int getWindowSize() const { return m_windowSize; }
     int getWindowIncrement() const { return m_windowIncrement; }
     int getFFTSize() const { return m_fftSize; }
+
+//!!! review which of these are ever actually called
     
     float getMagnitudeAt(int x, int y) const;
     float getMaximumMagnitudeAt(int x) const;