Qmmp
Loading...
Searching...
No Matches
visual.h
1/***************************************************************************
2 * Copyright (C) 2008-2022 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
32class VisualFactory;
33class VisualBuffer;
34
38class QMMP_EXPORT Visual : public QWidget
39{
40 Q_OBJECT
41public:
47 Visual(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
51 virtual ~Visual();
55 static QList<VisualFactory*> factories();
60 static QString file(const VisualFactory *factory);
66 static void setEnabled(VisualFactory *factory, bool enable = true);
71 static bool isEnabled(const VisualFactory *factory);
75 static void add(Visual*visual);
79 static void remove(Visual*);
86 static void initialize(QWidget *parent, QObject *receiver = nullptr, const char *member = nullptr);
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
111public slots:
115 virtual void start();
119 virtual void stop();
120
121signals:
126
127protected:
132 virtual void closeEvent (QCloseEvent *event) override;
140 bool takeData(float *left, float *right = nullptr);
141
142private:
143 static QList<VisualFactory*> *m_factories;
144 static QHash <const 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
Visual plugin interface (visual factory).
Definition visualfactory.h:46
The Visual class provides the base interface class of visualizations.
Definition visual.h:39
static void setEnabled(VisualFactory *factory, bool enable=true)
static QString file(const VisualFactory *factory)
static QList< Visual * > * visuals()
static void addAudio(float *pcm, int samples, int channels, qint64 ts, qint64 delay)
static void add(Visual *visual)
Visual(QWidget *parent, Qt::WindowFlags f=Qt::WindowFlags())
virtual ~Visual()
static void remove(Visual *)
static void showSettings(VisualFactory *factory, QWidget *parent)
virtual void start()
void closedByUser()
static QList< VisualFactory * > factories()
virtual void closeEvent(QCloseEvent *event) override
static void clearBuffer()
static bool isEnabled(const VisualFactory *factory)
static void initialize(QWidget *parent, QObject *receiver=nullptr, const char *member=nullptr)
virtual void stop()
bool takeData(float *left, float *right=nullptr)