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