Qmmp
visual.h
1 /***************************************************************************
2  * Copyright (C) 2008-2017 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 
29 #define QMMP_VISUAL_NODE_SIZE 512 //samples
30 
31 class VisualFactory;
32 class VisualBuffer;
33 
37 class Visual : public QWidget
38 {
39  Q_OBJECT
40 public:
46  Visual(QWidget *parent, Qt::WindowFlags f = 0);
50  virtual ~Visual();
54  static QList<VisualFactory*> factories();
59  static QString file(VisualFactory *factory);
65  static void setEnabled(VisualFactory* factory, bool enable = true);
70  static bool isEnabled(VisualFactory* factory);
74  static void add(Visual*visual);
78  static void remove(Visual*);
85  static void initialize(QWidget *parent, QObject *receiver = 0, const char *member = 0);
89  static QList<Visual *> *visuals();
95  static void showSettings(VisualFactory *factory, QWidget *parent);
104  static void addAudio(float *pcm, int samples, int channels, qint64 ts, qint64 delay);
108  static void clearBuffer();
109 
110 public slots:
114  virtual void start() = 0;
118  virtual void stop() = 0;
119 
120 signals:
124  void closedByUser();
125 
126 protected:
131  virtual void closeEvent (QCloseEvent *event);
139  bool takeData(float *left, float *right = 0);
140 
141 private:
142  static QList<VisualFactory*> *m_factories;
143  static QHash <VisualFactory*, QString> *m_files;
144  static void checkFactories();
145  static QList<Visual*> m_visuals;
146  static QHash<VisualFactory*, Visual*> m_vis_map; //internal visualization
147  static QWidget *m_parentWidget;
148  static QObject *m_receiver;
149  static const char *m_member;
150  static VisualBuffer m_buffer;
151 };
152 
153 #endif
static QList< VisualFactory * > factories()
virtual void closeEvent(QCloseEvent *event)
Visual(QWidget *parent, Qt::WindowFlags f=0)
static void setEnabled(VisualFactory *factory, bool enable=true)
bool takeData(float *left, float *right=0)
static QString file(VisualFactory *factory)
static void initialize(QWidget *parent, QObject *receiver=0, const char *member=0)
virtual ~Visual()
The Visual class provides the base interface class of visualizations.
Definition: visual.h:37
static bool isEnabled(VisualFactory *factory)
static void addAudio(float *pcm, int samples, int channels, qint64 ts, qint64 delay)
static void add(Visual *visual)
void closedByUser()
virtual void start()=0
Visual plugin interface (visual factory).
Definition: visualfactory.h:52
static void clearBuffer()
static QList< Visual * > * visuals()
static void showSettings(VisualFactory *factory, QWidget *parent)
virtual void stop()=0