| 1 | /* |
| 2 | Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org> |
| 3 | Copyright (C) 2013 Harald Sitter <sitter@kde.org> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) version 3, or any |
| 9 | later version accepted by the membership of KDE e.V. (or its |
| 10 | successor approved by the membership of KDE e.V.), Nokia Corporation |
| 11 | (or its successors, if any) and the KDE Free Qt Foundation, which shall |
| 12 | act as a proxy defined in Section 6 of version 3 of the license. |
| 13 | |
| 14 | This library is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | Lesser General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU Lesser General Public |
| 20 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | #ifndef PHONON_PULSESTREAM_P_H |
| 24 | #define PHONON_PULSESTREAM_P_H |
| 25 | |
| 26 | #include <QObject> |
| 27 | |
| 28 | #include <pulse/pulseaudio.h> |
| 29 | #include <stdint.h> |
| 30 | |
| 31 | #include "phonon_export.h" |
| 32 | #include "phononnamespace.h" |
| 33 | |
| 34 | |
| 35 | namespace Phonon |
| 36 | { |
| 37 | class PHONON_EXPORT PulseStream : public QObject |
| 38 | { |
| 39 | Q_OBJECT |
| 40 | public: |
| 41 | PulseStream(QString streamUuid, QString role); |
| 42 | ~PulseStream() override; |
| 43 | |
| 44 | QString uuid() const; |
| 45 | |
| 46 | uint32_t index() const; |
| 47 | void setIndex(uint32_t index); |
| 48 | |
| 49 | uint8_t channels() const; |
| 50 | |
| 51 | void setDevice(int device); |
| 52 | void setVolume(const pa_cvolume *volume); |
| 53 | void setMute(bool mute); |
| 54 | |
| 55 | qreal cachedVolume() const; |
| 56 | void setCachedVolume(qreal volume); |
| 57 | |
| 58 | QString role() const; |
| 59 | |
| 60 | signals: |
| 61 | void usingDevice(int device); |
| 62 | void volumeChanged(qreal volume); |
| 63 | void muteChanged(bool mute); |
| 64 | |
| 65 | private slots: |
| 66 | void applyCachedVolume(); |
| 67 | |
| 68 | private: |
| 69 | QString mStreamUuid; |
| 70 | uint32_t mIndex; |
| 71 | int mDevice; |
| 72 | pa_cvolume mVolume; |
| 73 | bool mMute; |
| 74 | // -1 = not set |
| 75 | qreal mCachedVolume; |
| 76 | QString mRole; |
| 77 | }; |
| 78 | } // namespace Phonon |
| 79 | |
| 80 | |
| 81 | #endif // PHONON_PULSESTREAM_P_H |
| 82 | |