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 19 #ifndef PHONON_MMF_AUDIOOUTPUT_H 20 #define PHONON_MMF_AUDIOOUTPUT_H 21 22 #include <QHash> 23 24 #include "mmf_medianode.h" 25 #include <phonon/audiooutputinterface.h> 26 27 QT_BEGIN_NAMESPACE 28 29 namespace Phonon 30 { 31 namespace MMF 32 { 33 class Backend; 34 35 /** 36 * @short AudioOutputInterface implementation for MMF. 37 * 38 * Forwards volume commands to the MediaObject instance, 39 * which is provided by the backend when MediaNode objects are 40 * connected. 41 * 42 * \section volume Volume 43 * 44 * Phonon's concept on volume is from 0.0 to 1.0, and from 1< it does 45 * voltage multiplication. CDrmPlayerUtility goes from 1 to 46 * CDrmPlayerUtility::MaxVolume(). We apply some basic math to convert 47 * between the two. 48 * 49 * @author Frans Englich<frans.englich@nokia.com> 50 */ 51 class AudioOutput : public MediaNode 52 , public AudioOutputInterface 53 { 54 Q_OBJECT 55 Q_INTERFACES(Phonon::AudioOutputInterface) 56 57 public: 58 AudioOutput(Backend *backend, QObject *parent); 59 virtual qreal volume() const; 60 virtual void setVolume(qreal volume); 61 62 virtual int outputDevice() const; 63 64 /** 65 * Has no effect. 66 */ 67 virtual bool setOutputDevice(int); 68 69 static QHash<QByteArray, QVariant> audioOutputDescription(int index); 70 71 enum Constants 72 { 73 AudioOutputDeviceID = 0 74 }; 75 76 protected: 77 // MediaNode 78 void connectMediaObject(MediaObject *mediaObject); 79 void disconnectMediaObject(MediaObject *mediaObject); 80 81 Q_SIGNALS: 82 void volumeChanged(qreal volume); 83 void audioDeviceFailed(); 84 85 private: 86 qreal m_volume; 87 88 }; 89 } 90 } 91 92 QT_END_NAMESPACE 93 94 #endif 95