Qmmp
visual.h
1 /***************************************************************************
2  * Copyright (C) 2008-2018 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef VISUAL_H
21 #define VISUAL_H
22 
23 #include <QMutex>
24 #include <QStringList>
25 #include <QWidget>
26 #include <QHash>
27 #include <stddef.h>
28 #include "qmmp_export.h"
29 
30 #define QMMP_VISUAL_NODE_SIZE 512 //samples
31 
32 class VisualFactory;
33 class VisualBuffer;
34 
38 class QMMP_EXPORT Visual : public QWidget
39 {
40  Q_OBJECT
41 public:
47  Visual(QWidget *parent, Qt::WindowFlags f = 0);
51  virtual ~Visual();
55  static QList<VisualFactory*> factories();
60  static QString file(VisualFactory *factory);
66  static void setEnabled(VisualFactory* factory, bool enable = true);
71  static bool isEnabled(VisualFactory* factory);
75  static void add(Visual*visual);
79  static void remove(Visual*);
86  static void initialize(QWidget *parent, QObject *receiver = 0, const char *member = 0);
90  static QList<Visual *> *visuals();
96  static void showSettings(VisualFactory *factory, QWidget *parent);
105  static void addAudio(float *pcm, int samples, int channels, qint64 ts, qint64 delay);
109  static void clearBuffer();
110 
111 public slots:
115  virtual void start() = 0;
119  virtual void stop() = 0;
120 
121 signals:
125  void closedByUser();
126 
127 protected:
132  virtual void closeEvent (QCloseEvent *event);
140  bool takeData(float *left, float *right = 0);
141 
142 private:
143  static QList<VisualFactory*> *m_factories;
144  static QHash <VisualFactory*, QString> *m_files;
145  static void checkFactories();
146  static QList<Visual*> m_visuals;
147  static QHash<VisualFactory*, Visual*> m_vis_map; //internal visualization
148  static QWidget *m_parentWidget;
149  static QObject *m_receiver;
150  static const char *m_member;
151  static VisualBuffer m_buffer;
152 };
153 
154 #endif
The Visual class provides the base interface class of visualizations.
Definition: visual.h:38
Visual plugin interface (visual factory).
Definition: visualfactory.h:53