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_QT7_MEDIAOBJECTAUDIONODE_H
19
#define Phonon_QT7_MEDIAOBJECTAUDIONODE_H
20
21
#include <QtCore/qnamespace.h>
22
#include "audionode.h"
23
24
QT_BEGIN_NAMESPACE
25
26
namespace Phonon
27
{
28
namespace QT7
29
{
30
    class QuickTimeAudioPlayer;
31
    class AudioMixerAudioNode;
32
    class AudioConnection;
33
34
    class MediaObjectAudioNode : public AudioNode
35
    {
36
        public:
37
            MediaObjectAudioNode(QuickTimeAudioPlayer *player1, QuickTimeAudioPlayer *player2);
38
            ~MediaObjectAudioNode();
39
40
            // Overridden section from AudioNode:
41
            void createAndConnectAUNodes();
42
            void createAudioUnits();
43
            void setGraph(AudioGraph *audioGraph);
44
            AUNode getOutputAUNode();
45
            bool fillInStreamSpecification(AudioConnection *connection, ConnectionSide side);
46
            bool setStreamSpecification(AudioConnection *connection, ConnectionSide side);
47
48
            void startCrossFade(qint64 duration);
49
            void updateCrossFade(qint64 currentTime);
50
            void cancelCrossFade();
51
            void setMute(bool mute);
52
            bool isCrossFading();
53
54
            QuickTimeAudioPlayer *m_player1;
55
            QuickTimeAudioPlayer *m_player2;
56
            AudioMixerAudioNode *m_mixer;
57
58
            AudioConnection *m_connection1;
59
            AudioConnection *m_connection2;
60
61
            float m_fadeDuration;
62
            float m_volume1;
63
            float m_volume2;
64
            float m_mute;
65
66
            float applyCurve(float volume);
67
            void updateVolume();
68
69
            void mediaNodeEvent(const MediaNodeEvent *event);
70
    };
71
72
}} //namespace Phonon::QT7
73
74
QT_END_NAMESPACE
75
#endif // Phonon_QT7_MEDIAOBJECTAUDIONODE_H