comparison 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
comparison
equal deleted inserted replaced
1789:baafe1bb7e51 1790:dd51797e528e
104 if (model->isReady(&c)) return 100; 104 if (model->isReady(&c)) return 100;
105 } 105 }
106 return c; 106 return c;
107 } 107 }
108 108
109 sv_samplerate_t
110 FFTModel::getSampleRate() const
111 {
112 return m_sampleRate;
113 }
114
115 void 109 void
116 FFTModel::setMaximumFrequency(double freq) 110 FFTModel::setMaximumFrequency(double freq)
117 { 111 {
118 m_maximumFrequency = freq; 112 m_maximumFrequency = freq;
119 } 113 }
141 } 135 }
142 136
143 QString 137 QString
144 FFTModel::getBinName(int n) const 138 FFTModel::getBinName(int n) const
145 { 139 {
146 sv_samplerate_t sr = getSampleRate(); 140 return tr("%1 Hz").arg(getBinValue(n));
147 if (!sr) return ""; 141 }
148 QString name = tr("%1 Hz").arg((double(n) * sr) / m_fftSize); 142
149 return name; 143 float
144 FFTModel::getBinValue(int n) const
145 {
146 return float((m_sampleRate * n) / m_fftSize);
150 } 147 }
151 148
152 FFTModel::Column 149 FFTModel::Column
153 FFTModel::getColumn(int x) const 150 FFTModel::getColumn(int x) const
154 { 151 {