2014-11-29 20:07:01 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2004, Max Howell <max.howell@methylblue.com>
|
|
|
|
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
|
|
|
|
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
Copyright 2014-2015, Mark Furneaux <mark@furneaux.ca>
|
2014-11-29 20:07:01 +01:00
|
|
|
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
|
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Original Author: Max Howell <max.howell@methylblue.com> 2004
|
|
|
|
*/
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
#include "boomanalyzer.h"
|
|
|
|
#include <cmath>
|
2010-03-22 14:49:08 +01:00
|
|
|
#include <QPainter>
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2014-05-13 14:46:22 +02:00
|
|
|
using Analyzer::Scope;
|
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
const uint BoomAnalyzer::kColumnWidth = 4;
|
|
|
|
const uint BoomAnalyzer::kMaxBandCount = 256;
|
|
|
|
const uint BoomAnalyzer::kMinBandCount = 32;
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
const char* BoomAnalyzer::kName =
|
|
|
|
QT_TRANSLATE_NOOP("AnalyzerContainer", "Boom analyzer");
|
|
|
|
|
|
|
|
BoomAnalyzer::BoomAnalyzer(QWidget* parent)
|
|
|
|
: Analyzer::Base(parent, 9),
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
bands_(0),
|
|
|
|
scope_(kMinBandCount),
|
|
|
|
fg_(palette().color(QPalette::Highlight)),
|
|
|
|
K_barHeight_(1.271) // 1.471
|
2014-02-07 16:34:20 +01:00
|
|
|
,
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
F_peakSpeed_(1.103) // 1.122
|
2014-02-07 16:34:20 +01:00
|
|
|
,
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
F_(1.0),
|
|
|
|
bar_height_(kMaxBandCount, 0),
|
|
|
|
peak_height_(kMaxBandCount, 0),
|
|
|
|
peak_speed_(kMaxBandCount, 0.01),
|
|
|
|
barPixmap_(kColumnWidth, 50) {
|
|
|
|
setMinimumWidth(kMinBandCount * (kColumnWidth + 1) - 1);
|
|
|
|
setMaximumWidth(kMaxBandCount * (kColumnWidth + 1) - 1);
|
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
void BoomAnalyzer::changeK_barHeight(int newValue) {
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
K_barHeight_ = static_cast<double>(newValue) / 1000;
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
void BoomAnalyzer::changeF_peakSpeed(int newValue) {
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
F_peakSpeed_ = static_cast<double>(newValue) / 1000;
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
void BoomAnalyzer::resizeEvent(QResizeEvent* e) {
|
|
|
|
QWidget::resizeEvent(e);
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
const uint HEIGHT = height() - 2;
|
|
|
|
const double h = 1.2 / HEIGHT;
|
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
bands_ = qMin(
|
|
|
|
static_cast<uint>(static_cast<double>(width() + 1) / (kColumnWidth + 1)) +
|
|
|
|
1,
|
|
|
|
kMaxBandCount);
|
|
|
|
scope_.resize(bands_);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
F_ = static_cast<double>(HEIGHT) / (log10(256) * 1.1 /*<- max. amplitude*/);
|
|
|
|
|
|
|
|
barPixmap_ = QPixmap(kColumnWidth - 2, HEIGHT);
|
2014-04-27 07:54:42 +02:00
|
|
|
canvas_ = QPixmap(size());
|
|
|
|
canvas_.fill(palette().color(QPalette::Background));
|
2014-02-07 16:34:20 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
QPainter p(&barPixmap_);
|
2014-02-07 16:34:20 +01:00
|
|
|
for (uint y = 0; y < HEIGHT; ++y) {
|
2014-11-29 21:05:59 +01:00
|
|
|
const double F = static_cast<double>(y) * h;
|
2014-02-07 16:34:20 +01:00
|
|
|
|
2014-11-29 20:07:01 +01:00
|
|
|
p.setPen(QColor(qMax(0, 255 - static_cast<int>(229.0 * F)),
|
|
|
|
qMax(0, 255 - static_cast<int>(229.0 * F)),
|
|
|
|
qMax(0, 255 - static_cast<int>(191.0 * F))));
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
p.drawLine(0, y, kColumnWidth - 2, y);
|
2014-02-07 16:34:20 +01:00
|
|
|
}
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
|
|
|
|
updateBandSize(bands_);
|
2010-03-21 18:22:05 +01:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
void BoomAnalyzer::transform(Scope& s) {
|
|
|
|
float* front = static_cast<float*>(&s.front());
|
2009-12-24 20:16:07 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
fht_->spectrum(front);
|
|
|
|
fht_->scale(front, 1.0 / 50);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
s.resize(scope_.size() <= kMaxBandCount / 2 ? kMaxBandCount / 2
|
|
|
|
: scope_.size());
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
|
2015-11-23 19:48:22 +01:00
|
|
|
if (!new_frame || engine_->state() == Engine::Paused) {
|
2014-04-27 07:54:42 +02:00
|
|
|
p.drawPixmap(0, 0, canvas_);
|
|
|
|
return;
|
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
float h;
|
|
|
|
const uint MAX_HEIGHT = height() - 1;
|
2010-08-28 20:48:16 +02:00
|
|
|
|
2014-04-27 07:54:42 +02:00
|
|
|
QPainter canvas_painter(&canvas_);
|
|
|
|
canvas_.fill(palette().color(QPalette::Background));
|
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
Analyzer::interpolate(scope, scope_);
|
|
|
|
|
|
|
|
// update the graphics with the new colour
|
|
|
|
if (psychedelic_enabled_) {
|
|
|
|
paletteChange(QPalette());
|
|
|
|
}
|
|
|
|
|
|
|
|
for (uint i = 0, x = 0, y; i < bands_; ++i, x += kColumnWidth + 1) {
|
|
|
|
h = log10(scope_[i] * 256.0) * F_;
|
2010-08-28 20:48:16 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
if (h > MAX_HEIGHT) h = MAX_HEIGHT;
|
2010-08-28 20:48:16 +02:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
if (h > bar_height_[i]) {
|
|
|
|
bar_height_[i] = h;
|
2010-08-28 20:48:16 +02:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
if (h > peak_height_[i]) {
|
|
|
|
peak_height_[i] = h;
|
|
|
|
peak_speed_[i] = 0.01;
|
2014-11-29 20:07:01 +01:00
|
|
|
} else {
|
2014-02-07 16:34:20 +01:00
|
|
|
goto peak_handling;
|
2014-11-29 20:07:01 +01:00
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
} else {
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
if (bar_height_[i] > 0.0) {
|
|
|
|
bar_height_[i] -= K_barHeight_; // 1.4
|
|
|
|
if (bar_height_[i] < 0.0) bar_height_[i] = 0.0;
|
2014-02-07 16:34:20 +01:00
|
|
|
}
|
2010-08-28 20:48:16 +02:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
peak_handling:
|
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
if (peak_height_[i] > 0.0) {
|
|
|
|
peak_height_[i] -= peak_speed_[i];
|
|
|
|
peak_speed_[i] *= F_peakSpeed_; // 1.12
|
2010-08-28 20:48:16 +02:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
if (peak_height_[i] < bar_height_[i]) peak_height_[i] = bar_height_[i];
|
|
|
|
if (peak_height_[i] < 0.0) peak_height_[i] = 0.0;
|
2014-02-07 16:34:20 +01:00
|
|
|
}
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
2014-02-07 16:34:20 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
y = height() - uint(bar_height_[i]);
|
|
|
|
canvas_painter.drawPixmap(x + 1, y, barPixmap_, 0, y, -1, -1);
|
|
|
|
canvas_painter.setPen(fg_);
|
|
|
|
if (bar_height_[i] > 0)
|
|
|
|
canvas_painter.drawRect(x, y, kColumnWidth - 1, height() - y - 1);
|
2014-02-07 16:34:20 +01:00
|
|
|
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
y = height() - uint(peak_height_[i]);
|
|
|
|
canvas_painter.setPen(palette().color(QPalette::Midlight));
|
|
|
|
canvas_painter.drawLine(x, y, x + kColumnWidth - 1, y);
|
2014-02-07 16:34:20 +01:00
|
|
|
}
|
2014-04-27 07:54:42 +02:00
|
|
|
|
|
|
|
p.drawPixmap(0, 0, canvas_);
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)
I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 17:48:03 +02:00
|
|
|
|
|
|
|
void BoomAnalyzer::psychedelicModeChanged(bool enabled) {
|
|
|
|
psychedelic_enabled_ = enabled;
|
|
|
|
// reset colours back to normal
|
|
|
|
paletteChange(QPalette());
|
|
|
|
}
|
|
|
|
|
|
|
|
void BoomAnalyzer::paletteChange(const QPalette&) {
|
|
|
|
if (psychedelic_enabled_) {
|
|
|
|
fg_ = getPsychedelicColor(scope_, 50, 100);
|
|
|
|
} else {
|
|
|
|
// the highlight colour changes when the main window loses focus,
|
|
|
|
// so we use save and use the focused colour
|
|
|
|
fg_ = palette().color(QPalette::Highlight);
|
|
|
|
}
|
|
|
|
}
|