2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2014-11-29 20:07:01 +01:00
|
|
|
Copyright 2010, David Sansome <davidsansome@gmail.com>
|
|
|
|
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
|
|
|
|
Copyright 2011-2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
|
|
Copyright 2013, Vasily Fomin <vasili.fomin@gmail.com>
|
|
|
|
Copyright 2014, Krzysztof Sobiecki <sobkas@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 2015, Mark Furneaux <mark@furneaux.ca>
|
2010-03-24 00:11:46 +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/>.
|
|
|
|
*/
|
|
|
|
|
2014-11-29 20:07:01 +01:00
|
|
|
#ifndef ANALYZERS_ANALYZERCONTAINER_H_
|
|
|
|
#define ANALYZERS_ANALYZERCONTAINER_H_
|
2010-03-20 23:45:54 +01:00
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QSignalMapper>
|
|
|
|
|
|
|
|
#include "analyzerbase.h"
|
2010-04-04 19:50:11 +02:00
|
|
|
#include "engines/engine_fwd.h"
|
2010-03-20 23:45:54 +01:00
|
|
|
|
|
|
|
class AnalyzerContainer : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2014-11-29 20:07:01 +01:00
|
|
|
explicit AnalyzerContainer(QWidget* parent);
|
2010-06-23 17:52:56 +02:00
|
|
|
void SetEngine(EngineBase* engine);
|
|
|
|
void SetActions(QAction* visualisation);
|
2010-03-20 23:45:54 +01:00
|
|
|
|
|
|
|
static const char* kSettingsGroup;
|
2011-03-05 19:53:48 +01:00
|
|
|
static const char* kSettingsFramerate;
|
2010-03-20 23:45:54 +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
|
|
|
signals:
|
2013-07-27 08:12:41 +02:00
|
|
|
void WheelEvent(int delta);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
protected:
|
|
|
|
void mouseReleaseEvent(QMouseEvent*);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent*);
|
2013-07-27 08:12:41 +02:00
|
|
|
void wheelEvent(QWheelEvent* e);
|
2010-03-20 23:45:54 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private slots:
|
2010-03-20 23:45:54 +01:00
|
|
|
void ChangeAnalyzer(int id);
|
2011-03-05 19:53:48 +01:00
|
|
|
void ChangeFramerate(int new_framerate);
|
2010-03-20 23:45:54 +01:00
|
|
|
void DisableAnalyzer();
|
2010-06-23 17:52:56 +02:00
|
|
|
void ShowPopupMenu();
|
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 TogglePsychedelicColors();
|
2010-03-20 23:45:54 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2012-03-22 20:03:17 +01:00
|
|
|
static const int kLowFramerate;
|
|
|
|
static const int kMediumFramerate;
|
|
|
|
static const int kHighFramerate;
|
|
|
|
static const int kSuperHighFramerate;
|
|
|
|
|
2010-03-20 23:45:54 +01:00
|
|
|
void Load();
|
|
|
|
void Save();
|
2011-03-05 19:53:48 +01:00
|
|
|
void SaveFramerate(int framerate);
|
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 SavePsychedelic();
|
2010-03-20 23:45:54 +01:00
|
|
|
template <typename T>
|
2014-02-07 16:34:20 +01:00
|
|
|
void AddAnalyzerType();
|
2011-03-05 19:53:48 +01:00
|
|
|
void AddFramerate(const QString& name, int framerate);
|
2010-03-20 23:45:54 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
|
|
|
int current_framerate_; // fps
|
2010-03-20 23:45:54 +01:00
|
|
|
QMenu* context_menu_;
|
2011-03-04 01:38:15 +01:00
|
|
|
QMenu* context_menu_framerate_;
|
2010-03-20 23:45:54 +01:00
|
|
|
QActionGroup* group_;
|
2011-03-04 01:38:15 +01:00
|
|
|
QActionGroup* group_framerate_;
|
2010-03-20 23:45:54 +01:00
|
|
|
QSignalMapper* mapper_;
|
2011-03-04 01:38:15 +01:00
|
|
|
QSignalMapper* mapper_framerate_;
|
2010-03-20 23:45:54 +01:00
|
|
|
|
|
|
|
QList<const QMetaObject*> analyzer_types_;
|
2011-03-05 19:53:48 +01:00
|
|
|
QList<int> framerate_list_;
|
2010-03-20 23:45:54 +01:00
|
|
|
QList<QAction*> actions_;
|
|
|
|
QAction* disable_action_;
|
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
|
|
|
QAction* psychedelic_enable_;
|
2010-03-20 23:45:54 +01:00
|
|
|
|
2010-06-23 17:52:56 +02:00
|
|
|
QAction* visualisation_action_;
|
|
|
|
QTimer* double_click_timer_;
|
|
|
|
QPoint last_click_pos_;
|
|
|
|
bool ignore_next_click_;
|
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
|
|
|
bool psychedelic_colors_on_;
|
2010-06-23 17:52:56 +02:00
|
|
|
|
2010-08-28 20:48:16 +02:00
|
|
|
Analyzer::Base* current_analyzer_;
|
2010-03-20 23:45:54 +01:00
|
|
|
EngineBase* engine_;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
2014-02-07 16:34:20 +01:00
|
|
|
void AnalyzerContainer::AddAnalyzerType() {
|
2010-03-20 23:45:54 +01:00
|
|
|
int id = analyzer_types_.count();
|
|
|
|
analyzer_types_ << &T::staticMetaObject;
|
2014-02-07 16:34:20 +01:00
|
|
|
QAction* action =
|
2015-11-21 16:20:47 +01:00
|
|
|
context_menu_->addAction(tr(T::kName), mapper_, SLOT(map()));
|
2010-03-20 23:45:54 +01:00
|
|
|
group_->addAction(action);
|
|
|
|
mapper_->setMapping(action, id);
|
|
|
|
action->setCheckable(true);
|
|
|
|
actions_ << action;
|
|
|
|
}
|
|
|
|
|
2014-11-29 20:07:01 +01:00
|
|
|
#endif // ANALYZERS_ANALYZERCONTAINER_H_
|