aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/Ui/qsui/inlines.h41
-rw-r--r--src/plugins/Ui/qsui/logo.cpp45
-rw-r--r--src/plugins/Ui/qsui/logo.h6
-rw-r--r--src/plugins/Ui/qsui/qsuianalyzer.cpp17
-rw-r--r--src/plugins/Ui/qsui/qsuianalyzer.h3
5 files changed, 27 insertions, 85 deletions
diff --git a/src/plugins/Ui/qsui/inlines.h b/src/plugins/Ui/qsui/inlines.h
index 8203de336..c0e601c8c 100644
--- a/src/plugins/Ui/qsui/inlines.h
+++ b/src/plugins/Ui/qsui/inlines.h
@@ -32,45 +32,4 @@ static inline void calc_freq(short* dest, float *src)
dest[i] = ((int) sqrt(tmp_out[i + 1])) >> 8;
}
-static inline void stereo_from_multichannel(float *l,
- float *r,
- float *s,
- long cnt, int chan)
-{
- if(chan == 1)
- {
- memcpy(l, s, cnt * sizeof(float));
- memcpy(r, s, cnt * sizeof(float));
- return;
- }
- while (cnt > 0)
- {
- l[0] = s[0];
- r[0] = s[1];
- s += chan;
- l++;
- r++;
- cnt--;
- }
-}
-
-static inline void mono_from_multichannel(float *l,
- float *s,
- long cnt, int chan)
-{
- if(chan == 1)
- {
- memcpy(l, s, cnt * sizeof(float));
- return;
- }
-
- while (cnt > 0)
- {
- l[0] = s[0];
- s += chan;
- l++;
- cnt--;
- }
-}
-
#endif // INLINES_H
diff --git a/src/plugins/Ui/qsui/logo.cpp b/src/plugins/Ui/qsui/logo.cpp
index af46bac2a..c3d035c58 100644
--- a/src/plugins/Ui/qsui/logo.cpp
+++ b/src/plugins/Ui/qsui/logo.cpp
@@ -63,15 +63,12 @@ Logo::Logo(QWidget *parent) : Visual(parent)
m_source_lines.append(line);
}
- QTimer *m_timer = new QTimer(this);
+ m_timer = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), SLOT(updateLetters()));
m_timer->setInterval(50);
- m_timer->start();
m_value = 0;
m_elapsed = 0;
- m_left_buffer = new float[QMMP_VISUAL_NODE_SIZE];
- m_right_buffer = new float[QMMP_VISUAL_NODE_SIZE];
updateLetters();
Visual::add(this);
}
@@ -79,13 +76,17 @@ Logo::Logo(QWidget *parent) : Visual(parent)
Logo::~Logo()
{
Visual::remove(this);
- delete[] m_left_buffer;
- delete[] m_left_buffer;
}
-void Logo::start(){}
+void Logo::start()
+{
+ m_timer->start();
+}
-void Logo::stop(){}
+void Logo::stop()
+{
+ m_timer->stop();
+}
void Logo::paintEvent(QPaintEvent *)
{
@@ -206,43 +207,36 @@ void Logo::processPreset4()
int max = 0;
- if(takeData(m_left_buffer, m_right_buffer))
+ if(takeData(m_buffer))
{
for(int j = 0; j < QMMP_VISUAL_NODE_SIZE; j+=8)
{
- if(m_left_buffer[j] > max)
- max = abs(m_left_buffer[j] * 65536.0);
+ max = qMax(max, abs(m_buffer[j] * 65536.0));
}
- m_value -= 512;
- m_value = qMax(m_value, max);
- }
- else
- {
- m_value -= 512;
- m_value = qMax(m_value, max);
}
- //int at = 0;
+ m_value -= 512;
+ m_value = qMax(m_value, max);
+
+ int at = 0;
- /*
foreach(QString line, m_source_lines)
{
-
int count = line.count("X");
int k = 0;
- while(k < m_value * count / 2048 / 16 / 2)
+ while(k < m_value * count / 65536 / 2)
{
- int value = abs(m_left_buffer[qMin(at++, m_buffer_at)] * 16);
+ int value = abs(m_buffer[qMin(at++, QMMP_VISUAL_NODE_SIZE)] * 16);
line.replace(line.indexOf("X"), 1, QString("%1").arg(value, 0, 16).toUpper());
k++;
}
k = 0;
- while(k < m_value * count / 2048 / 16 / 2)
+ while(k < m_value * count / 65536 / 2)
{
- int value = abs(m_left_buffer[qMin(at++, m_buffer_at)] * 16);
+ int value = abs(m_buffer[qMin(at++, QMMP_VISUAL_NODE_SIZE)] * 16);
line.replace(line.lastIndexOf("X"), 1, QString("%1").arg(value, 0, 16).toUpper());
k++;
}
@@ -254,6 +248,5 @@ void Logo::processPreset4()
m_lines.append(line);
}
- */
update();
}
diff --git a/src/plugins/Ui/qsui/logo.h b/src/plugins/Ui/qsui/logo.h
index 10fef04f7..b8a661cd4 100644
--- a/src/plugins/Ui/qsui/logo.h
+++ b/src/plugins/Ui/qsui/logo.h
@@ -29,6 +29,8 @@
#include <QPixmap>
#include <qmmp/visual.h>
+class QTimer;
+
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
*/
@@ -56,10 +58,10 @@ private:
QHash <QChar, QPixmap> m_letters;
QStringList m_lines;
QStringList m_source_lines;
- float *m_left_buffer;
- float *m_right_buffer;
+ float m_buffer[QMMP_VISUAL_NODE_SIZE];
int m_value;
qint64 m_elapsed;
+ QTimer *m_timer;
};
diff --git a/src/plugins/Ui/qsui/qsuianalyzer.cpp b/src/plugins/Ui/qsui/qsuianalyzer.cpp
index 9146882ca..071c956ac 100644
--- a/src/plugins/Ui/qsui/qsuianalyzer.cpp
+++ b/src/plugins/Ui/qsui/qsuianalyzer.cpp
@@ -31,7 +31,7 @@
#include "inlines.h"
#include "qsuianalyzer.h"
-QSUiAnalyzer::QSUiAnalyzer (QWidget *parent) : Visual (parent)
+QSUiAnalyzer::QSUiAnalyzer(QWidget *parent) : Visual (parent)
{
m_intern_vis_data = 0;
m_peaks = 0;
@@ -47,8 +47,6 @@ QSUiAnalyzer::QSUiAnalyzer (QWidget *parent) : Visual (parent)
m_timer = new QTimer (this);
connect(m_timer, SIGNAL (timeout()), this, SLOT (timeout()));
- m_left_buffer = new float[QMMP_VISUAL_NODE_SIZE];
- m_right_buffer = new float[QMMP_VISUAL_NODE_SIZE];
readSettings();
clear();
@@ -56,9 +54,6 @@ QSUiAnalyzer::QSUiAnalyzer (QWidget *parent) : Visual (parent)
QSUiAnalyzer::~QSUiAnalyzer()
{
- delete [] m_left_buffer;
- delete [] m_right_buffer;
-
if(m_peaks)
delete [] m_peaks;
if(m_intern_vis_data)
@@ -94,7 +89,7 @@ void QSUiAnalyzer::setCover(const QPixmap &pixmap)
void QSUiAnalyzer::timeout()
{
- if(takeData(m_left_buffer, m_right_buffer))
+ if(takeData(m_buffer))
{
process();
update();
@@ -154,14 +149,8 @@ void QSUiAnalyzer::process()
short dest[256];
short y;
int k, magnitude;
- float data[512];
- for(int i = 0; i < QMMP_VISUAL_NODE_SIZE; ++i)
- {
- data[i] = m_left_buffer[i] / 2 + m_right_buffer[i] / 2;
- data[i] = qBound(-1.0f, data[i], 1.0f);
- }
- calc_freq (dest, data);
+ calc_freq (dest, m_buffer);
double y_scale = (double) 1.25 * m_rows / log(256);
diff --git a/src/plugins/Ui/qsui/qsuianalyzer.h b/src/plugins/Ui/qsui/qsuianalyzer.h
index dfb01b39e..91112f1e2 100644
--- a/src/plugins/Ui/qsui/qsuianalyzer.h
+++ b/src/plugins/Ui/qsui/qsuianalyzer.h
@@ -72,8 +72,7 @@ private:
double m_analyzer_falloff;
bool m_show_peaks;
bool m_show_cover;
- float *m_left_buffer;
- float *m_right_buffer;
+ float m_buffer[QMMP_VISUAL_NODE_SIZE];
int m_cols, m_rows;
int m_offset;
bool m_update;