| 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_AUDIOGRAPH_H
|
|---|
| 19 | #define Phonon_QT7_AUDIOGRAPH_H
|
|---|
| 20 |
|
|---|
| 21 | #include <AudioToolbox/AudioToolbox.h>
|
|---|
| 22 | #include <AudioUnit/AudioUnit.h>
|
|---|
| 23 |
|
|---|
| 24 | #include <QtCore/qnamespace.h>
|
|---|
| 25 | #include "audioconnection.h"
|
|---|
| 26 | #include "medianode.h"
|
|---|
| 27 |
|
|---|
| 28 | QT_BEGIN_NAMESPACE
|
|---|
| 29 |
|
|---|
| 30 | namespace Phonon
|
|---|
| 31 | {
|
|---|
| 32 | namespace QT7
|
|---|
| 33 | {
|
|---|
| 34 | class AudioGraph : public MediaNode
|
|---|
| 35 | {
|
|---|
| 36 | public:
|
|---|
| 37 | AudioGraph(MediaNode *root);
|
|---|
| 38 | virtual ~AudioGraph();
|
|---|
| 39 | AUGraph audioGraphRef();
|
|---|
| 40 | void startAllOverFromScratch();
|
|---|
| 41 |
|
|---|
| 42 | bool openAndInit();
|
|---|
| 43 | void start();
|
|---|
| 44 | void tryStartGraph();
|
|---|
| 45 | void stop();
|
|---|
| 46 | void prepare();
|
|---|
| 47 | void rebuildGraph();
|
|---|
| 48 | void update();
|
|---|
| 49 | bool isRunning();
|
|---|
| 50 | void setPaused(bool pause);
|
|---|
| 51 | bool graphCannotPlay();
|
|---|
| 52 | void rebuildGraphIfNeeded();
|
|---|
| 53 | void updateStreamSpecifications();
|
|---|
| 54 | void setStatusCannotPlay();
|
|---|
| 55 | MediaNode *root();
|
|---|
| 56 | void notify(const MediaNodeEvent *event, bool propagate = true);
|
|---|
| 57 |
|
|---|
| 58 | private:
|
|---|
| 59 | friend class MediaNode;
|
|---|
| 60 | friend class AudioNode;
|
|---|
| 61 |
|
|---|
| 62 | void deleteGraph();
|
|---|
| 63 | bool updateStreamSpecificationRecursive(AudioConnection *connection);
|
|---|
| 64 | void createAndConnectAuNodesRecursive(AudioConnection *connection);
|
|---|
| 65 | bool createAudioUnitsRecursive(AudioConnection *connection);
|
|---|
| 66 |
|
|---|
| 67 | void connectLate(AudioConnection *connection);
|
|---|
| 68 | void disconnectLate(AudioConnection *connection);
|
|---|
| 69 |
|
|---|
| 70 | int nodeCount();
|
|---|
| 71 |
|
|---|
| 72 | bool m_initialized;
|
|---|
| 73 | bool m_startedLogically;
|
|---|
| 74 | bool m_rebuildLater;
|
|---|
| 75 | bool m_graphCannotPlay;
|
|---|
| 76 | bool m_paused;
|
|---|
| 77 |
|
|---|
| 78 | AUGraph m_audioGraphRef;
|
|---|
| 79 | MediaNode *m_root;
|
|---|
| 80 | };
|
|---|
| 81 |
|
|---|
| 82 | }} // namespace Phonon::QT7
|
|---|
| 83 |
|
|---|
| 84 | QT_END_NAMESPACE
|
|---|
| 85 |
|
|---|
| 86 | #endif // Phonon_QT7_AUDIOGRAPH_H
|
|---|