Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2017 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 #ifndef VISUAL_H 00021 #define VISUAL_H 00022 00023 #include <QMutex> 00024 #include <QStringList> 00025 #include <QWidget> 00026 #include <QHash> 00027 #include <stddef.h> 00028 00029 #define QMMP_VISUAL_NODE_SIZE 512 //samples 00030 00031 class VisualFactory; 00032 class VisualBuffer; 00033 00037 class Visual : public QWidget 00038 { 00039 Q_OBJECT 00040 public: 00046 Visual(QWidget *parent, Qt::WindowFlags f = 0); 00050 virtual ~Visual(); 00054 static QList<VisualFactory*> factories(); 00059 static QString file(VisualFactory *factory); 00065 static void setEnabled(VisualFactory* factory, bool enable = true); 00070 static bool isEnabled(VisualFactory* factory); 00074 static void add(Visual*visual); 00078 static void remove(Visual*); 00085 static void initialize(QWidget *parent, QObject *receiver = 0, const char *member = 0); 00089 static QList<Visual *> *visuals(); 00095 static void showSettings(VisualFactory *factory, QWidget *parent); 00102 static void addAudio(float *pcm, int samples, int channels, qint64 ts, qint64 delay); 00103 static void clearBuffer(); 00104 00105 public slots: 00106 virtual void start() = 0; 00107 virtual void stop() = 0; 00108 00109 signals: 00113 void closedByUser(); 00114 00115 protected: 00120 virtual void closeEvent (QCloseEvent *event); 00121 00122 bool takeData(float *left, float *right = 0); 00123 00124 private: 00125 static QList<VisualFactory*> *m_factories; 00126 static QHash <VisualFactory*, QString> *m_files; 00127 static void checkFactories(); 00128 static QList<Visual*> m_visuals; 00129 static QHash<VisualFactory*, Visual*> m_vis_map; //internal visualization 00130 static QWidget *m_parentWidget; 00131 static QObject *m_receiver; 00132 static const char *m_member; 00133 static VisualBuffer m_buffer; 00134 }; 00135 00136 #endif