Commit a94846c4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

unbreak audio spectrum

parent fcc17c06
...@@ -140,7 +140,7 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent) ...@@ -140,7 +140,7 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent)
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
} }
void AudioGraphWidget::showAudio(const QVector<double> &bands) void AudioGraphWidget::showAudio(const QVector<float> &bands)
{ {
m_levels = bands; m_levels = bands;
update(); update();
...@@ -373,5 +373,5 @@ void AudioGraphSpectrum::processSpectrum(const SharedFrame &frame) ...@@ -373,5 +373,5 @@ void AudioGraphSpectrum::processSpectrum(const SharedFrame &frame)
} }
// Update the audio signal widget // Update the audio signal widget
QMetaObject::invokeMethod(m_graphWidget, "showAudio", Qt::QueuedConnection, Q_ARG(const QVector<double> &, bands)); QMetaObject::invokeMethod(m_graphWidget, "showAudio", Qt::QueuedConnection, Q_ARG(const QVector<float> &, bands));
} }
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
void drawBackground(); void drawBackground();
public slots: public slots:
void showAudio(const QVector<double> &bands); void showAudio(const QVector<float> &bands);
protected: protected:
void paintEvent(QPaintEvent *pe); void paintEvent(QPaintEvent *pe);
......
...@@ -144,7 +144,7 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent) ...@@ -144,7 +144,7 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent)
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
} }
void AudioGraphWidget::showAudio(const QVector<double> &bands) void AudioGraphWidget::showAudio(const QVector<float> &bands)
{ {
m_levels = bands; m_levels = bands;
update(); update();
...@@ -262,7 +262,7 @@ void AudioGraphWidget::paintEvent(QPaintEvent *pe) ...@@ -262,7 +262,7 @@ void AudioGraphWidget::paintEvent(QPaintEvent *pe)
p.setOpacity(0.6); p.setOpacity(0.6);
QRectF rect(m_rect.left(), 0, barWidth, height); QRectF rect(m_rect.left(), 0, barWidth, height);
for (int i = 0; i < chanCount; i++) { for (int i = 0; i < chanCount; i++) {
double level = (0.5 + m_levels.at(i)) / 1.5 * height; float level = (0.5 + m_levels.at(i)) / 1.5 * height;
if (level < 0) { if (level < 0) {
continue; continue;
} }
......
...@@ -57,14 +57,14 @@ public: ...@@ -57,14 +57,14 @@ public:
void drawBackground(); void drawBackground();
public slots: public slots:
void showAudio(const QVector<double> &bands); void showAudio(const QVector<float> &bands);
protected: protected:
void paintEvent(QPaintEvent *pe) override; void paintEvent(QPaintEvent *pe) override;
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
private: private:
QVector<double> m_levels; QVector<float> m_levels;
QVector<int> m_dbLabels; QVector<int> m_dbLabels;
QStringList m_freqLabels; QStringList m_freqLabels;
QPixmap m_pixmap; QPixmap m_pixmap;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment