diff options
Diffstat (limited to 'src/plugins/Visual/analyzer')
| -rw-r--r-- | src/plugins/Visual/analyzer/analyzer.cpp | 23 | ||||
| -rw-r--r-- | src/plugins/Visual/analyzer/analyzer.h | 14 |
2 files changed, 14 insertions, 23 deletions
diff --git a/src/plugins/Visual/analyzer/analyzer.cpp b/src/plugins/Visual/analyzer/analyzer.cpp index 30708f676..75b305a86 100644 --- a/src/plugins/Visual/analyzer/analyzer.cpp +++ b/src/plugins/Visual/analyzer/analyzer.cpp @@ -33,14 +33,6 @@ Analyzer::Analyzer (QWidget *parent) : Visual (parent) { - m_intern_vis_data = nullptr; - m_peaks = nullptr; - m_x_scale = nullptr; - m_rows = 0; - m_cols = 0; - m_update = false; - m_running = false; - setWindowTitle (tr("Qmmp Analyzer")); setMinimumSize(2*300-30,105); m_timer = new QTimer (this); @@ -234,8 +226,6 @@ void Analyzer::process() short dest_l[256]; short dest_r[256]; - short yl, yr; - int j, k, magnitude_l, magnitude_r; calc_freq (dest_l, m_left_buffer); calc_freq (dest_r, m_right_buffer); @@ -244,16 +234,18 @@ void Analyzer::process() for (int i = 0; i < m_cols; i++) { - j = m_cols * 2 - i - 1; //mirror index - yl = yr = 0; - magnitude_l = magnitude_r = 0; + int j = m_cols * 2 - i - 1; //mirror index + short yl = 0; + short yr = 0; + int magnitude_l = 0; + int magnitude_r = 0; if(m_x_scale[i] == m_x_scale[i + 1]) { yl = dest_l[i]; yr = dest_r[i]; } - for (k = m_x_scale[i]; k < m_x_scale[i + 1]; k++) + for (int k = m_x_scale[i]; k < m_x_scale[i + 1]; k++) { yl = qMax(dest_l[k], yl); yr = qMax(dest_r[k], yr); @@ -293,12 +285,11 @@ void Analyzer::process() void Analyzer::draw(QPainter *p) { QBrush brush(Qt::SolidPattern); - int x = 0; int rdx = qMax(0, width() - 2 * m_cell_size.width() * m_cols); for (int j = 0; j < m_cols * 2; ++j) { - x = j * m_cell_size.width() + 1; + int x = j * m_cell_size.width() + 1; if(j >= m_cols) x += rdx; //correct right part position diff --git a/src/plugins/Visual/analyzer/analyzer.h b/src/plugins/Visual/analyzer/analyzer.h index 076948adb..3d77d30f1 100644 --- a/src/plugins/Visual/analyzer/analyzer.h +++ b/src/plugins/Visual/analyzer/analyzer.h @@ -37,7 +37,7 @@ class Analyzer : public Visual Q_OBJECT public: - Analyzer( QWidget *parent = nullptr); + explicit Analyzer( QWidget *parent = nullptr); virtual ~Analyzer(); public slots: @@ -61,17 +61,17 @@ private: void draw(QPainter *p); void createMenu(); QTimer *m_timer; - double *m_intern_vis_data; - double *m_peaks; - int *m_x_scale; + double *m_intern_vis_data = nullptr; + double *m_peaks = nullptr; + int *m_x_scale = nullptr; double m_peaks_falloff; double m_analyzer_falloff; bool m_show_peaks; float m_left_buffer[QMMP_VISUAL_NODE_SIZE]; float m_right_buffer[QMMP_VISUAL_NODE_SIZE]; - int m_cols, m_rows; - bool m_update; - bool m_running; + int m_cols = 0, m_rows = 0; + bool m_update = false; + bool m_running = false; //colors QColor m_color1; QColor m_color2; |
