]> git.sesse.net Git - kdenlive/blob - src/scopes/audioscopes/audiospectrum.cpp
Const'ify. Use QLatin1String
[kdenlive] / src / scopes / audioscopes / audiospectrum.cpp
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10
11
12
13 #include "audiospectrum.h"
14 #include "lib/audio/fftTools.h"
15 #include "lib/external/kiss_fft/tools/kiss_fftr.h"
16
17 #include <QMenu>
18 #include <QPainter>
19 #include <QMouseEvent>
20
21 #include <iostream>
22
23 // (defined in the header file)
24 #ifdef DEBUG_AUDIOSPEC
25 #include <QDebug>
26 #endif
27
28 // (defined in the header file)
29 #ifdef DETECT_OVERMODULATION
30 #include <limits>
31 #include <cmath>
32 #endif
33
34 // Draw lines instead of single pixels.
35 // This is about 25 % faster, especially when enlarging the scope to e.g. 1680x1050 px.
36 #define AUDIOSPEC_LINES
37
38 #define MIN_DB_VALUE -120
39 #define MAX_FREQ_VALUE 96000
40 #define MIN_FREQ_VALUE 1000
41 #define ALPHA_MOVING_AVG 0.125
42 #define MAX_OVM_COLOR 0.7
43
44 AudioSpectrum::AudioSpectrum(QWidget *parent) :
45     AbstractAudioScopeWidget(true, parent)
46     , m_fftTools()
47     , m_lastFFT()
48     , m_lastFFTLock(1)
49     , m_peaks()
50   #ifdef DEBUG_AUDIOSPEC
51     , m_timeTotal(0)
52     , m_showTotal(0)
53   #endif
54     , m_dBmin(-70)
55     , m_dBmax(0)
56     , m_freqMax(0)
57     , m_customFreq(false)
58     ,colorizeFactor(0)
59 {
60     ui = new Ui::AudioSpectrum_UI;
61     ui->setupUi(this);
62
63
64     m_aResetHz = new QAction(i18n("Reset maximum frequency to sampling rate"), this);
65     m_aTrackMouse = new QAction(i18n("Track mouse"), this);
66     m_aTrackMouse->setCheckable(true);
67     m_aShowMax = new QAction(i18n("Show maximum"), this);
68     m_aShowMax->setCheckable(true);
69
70
71     m_menu->addSeparator();
72     m_menu->addAction(m_aResetHz);
73     m_menu->addAction(m_aTrackMouse);
74     m_menu->addAction(m_aShowMax);
75     m_menu->removeAction(m_aRealtime);
76
77
78     ui->windowSize->addItem("256", QVariant(256));
79     ui->windowSize->addItem("512", QVariant(512));
80     ui->windowSize->addItem("1024", QVariant(1024));
81     ui->windowSize->addItem("2048", QVariant(2048));
82
83     ui->windowFunction->addItem(i18n("Rectangular window"), FFTTools::Window_Rect);
84     ui->windowFunction->addItem(i18n("Triangular window"), FFTTools::Window_Triangle);
85     ui->windowFunction->addItem(i18n("Hamming window"), FFTTools::Window_Hamming);
86
87
88     bool b = true;
89     b &= connect(m_aResetHz, SIGNAL(triggered()), this, SLOT(slotResetMaxFreq()));
90     b &= connect(ui->windowFunction, SIGNAL(currentIndexChanged(int)), this, SLOT(forceUpdate()));
91     b &= connect(this, SIGNAL(signalMousePositionChanged()), this, SLOT(forceUpdateHUD()));
92     Q_ASSERT(b);
93
94
95     // Note: These strings are used in both Spectogram and AudioSpectrum. Ideally change both (if necessary) to reduce workload on translators
96     ui->labelFFTSize->setToolTip(i18n("The maximum window size is limited by the number of samples per frame."));
97     ui->windowSize->setToolTip(i18n("A bigger window improves the accuracy at the cost of computational power."));
98     ui->windowFunction->setToolTip(i18n("The rectangular window function is good for signals with equal signal strength (narrow peak), but creates more smearing. See Window function on Wikipedia."));
99
100     AbstractScopeWidget::init();
101 }
102 AudioSpectrum::~AudioSpectrum()
103 {
104     writeConfig();
105
106     delete m_aResetHz;
107     delete m_aTrackMouse;
108     delete ui;
109 }
110
111 void AudioSpectrum::readConfig()
112 {
113     AbstractScopeWidget::readConfig();
114
115     KSharedConfigPtr config = KGlobal::config();
116     KConfigGroup scopeConfig(config, AbstractScopeWidget::configName());
117
118     ui->windowSize->setCurrentIndex(scopeConfig.readEntry("windowSize", 0));
119     ui->windowFunction->setCurrentIndex(scopeConfig.readEntry("windowFunction", 0));
120     m_aTrackMouse->setChecked(scopeConfig.readEntry("trackMouse", true));
121     m_aShowMax->setChecked(scopeConfig.readEntry("showMax", true));
122     m_dBmax = scopeConfig.readEntry("dBmax", 0);
123     m_dBmin = scopeConfig.readEntry("dBmin", -70);
124     m_freqMax = scopeConfig.readEntry("freqMax", 0);
125
126     if (m_freqMax == 0) {
127         m_customFreq = false;
128         m_freqMax = 10000;
129     } else {
130         m_customFreq = true;
131     }
132 }
133 void AudioSpectrum::writeConfig()
134 {
135     KSharedConfigPtr config = KGlobal::config();
136     KConfigGroup scopeConfig(config, AbstractScopeWidget::configName());
137
138     scopeConfig.writeEntry("windowSize", ui->windowSize->currentIndex());
139     scopeConfig.writeEntry("windowFunction", ui->windowFunction->currentIndex());
140     scopeConfig.writeEntry("trackMouse", m_aTrackMouse->isChecked());
141     scopeConfig.writeEntry("showMax", m_aShowMax->isChecked());
142     scopeConfig.writeEntry("dBmax", m_dBmax);
143     scopeConfig.writeEntry("dBmin", m_dBmin);
144     if (m_customFreq) {
145         scopeConfig.writeEntry("freqMax", m_freqMax);
146     } else {
147         scopeConfig.writeEntry("freqMax", 0);
148     }
149
150     scopeConfig.sync();
151 }
152
153 QString AudioSpectrum::widgetName() const
154 {
155     return QLatin1String("AudioSpectrum");
156 }
157
158 bool AudioSpectrum::isBackgroundDependingOnInput() const
159 {
160     return false;
161 }
162
163 bool AudioSpectrum::isScopeDependingOnInput() const
164 {
165     return true;
166 }
167
168 bool AudioSpectrum::isHUDDependingOnInput() const
169 {
170     return false;
171 }
172
173 QImage AudioSpectrum::renderBackground(uint)
174 {
175     return QImage();
176 }
177
178 QImage AudioSpectrum::renderAudioScope(uint, const QVector<int16_t> &audioFrame, const int freq, const int num_channels,
179                                        const int num_samples, const int)
180 {
181     if (
182             audioFrame.size() > 63
183             && m_innerScopeRect.width() > 0 && m_innerScopeRect.height() > 0    // <= 0 if widget is too small (resized by user)
184     ) {
185         if (!m_customFreq) {
186             m_freqMax = freq / 2;
187         }
188
189         QTime start = QTime::currentTime();
190
191
192 #ifdef DETECT_OVERMODULATION
193         bool overmodulated = false;
194         int overmodulateCount = 0;
195
196         for (int i = 0; i < audioFrame.size(); ++i) {
197             if (
198                     audioFrame[i] == std::numeric_limits<int16_t>::max()
199                     || audioFrame[i] == std::numeric_limits<int16_t>::min()) {
200                 overmodulateCount++;
201                 if (overmodulateCount > 3) {
202                     overmodulated = true;
203                     break;
204                 }
205             }
206         }
207         if (overmodulated) {
208             colorizeFactor = 1;
209         } else {
210             if (colorizeFactor > 0) {
211                 colorizeFactor -= .08;
212                 if (colorizeFactor < 0) {
213                     colorizeFactor = 0;
214                 }
215             }
216         }
217 #endif
218
219
220         // Determine the window size to use. It should be
221         // * not bigger than the number of samples actually available
222         // * divisible by 2
223         int fftWindow = ui->windowSize->itemData(ui->windowSize->currentIndex()).toInt();
224         if (fftWindow > num_samples) {
225             fftWindow = num_samples;
226         }
227         if ((fftWindow & 1) == 1) {
228             fftWindow--;
229         }
230
231         // Show the window size used, for information
232         ui->labelFFTSizeNumber->setText(QVariant(fftWindow).toString());
233
234
235         // Get the spectral power distribution of the input samples,
236         // using the given window size and function
237         float freqSpectrum[fftWindow/2];
238         FFTTools::WindowType windowType = (FFTTools::WindowType) ui->windowFunction->itemData(ui->windowFunction->currentIndex()).toInt();
239         m_fftTools.fftNormalized(audioFrame, 0, num_channels, freqSpectrum, windowType, fftWindow, 0);
240
241
242         // Store the current FFT window (for the HUD) and run the interpolation
243         // for easy pixel-based dB value access
244         QVector<float> dbMap;
245         m_lastFFTLock.acquire();
246         m_lastFFT = QVector<float>(fftWindow/2);
247         memcpy(m_lastFFT.data(), &(freqSpectrum[0]), fftWindow/2 * sizeof(float));
248
249         uint right = ((float) m_freqMax)/(m_freq/2) * (m_lastFFT.size() - 1);
250         dbMap = FFTTools::interpolatePeakPreserving(m_lastFFT, m_innerScopeRect.width(), 0, right, -180);
251         m_lastFFTLock.release();
252
253
254 #ifdef DEBUG_AUDIOSPEC
255         QTime drawTime = QTime::currentTime();
256 #endif
257
258         // Draw the spectrum
259         QImage spectrum(m_scopeRect.size(), QImage::Format_ARGB32);
260         spectrum.fill(qRgba(0,0,0,0));
261         const uint w = m_innerScopeRect.width();
262         const uint h = m_innerScopeRect.height();
263         const uint leftDist = m_innerScopeRect.left() - m_scopeRect.left();
264         const uint topDist = m_innerScopeRect.top() - m_scopeRect.top();
265         QColor spectrumColor(AbstractScopeWidget::colDarkWhite);
266         int yMax;
267
268 #ifdef DETECT_OVERMODULATION
269         if (colorizeFactor > 0) {
270             QColor col = AbstractScopeWidget::colHighlightDark;
271             QColor spec = spectrumColor;
272             float f = std::sin(M_PI_2 * colorizeFactor);
273             spectrumColor = QColor(
274                         (int) (f * col.red() + (1-f) * spec.red()),
275                         (int) (f * col.green() + (1-f) * spec.green()),
276                         (int) (f * col.blue() + (1-f) * spec.blue()),
277                         spec.alpha()
278                         );
279             // Limit the maximum colorization for non-overmodulated frames to better
280             // recognize consecutively overmodulated frames
281             if (colorizeFactor > MAX_OVM_COLOR) {
282                 colorizeFactor = MAX_OVM_COLOR;
283             }
284         }
285 #endif
286
287 #ifdef AUDIOSPEC_LINES
288         QPainter davinci(&spectrum);
289         davinci.setPen(QPen(QBrush(spectrumColor.rgba()), 1, Qt::SolidLine));
290 #endif
291
292         for (uint i = 0; i < w; ++i) {
293             yMax = (dbMap[i] - m_dBmin) / (m_dBmax-m_dBmin) * (h-1);
294             if (yMax < 0) {
295                 yMax = 0;
296             } else if (yMax >= (int)h) {
297                 yMax = h-1;
298             }
299 #ifdef AUDIOSPEC_LINES
300             davinci.drawLine(leftDist + i, topDist + h-1, leftDist + i, topDist + h-1 - yMax);
301 #else
302             for (int y = 0; y < yMax && y < (int)h; y++) {
303                 spectrum.setPixel(leftDist + i, topDist + h-y-1, spectrumColor.rgba());
304             }
305 #endif
306         }
307
308         // Calculate the peak values. Use the new value if it is bigger, otherwise adapt to lower
309         // values using the Moving Average formula
310         if (m_aShowMax->isChecked()) {
311             davinci.setPen(QPen(QBrush(AbstractScopeWidget::colHighlightLight), 2));
312             if (m_peaks.size() != fftWindow/2) {
313                 m_peaks = QVector<float>(m_lastFFT);
314             } else {
315                 for (int i = 0; i < fftWindow/2; ++i) {
316                     if (m_lastFFT[i] > m_peaks[i]) {
317                         m_peaks[i] = m_lastFFT[i];
318                     } else {
319                         m_peaks[i] = ALPHA_MOVING_AVG * m_lastFFT[i] + (1-ALPHA_MOVING_AVG) * m_peaks[i];
320                     }
321                 }
322             }
323             int prev = 0;
324             m_peakMap = FFTTools::interpolatePeakPreserving(m_peaks, m_innerScopeRect.width(), 0, right, -180);
325             for (uint i = 0; i < w; ++i) {
326                 yMax = (m_peakMap[i] - m_dBmin) / (m_dBmax-m_dBmin) * (h-1);
327                 if (yMax < 0) {
328                     yMax = 0;
329                 } else if (yMax >= (int)h) {
330                     yMax = h-1;
331                 }
332
333                 davinci.drawLine(leftDist + i-1, topDist + h-prev-1, leftDist + i, topDist + h-yMax-1);
334                 spectrum.setPixel(leftDist + i, topDist + h-yMax-1, AbstractScopeWidget::colHighlightLight.rgba());
335                 prev = yMax;
336             }
337         }
338
339 #ifdef DEBUG_AUDIOSPEC
340         m_showTotal++;
341         m_timeTotal += drawTime.elapsed();
342         qDebug() << widgetName() << " took " << drawTime.elapsed() << " ms for drawing. Average: " << ((float)m_timeTotal/m_showTotal) ;
343 #endif
344
345         emit signalScopeRenderingFinished(start.elapsed(), 1);
346
347
348         return spectrum;
349     } else {
350         emit signalScopeRenderingFinished(0, 1);
351         return QImage();
352     }
353 }
354 QImage AudioSpectrum::renderHUD(uint)
355 {
356     QTime start = QTime::currentTime();
357
358     if (m_innerScopeRect.height() > 0 && m_innerScopeRect.width() > 0) { // May be below 0 if widget is too small
359
360         // Minimum distance between two lines
361         const uint minDistY = 30;
362         const uint minDistX = 40;
363         const uint textDistX = 10;
364         const uint textDistY = 25;
365         const uint topDist = m_innerScopeRect.top() - m_scopeRect.top();
366         const uint leftDist = m_innerScopeRect.left() - m_scopeRect.left();
367         const uint dbDiff = ceil((float)minDistY/m_innerScopeRect.height() * (m_dBmax-m_dBmin));
368         const int mouseX = m_mousePos.x() - m_innerScopeRect.left();
369         const int mouseY = m_mousePos.y() - m_innerScopeRect.top();
370
371
372         QImage hud(m_scopeRect.size(), QImage::Format_ARGB32);
373         hud.fill(qRgba(0,0,0,0));
374
375         QPainter davinci(&hud);
376         davinci.setPen(AbstractScopeWidget::penLight);
377
378         int y;
379         for (int db = -dbDiff; db > m_dBmin; db -= dbDiff) {
380             y = topDist + m_innerScopeRect.height() * ((float)db)/(m_dBmin - m_dBmax);
381             if (y-topDist > m_innerScopeRect.height()-minDistY+10) {
382                 // Abort here, there is still a line left for min dB to paint which needs some room.
383                 break;
384             }
385             davinci.drawLine(leftDist, y, leftDist + m_innerScopeRect.width()-1, y);
386             davinci.drawText(leftDist + m_innerScopeRect.width() + textDistX, y + 6, i18n("%1 dB", m_dBmax + db));
387         }
388         davinci.drawLine(leftDist, topDist, leftDist + m_innerScopeRect.width()-1, topDist);
389         davinci.drawText(leftDist + m_innerScopeRect.width() + textDistX, topDist+6, i18n("%1 dB", m_dBmax));
390         davinci.drawLine(leftDist, topDist+m_innerScopeRect.height()-1, leftDist + m_innerScopeRect.width()-1, topDist+m_innerScopeRect.height()-1);
391         davinci.drawText(leftDist + m_innerScopeRect.width() + textDistX, topDist+m_innerScopeRect.height()+6, i18n("%1 dB", m_dBmin));
392
393         const uint hzDiff = ceil( ((float)minDistX)/m_innerScopeRect.width() * m_freqMax / 1000 ) * 1000;
394         int x = 0;
395         const int rightBorder = leftDist + m_innerScopeRect.width()-1;
396         y = topDist + m_innerScopeRect.height() + textDistY;
397         for (int hz = 0; x <= rightBorder; hz += hzDiff) {
398             davinci.setPen(AbstractScopeWidget::penLighter);
399             x = leftDist + m_innerScopeRect.width() * ((float)hz)/m_freqMax;
400
401             if (x <= rightBorder) {
402                 davinci.drawLine(x, topDist, x, topDist + m_innerScopeRect.height()+6);
403             }
404             if (hz < m_freqMax && x+textDistY < leftDist + m_innerScopeRect.width()) {
405                 davinci.drawText(x-4, y, QVariant(hz/1000).toString());
406             } else {
407                 x = leftDist + m_innerScopeRect.width();
408                 davinci.drawLine(x, topDist, x, topDist + m_innerScopeRect.height()+6);
409                 davinci.drawText(x-10, y, i18n("%1 kHz", QString("%1").arg((double)m_freqMax/1000, 0, 'f', 1)));
410             }
411
412             if (hz > 0) {
413                 // Draw finer lines between the main lines
414                 davinci.setPen(AbstractScopeWidget::penLightDots);
415                 for (uint dHz = 3; dHz > 0; dHz--) {
416                     x = leftDist + m_innerScopeRect.width() * ((float)hz - dHz * hzDiff/4.0f)/m_freqMax;
417                     if (x > rightBorder) {
418                         break;
419                     }
420                     davinci.drawLine(x, topDist, x, topDist + m_innerScopeRect.height()-1);
421                 }
422             }
423         }
424
425         if (m_aTrackMouse->isChecked() && m_mouseWithinWidget && mouseX < m_innerScopeRect.width()-1) {
426             davinci.setPen(AbstractScopeWidget::penThin);
427
428             x = leftDist + mouseX;
429
430             float db = 0;
431             float freq = ((float) mouseX)/(m_innerScopeRect.width()-1) * m_freqMax;
432             bool drawDb = false;
433
434             m_lastFFTLock.acquire();
435             // We need to test whether the mouse is inside the widget
436             // because the position could already have changed in the meantime (-> crash)
437             if (m_lastFFT.size() > 0 && mouseX >= 0 && mouseX < m_innerScopeRect.width()) {
438                 uint right = ((float) m_freqMax)/(m_freq/2) * (m_lastFFT.size() - 1);
439                 QVector<float> dbMap = FFTTools::interpolatePeakPreserving(m_lastFFT, m_innerScopeRect.width(), 0, right, -120);
440
441                 db = dbMap[mouseX];
442                 y = topDist + m_innerScopeRect.height()-1 - (dbMap[mouseX] - m_dBmin) / (m_dBmax-m_dBmin) * (m_innerScopeRect.height()-1);
443
444                 if (y < (int)topDist + m_innerScopeRect.height()-1) {
445                     drawDb = true;
446                     davinci.drawLine(x, y, leftDist + m_innerScopeRect.width()-1, y);
447                 }
448             } else {
449                 y = topDist + mouseY;
450             }
451             m_lastFFTLock.release();
452
453             if (y > (int)topDist + mouseY) {
454                 y = topDist+ mouseY;
455             }
456             davinci.drawLine(x, y, x, topDist + m_innerScopeRect.height()-1);
457
458             if (drawDb) {
459                 QPoint dist(20, -20);
460                 QRect rect(
461                             leftDist + mouseX + dist.x(),
462                             topDist + mouseY + dist.y(),
463                             100,
464                             40
465                             );
466                 if (rect.right() > (int)leftDist + m_innerScopeRect.width()-1) {
467                     // Mirror the rectangle at the y axis to keep it inside the widget
468                     rect = QRect(
469                                 rect.topLeft() - QPoint(rect.width() + 2*dist.x(), 0),
470                                 rect.size());
471                 }
472
473                 QRect textRect(
474                             rect.topLeft() + QPoint(12, 4),
475                             rect.size()
476                             );
477
478                 davinci.fillRect(rect, AbstractScopeWidget::penBackground.brush());
479                 davinci.setPen(AbstractScopeWidget::penLighter);
480                 davinci.drawRect(rect);
481                 davinci.drawText(textRect, QString(
482                                      i18n("%1 dB", QString("%1").arg(db, 0, 'f', 2))
483                                      + '\n'
484                                      + i18n("%1 kHz", QString("%1").arg(freq/1000, 0, 'f', 2))));
485             }
486
487         }
488
489         emit signalHUDRenderingFinished(start.elapsed(), 1);
490         return hud;
491
492     } else {
493 #ifdef DEBUG_AUDIOSPEC
494         qDebug() << "Widget is too small for painting inside. Size of inner scope rect is "
495                  << m_innerScopeRect.width() << "x" << m_innerScopeRect.height() <<".";
496 #endif
497         emit signalHUDRenderingFinished(0, 1);
498         return QImage();
499     }
500
501 }
502
503 QRect AudioSpectrum::scopeRect()
504 {
505     m_scopeRect = QRect(
506             QPoint(
507                     10,                                     // Left
508                     ui->verticalSpacer->geometry().top()+6  // Top
509             ),
510             AbstractAudioScopeWidget::rect().bottomRight()
511     );
512     m_innerScopeRect = QRect(
513             QPoint(
514                     m_scopeRect.left()+6,                   // Left
515                     m_scopeRect.top()+6                     // Top
516             ), QPoint(
517                     ui->verticalSpacer->geometry().right()-70,
518                     ui->verticalSpacer->geometry().bottom()-40
519             )
520     );
521     return m_scopeRect;
522 }
523
524 void AudioSpectrum::slotResetMaxFreq()
525 {
526     m_customFreq = false;
527     forceUpdateHUD();
528     forceUpdateScope();
529 }
530
531
532 ///// EVENTS /////
533
534 void AudioSpectrum::handleMouseDrag(const QPoint &movement, const RescaleDirection rescaleDirection, const Qt::KeyboardModifiers rescaleModifiers)
535 {
536     if (rescaleDirection == North) {
537         // Nort-South direction: Adjust the dB scale
538
539         if ((rescaleModifiers & Qt::ShiftModifier) == 0) {
540
541             // By default adjust the min dB value
542             m_dBmin += movement.y();
543
544         } else {
545
546             // Adjust max dB value if Shift is pressed.
547             m_dBmax += movement.y();
548
549         }
550
551         // Ensure the dB values lie in [-100, 0] (or rather [MIN_DB_VALUE, 0])
552         // 0 is the upper bound, everything below -70 dB is most likely noise
553         if (m_dBmax > 0) {
554             m_dBmax = 0;
555         }
556         if (m_dBmin < MIN_DB_VALUE) {
557             m_dBmin = MIN_DB_VALUE;
558         }
559         // Ensure there is at least 6 dB between the minimum and the maximum value;
560         // lower values hardly make sense
561         if (m_dBmax - m_dBmin < 6) {
562             if ((rescaleModifiers & Qt::ShiftModifier) == 0) {
563                 // min was adjusted; Try to adjust the max value to maintain the
564                 // minimum dB difference of 6 dB
565                 m_dBmax = m_dBmin + 6;
566                 if (m_dBmax > 0) {
567                     m_dBmax = 0;
568                     m_dBmin = -6;
569                 }
570             } else {
571                 // max was adjusted, adjust min
572                 m_dBmin = m_dBmax - 6;
573                 if (m_dBmin < MIN_DB_VALUE) {
574                     m_dBmin = MIN_DB_VALUE;
575                     m_dBmax = MIN_DB_VALUE+6;
576                 }
577             }
578         }
579
580         forceUpdateHUD();
581         forceUpdateScope();
582
583     } else if (rescaleDirection == East) {
584         // East-West direction: Adjust the maximum frequency
585         m_freqMax -= 100*movement.x();
586         if (m_freqMax < MIN_FREQ_VALUE) {
587             m_freqMax = MIN_FREQ_VALUE;
588         }
589         if (m_freqMax > MAX_FREQ_VALUE) {
590             m_freqMax = MAX_FREQ_VALUE;
591         }
592         m_customFreq = true;
593
594         forceUpdateHUD();
595         forceUpdateScope();
596     }
597 }
598
599 #include "audiospectrum.moc"