1 | /* This file is part of the KDE project |
2 | Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2.1 of the License, or (at your option) version 3, or any |
8 | later version accepted by the membership of KDE e.V. (or its |
9 | successor approved by the membership of KDE e.V.), Nokia Corporation |
10 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
11 | act as a proxy defined in Section 6 of version 3 of the license. |
12 | |
13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Lesser General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Lesser General Public |
19 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
20 | |
21 | */ |
22 | |
23 | #ifndef PHONON_VISUALIZATION_H |
24 | #define PHONON_VISUALIZATION_H |
25 | |
26 | #include "export.h" |
27 | #include "../phonondefs.h" |
28 | #include <QObject> |
29 | #include "../objectdescription.h" |
30 | #include "../objectdescriptionmodel.h" |
31 | #include "../medianode.h" |
32 | |
33 | namespace Phonon |
34 | { |
35 | class AudioPath; |
36 | class AbstractVideoOutput; |
37 | |
38 | namespace Experimental |
39 | { |
40 | class VisualizationPrivate; |
41 | |
42 | enum { |
43 | VisualizationType = 0xfffffffe |
44 | }; |
45 | typedef ObjectDescription<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescription; |
46 | typedef ObjectDescriptionModel<static_cast<Phonon::ObjectDescriptionType>(VisualizationType)> VisualizationDescriptionModel; |
47 | |
48 | /** |
49 | * \short A class to create visual effects from an audio signal. |
50 | * |
51 | * This class is used to define how an audio signal from an AudioPath object |
52 | * should be visualized. What visualization effects are available depends solely |
53 | * on the backend. You can list the available visualization effects using |
54 | * BackendCapabilities::availableVisualizationEffects(). |
55 | * |
56 | * The following example code takes the first effect from the list and uses that |
57 | * to display a visualization on a new VideoWidget. |
58 | * \code |
59 | * QList<VisualizationDescription> list = BackendCapabilities::availableVisualizationEffects(); |
60 | * if (list.size() > 0) |
61 | * { |
62 | * VideoWidget *visWidget = new VideoWidget(parent); |
63 | * Visualization *vis = new Visualization(visWidget); |
64 | * vis->setAudioPath(audioPath); |
65 | * vis->setVideoOutput(visWidget); |
66 | * vis->setVisualization(list.first()); |
67 | * } |
68 | * \endcode |
69 | * |
70 | * \author Matthias Kretz <kretz@kde.org> |
71 | * \see AudioDataOutput |
72 | * \see BackendCapabilities::availableVisualizationEffects() |
73 | */ |
74 | class PHONONEXPERIMENTAL_EXPORT Visualization : public QObject, public MediaNode |
75 | { |
76 | Q_OBJECT |
77 | P_DECLARE_PRIVATE(Visualization) |
78 | PHONON_OBJECT(Visualization) |
79 | Q_PROPERTY(VisualizationDescription visualization READ visualization WRITE setVisualization) |
80 | |
81 | public: |
82 | ~Visualization() override; |
83 | |
84 | VisualizationDescription visualization() const; |
85 | void setVisualization(const VisualizationDescription &newVisualization); |
86 | |
87 | /** |
88 | * Returns whether the selected visualization effect can be configured |
89 | * by the user with a widget returned by createParameterWidget(). In |
90 | * short it tells you whether createParameterWidget() will return 0 or |
91 | * not. |
92 | */ |
93 | //bool hasParameterWidget() const; |
94 | |
95 | /** |
96 | * Returns a widget that displays effect parameter controls to the user. |
97 | * |
98 | * \param parent The parent widget for the new widget. |
99 | */ |
100 | //QWidget *createParameterWidget(QWidget *parent = 0); |
101 | }; |
102 | |
103 | } // namespace Experimental |
104 | } // namespace Phonon |
105 | |
106 | #endif // PHONON_VISUALIZATION_H |
107 | // vim: sw=4 ts=4 tw=80 |
108 | |