File indexing completed on 2024-05-05 04:44:41
0001 /* This file is part of the KDE project 0002 Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) version 3, or any 0008 later version accepted by the membership of KDE e.V. (or its 0009 successor approved by the membership of KDE e.V.), Nokia Corporation 0010 (or its successors, if any) and the KDE Free Qt Foundation, which shall 0011 act as a proxy defined in Section 6 of version 3 of the license. 0012 0013 This library is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 Lesser General Public License for more details. 0017 0018 You should have received a copy of the GNU Lesser General Public 0019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0020 0021 */ 0022 0023 #ifndef PHONON_VISUALIZATION_H 0024 #define PHONON_VISUALIZATION_H 0025 0026 #include "export.h" 0027 #include "../phonondefs.h" 0028 #include <QObject> 0029 #include "../objectdescription.h" 0030 #include "../objectdescriptionmodel.h" 0031 #include "../medianode.h" 0032 0033 namespace Phonon 0034 { 0035 class AudioPath; 0036 class AbstractVideoOutput; 0037 0038 namespace Experimental 0039 { 0040 class VisualizationPrivate; 0041 0042 enum { 0043 VisualizationType = 0xfffffffe 0044 }; 0045 typedef ObjectDescription<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescription; 0046 typedef ObjectDescriptionModel<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescriptionModel; 0047 0048 /** 0049 * \short A class to create visual effects from an audio signal. 0050 * 0051 * This class is used to define how an audio signal from an AudioPath object 0052 * should be visualized. What visualization effects are available depends solely 0053 * on the backend. You can list the available visualization effects using 0054 * BackendCapabilities::availableVisualizationEffects(). 0055 * 0056 * The following example code takes the first effect from the list and uses that 0057 * to display a visualization on a new VideoWidget. 0058 * \code 0059 * QList<VisualizationDescription> list = BackendCapabilities::availableVisualizationEffects(); 0060 * if (list.size() > 0) 0061 * { 0062 * VideoWidget *visWidget = new VideoWidget(parent); 0063 * Visualization *vis = new Visualization(visWidget); 0064 * vis->setAudioPath(audioPath); 0065 * vis->setVideoOutput(visWidget); 0066 * vis->setVisualization(list.first()); 0067 * } 0068 * \endcode 0069 * 0070 * \author Matthias Kretz <kretz@kde.org> 0071 * \see AudioDataOutput 0072 * \see BackendCapabilities::availableVisualizationEffects() 0073 */ 0074 class PHONONEXPERIMENTAL_EXPORT Visualization : public QObject, public MediaNode 0075 { 0076 Q_OBJECT 0077 P_DECLARE_PRIVATE(Visualization) 0078 PHONON_OBJECT(Visualization) 0079 Q_PROPERTY(VisualizationDescription visualization READ visualization WRITE setVisualization) 0080 0081 public: 0082 ~Visualization() override; 0083 0084 VisualizationDescription visualization() const; 0085 void setVisualization(const VisualizationDescription &newVisualization); 0086 0087 /** 0088 * Returns whether the selected visualization effect can be configured 0089 * by the user with a widget returned by createParameterWidget(). In 0090 * short it tells you whether createParameterWidget() will return 0 or 0091 * not. 0092 */ 0093 //bool hasParameterWidget() const; 0094 0095 /** 0096 * Returns a widget that displays effect parameter controls to the user. 0097 * 0098 * \param parent The parent widget for the new widget. 0099 */ 0100 //QWidget *createParameterWidget(QWidget *parent = 0); 0101 }; 0102 0103 } // namespace Experimental 0104 } // namespace Phonon 0105 0106 #endif // PHONON_VISUALIZATION_H 0107 // vim: sw=4 ts=4 tw=80