diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-01-17 06:32:42 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-01-17 06:32:42 +0000 |
| commit | 740b179d7565ca0f846817d4abc6fee8fb8ca7cc (patch) | |
| tree | a930dc1b66479bad3efa99900836b3db6e078523 /src/plugins/Ui/qsui/logo.cpp | |
| parent | 240d991e41a3bb874d5289456215e67d23856361 (diff) | |
| download | qmmp-740b179d7565ca0f846817d4abc6fee8fb8ca7cc.tar.gz qmmp-740b179d7565ca0f846817d4abc6fee8fb8ca7cc.tar.bz2 qmmp-740b179d7565ca0f846817d4abc6fee8fb8ca7cc.zip | |
removed old visual api usage
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6986 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Ui/qsui/logo.cpp')
| -rw-r--r-- | src/plugins/Ui/qsui/logo.cpp | 70 |
1 files changed, 21 insertions, 49 deletions
diff --git a/src/plugins/Ui/qsui/logo.cpp b/src/plugins/Ui/qsui/logo.cpp index d4454a4ee..af46bac2a 100644 --- a/src/plugins/Ui/qsui/logo.cpp +++ b/src/plugins/Ui/qsui/logo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011-2016 by Ilya Kotov * + * Copyright (C) 2011-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -26,9 +26,6 @@ #include "inlines.h" #include "logo.h" -#define VISUAL_NODE_SIZE 128 //samples -#define VISUAL_BUFFER_SIZE (3*VISUAL_NODE_SIZE) - Logo::Logo(QWidget *parent) : Visual(parent) { QPixmap pixmap(":/qsui/terminus.png"); @@ -71,11 +68,10 @@ Logo::Logo(QWidget *parent) : Visual(parent) m_timer->setInterval(50); m_timer->start(); - m_buffer_at = 0; m_value = 0; m_elapsed = 0; - m_buffer = new float[VISUAL_BUFFER_SIZE]; - + m_left_buffer = new float[QMMP_VISUAL_NODE_SIZE]; + m_right_buffer = new float[QMMP_VISUAL_NODE_SIZE]; updateLetters(); Visual::add(this); } @@ -83,28 +79,13 @@ Logo::Logo(QWidget *parent) : Visual(parent) Logo::~Logo() { Visual::remove(this); - delete[] m_buffer; + delete[] m_left_buffer; + delete[] m_left_buffer; } -void Logo::add(float *data, size_t samples, int chan) -{ - Q_UNUSED(chan); - if(VISUAL_BUFFER_SIZE == m_buffer_at) - { - m_buffer_at -= VISUAL_NODE_SIZE; - memmove(m_buffer, (m_buffer + VISUAL_NODE_SIZE), m_buffer_at * sizeof(float)); - return; - } - int frames = qMin(int(samples/chan), VISUAL_BUFFER_SIZE - m_buffer_at); +void Logo::start(){} - mono_from_multichannel(m_buffer + m_buffer_at, data, frames, chan); - m_buffer_at += frames; -} - -void Logo::clear() -{ - update(); -} +void Logo::stop(){} void Logo::paintEvent(QPaintEvent *) { @@ -159,7 +140,6 @@ void Logo::updateLetters() void Logo::processPreset1() { m_lines.clear(); - mutex()->lock(); QString line; for(int i = 0; i < m_source_lines.count(); ++i) { @@ -177,14 +157,12 @@ void Logo::processPreset1() } m_lines.append(line); } - mutex()->unlock(); update(); } void Logo::processPreset2() { m_lines.clear(); - mutex()->lock(); QString str = QString("..0000..");//.arg(Qmmp::strVersion().left(5)); int at = m_value % str.size(); @@ -199,14 +177,12 @@ void Logo::processPreset2() m_lines.append(line); } - mutex()->unlock(); update(); } void Logo::processPreset3() { m_lines.clear(); - mutex()->lock(); QString str = QString("...%1...").arg(Qmmp::strVersion().left(6)); int at = m_value % str.size(); @@ -221,38 +197,34 @@ void Logo::processPreset3() m_lines.append(line); } - mutex()->unlock(); update(); } void Logo::processPreset4() { m_lines.clear(); - mutex()->lock(); int max = 0; - if(m_buffer_at < VISUAL_NODE_SIZE) + if(takeData(m_left_buffer, m_right_buffer)) { - m_value -= 512; - m_value = qMax(m_value, max); - } - else - { - for(int j = 0; j < VISUAL_NODE_SIZE; j+=8) + for(int j = 0; j < QMMP_VISUAL_NODE_SIZE; j+=8) { - if(m_buffer[j] > max) - max = abs(m_buffer[j] * 65536.0); + if(m_left_buffer[j] > max) + max = abs(m_left_buffer[j] * 65536.0); } - - m_buffer_at -= VISUAL_NODE_SIZE; - memmove(m_buffer, m_buffer + VISUAL_NODE_SIZE, m_buffer_at * sizeof(float)); m_value -= 512; m_value = qMax(m_value, max); } + else + { + m_value -= 512; + m_value = qMax(m_value, max); + } - int at = 0; + //int at = 0; + /* foreach(QString line, m_source_lines) { @@ -261,7 +233,7 @@ void Logo::processPreset4() while(k < m_value * count / 2048 / 16 / 2) { - int value = abs(m_buffer[qMin(at++, m_buffer_at)] * 16); + int value = abs(m_left_buffer[qMin(at++, m_buffer_at)] * 16); line.replace(line.indexOf("X"), 1, QString("%1").arg(value, 0, 16).toUpper()); k++; } @@ -270,7 +242,7 @@ void Logo::processPreset4() while(k < m_value * count / 2048 / 16 / 2) { - int value = abs(m_buffer[qMin(at++, m_buffer_at)] * 16); + int value = abs(m_left_buffer[qMin(at++, m_buffer_at)] * 16); line.replace(line.lastIndexOf("X"), 1, QString("%1").arg(value, 0, 16).toUpper()); k++; } @@ -282,6 +254,6 @@ void Logo::processPreset4() m_lines.append(line); } - mutex()->unlock(); + */ update(); } |
