diff data/model/FFTModel.cpp @ 1790:dd51797e528e time-frequency-boxes

Some tidying
author Chris Cannam
date Wed, 25 Sep 2019 09:43:34 +0100
parents 4eac4bf35b45
children 1b688ab5f1b3
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Fri Sep 20 14:18:38 2019 +0100
+++ b/data/model/FFTModel.cpp	Wed Sep 25 09:43:34 2019 +0100
@@ -106,12 +106,6 @@
     return c;
 }
 
-sv_samplerate_t
-FFTModel::getSampleRate() const
-{
-    return m_sampleRate;
-}
-
 void
 FFTModel::setMaximumFrequency(double freq)
 {
@@ -143,10 +137,13 @@
 QString
 FFTModel::getBinName(int n) const
 {
-    sv_samplerate_t sr = getSampleRate();
-    if (!sr) return "";
-    QString name = tr("%1 Hz").arg((double(n) * sr) / m_fftSize);
-    return name;
+    return tr("%1 Hz").arg(getBinValue(n));
+}
+
+float
+FFTModel::getBinValue(int n) const
+{
+    return float((m_sampleRate * n) / m_fftSize);
 }
 
 FFTModel::Column