1
/*  This file is part of the KDE project.
2
3
    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
5
    This library is free software: you can redistribute it and/or modify
6
    it under the terms of the GNU Lesser General Public License as published by
7
    the Free Software Foundation, either version 2.1 or 3 of the License.
8
9
    This library is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
13
14
    You should have received a copy of the GNU Lesser General Public License
15
    along with this library.  If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef Phonon_GSTREAMER_VOLUMEFADEREFFECT_H
19
#define Phonon_GSTREAMER_VOLUMEFADEREFFECT_H
20
21
#include "medianode.h"
22
#include "effect.h"
23
24
#include <phonon/effectinterface.h>
25
#include <phonon/effectparameter.h>
26
#include <phonon/volumefaderinterface.h>
27
28
#include <QtCore>
29
30
#include <gst/gst.h>
31
32
QT_BEGIN_NAMESPACE
33
#ifndef QT_NO_PHONON_VOLUMEFADEREFFECT
34
namespace Phonon
35
{
36
namespace Gstreamer
37
{
38
    class VolumeFaderEffect : public Effect, public VolumeFaderInterface
39
    {
40
        Q_OBJECT
41
        Q_INTERFACES(Phonon::VolumeFaderInterface)
42
43
        public:
44
            VolumeFaderEffect(Backend *backend, QObject *parent = 0);
45
            ~VolumeFaderEffect();
46
47
            GstElement* createEffectBin();
48
            GstElement *audioElement() { return m_effectBin; }
49
            bool event(QEvent *);
50
            void updateFade();
51
52
            // VolumeFaderInterface:
53
            float volume() const;
54
            void setVolume(float volume);
55
            Phonon::VolumeFaderEffect::FadeCurve fadeCurve() const;
56
            void setFadeCurve(Phonon::VolumeFaderEffect::FadeCurve fadeCurve);
57
            void fadeTo(float volume, int fadeTime);
58
59
            Phonon::VolumeFaderEffect::FadeCurve m_fadeCurve;
60
            int m_fadeTimer;
61
            int m_fadeDuration;
62
            float m_fadeFromVolume;
63
            float m_fadeToVolume;
64
            QTime m_fadeStartTime;
65
    };
66
}} //namespace Phonon::Gstreamer
67
#endif //QT_NO_PHONON_VOLUMEFADEREFFECT
68
QT_END_NAMESPACE
69
70
#endif // Phonon_GSTREAMER_VOLUMEFADEREFFECT_H