File indexing completed on 2024-04-21 04:43:19

0001 /*
0002     Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
0003     Copyright (C) 2013 Harald Sitter <sitter@kde.org>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Lesser General Public
0007     License as published by the Free Software Foundation; either
0008     version 2.1 of the License, or (at your option) version 3, or any
0009     later version accepted by the membership of KDE e.V. (or its
0010     successor approved by the membership of KDE e.V.), Nokia Corporation
0011     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0012     act as a proxy defined in Section 6 of version 3 of the license.
0013 
0014     This library is distributed in the hope that it will be useful,
0015     but WITHOUT ANY WARRANTY; without even the implied warranty of
0016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017     Lesser General Public License for more details.
0018 
0019     You should have received a copy of the GNU Lesser General Public
0020     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #ifndef PHONON_PULSESTREAM_P_H
0024 #define PHONON_PULSESTREAM_P_H
0025 
0026 #include <QObject>
0027 
0028 #include <pulse/pulseaudio.h>
0029 #include <stdint.h>
0030 
0031 #include "phonon_export.h"
0032 #include "phononnamespace.h"
0033 
0034 
0035 namespace Phonon
0036 {
0037     class PHONON_EXPORT PulseStream : public QObject
0038     {
0039         Q_OBJECT
0040         public:
0041             PulseStream(QString streamUuid, QString role);
0042             ~PulseStream() override;
0043 
0044             QString uuid() const;
0045 
0046             uint32_t index() const;
0047             void setIndex(uint32_t index);
0048 
0049             uint8_t channels() const;
0050 
0051             void setDevice(int device);
0052             void setVolume(const pa_cvolume *volume);
0053             void setMute(bool mute);
0054 
0055             qreal cachedVolume() const;
0056             void setCachedVolume(qreal volume);
0057 
0058             QString role() const;
0059 
0060         signals:
0061             void usingDevice(int device);
0062             void volumeChanged(qreal volume);
0063             void muteChanged(bool mute);
0064 
0065     private slots:
0066             void applyCachedVolume();
0067 
0068         private:
0069             QString mStreamUuid;
0070             uint32_t mIndex;
0071             int mDevice;
0072             pa_cvolume mVolume;
0073             bool mMute;
0074             // -1 = not set
0075             qreal mCachedVolume;
0076             QString mRole;
0077     };
0078 } // namespace Phonon
0079 
0080 
0081 #endif // PHONON_PULSESTREAM_P_H