2014-11-29 20:07:01 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2003-2005, Max Howell <max.howell@methylblue.com>
|
|
|
|
Copyright 2005, Mark Kretschmann <markey@web.de>
|
|
|
|
Copyright 2009-2010, David Sansome <davidsansome@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 A. Sobiecki <sobkas@gmail.com>
|
|
|
|
Copyright 2014, John Maguire <john.maguire@gmail.com>
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2014-11-29 20:07:01 +01:00
|
|
|
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> 2003-2005
|
|
|
|
* Original Author: Mark Kretschmann <markey@web.de> 2005
|
2020-09-18 16:15:19 +02:00
|
|
|
*/
|
2014-11-29 20:07:01 +01:00
|
|
|
|
|
|
|
#ifndef ANALYZERS_BARANALYZER_H_
|
|
|
|
#define ANALYZERS_BARANALYZER_H_
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
#include "analyzerbase.h"
|
|
|
|
|
|
|
|
typedef std::vector<uint> aroofMemVec;
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
class BarAnalyzer : public Analyzer::Base {
|
2010-03-20 23:45:54 +01:00
|
|
|
Q_OBJECT
|
2014-11-29 20:07:01 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
|
|
|
Q_INVOKABLE BarAnalyzer(QWidget*);
|
|
|
|
|
|
|
|
void init();
|
2014-05-13 14:46:22 +02:00
|
|
|
virtual void analyze(QPainter& p, const Analyzer::Scope&, bool new_frame);
|
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
|
|
|
virtual void psychedelicModeChanged(bool);
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resizes the widget to a new geometry according to @p e
|
|
|
|
* @param e The resize-event
|
|
|
|
*/
|
|
|
|
void resizeEvent(QResizeEvent* e);
|
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 colorChanged();
|
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
|
|
|
uint band_count_;
|
|
|
|
int max_down_;
|
|
|
|
int max_up_;
|
|
|
|
static const uint kRoofHoldTime = 48;
|
|
|
|
static const int kRoofVelocityReductionFactor = 32;
|
|
|
|
static const uint kNumRoofs = 16;
|
|
|
|
static const uint kColumnWidth = 4;
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
static const char* kName;
|
|
|
|
|
|
|
|
protected:
|
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
|
|
|
QPixmap pixRoof_[kNumRoofs];
|
|
|
|
// vector<uint> roofMem_[band_count_];
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
// Scope m_bands; //copy of the Scope to prevent creating/destroying a Scope
|
|
|
|
// every iteration
|
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
|
|
|
uint lvlMapper_[256];
|
|
|
|
std::vector<aroofMemVec> roofMem_;
|
|
|
|
std::vector<uint> barVector_; // positions of bars
|
|
|
|
std::vector<int> roofVector_; // positions of roofs
|
|
|
|
std::vector<uint> roofVelocityVector_; // speed that roofs falls
|
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
|
|
|
const QPixmap* gradient() const { return &pixBarGradient_; }
|
2014-02-07 16:34:20 +01:00
|
|
|
|
|
|
|
private:
|
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
|
|
|
QPixmap pixBarGradient_;
|
|
|
|
QPixmap pixCompose_;
|
2014-04-27 07:54:42 +02:00
|
|
|
QPixmap canvas_;
|
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::Scope scope_; // so we don't create a vector every frame
|
|
|
|
QColor bg_;
|
2009-12-24 20:16:07 +01:00
|
|
|
};
|
|
|
|
|
2014-11-29 20:07:01 +01:00
|
|
|
#endif // ANALYZERS_BARANALYZER_H_
|