File indexing completed on 2024-10-06 04:20:26

0001 /*
0002     SPDX-FileCopyrightText: 2016 David Rosca <nowrep@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef STREAMRESTORE_H
0008 #define STREAMRESTORE_H
0009 
0010 #include "pulseobject.h"
0011 
0012 struct pa_ext_stream_restore_info;
0013 
0014 namespace PulseAudioQt
0015 {
0016 class PULSEAUDIOQT_EXPORT StreamRestore : public PulseObject
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(QString device READ device WRITE setDevice NOTIFY deviceChanged)
0020     Q_PROPERTY(qint64 volume READ volume WRITE setVolume NOTIFY volumeChanged)
0021     Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
0022     Q_PROPERTY(bool hasVolume READ hasVolume CONSTANT)
0023     Q_PROPERTY(bool volumeWritable READ isVolumeWritable CONSTANT)
0024     Q_PROPERTY(QVector<QString> channels READ channels NOTIFY channelsChanged)
0025     Q_PROPERTY(QVector<qreal> channelVolumes READ channelVolumes NOTIFY channelVolumesChanged)
0026     Q_PROPERTY(quint32 deviceIndex READ deviceIndex WRITE setDeviceIndex NOTIFY deviceIndexChanged)
0027     // Not a IndexedPulseObject since pa_ext_stream_restore_info does not have an index member
0028     Q_PROPERTY(quint32 index READ index CONSTANT)
0029 
0030 public:
0031     ~StreamRestore();
0032 
0033     QString device() const;
0034     void setDevice(const QString &device);
0035 
0036     qint64 volume() const;
0037     void setVolume(qint64 volume);
0038 
0039     bool isMuted() const;
0040     void setMuted(bool muted);
0041 
0042     bool hasVolume() const;
0043     bool isVolumeWritable() const;
0044 
0045     QVector<QString> channels() const;
0046 
0047     QVector<qreal> channelVolumes() const;
0048 
0049     quint32 index() const;
0050 
0051     quint32 deviceIndex() const;
0052     void setDeviceIndex(quint32 deviceIndex);
0053 
0054     void setChannelVolume(int channel, qint64 volume);
0055 
0056 Q_SIGNALS:
0057     void deviceChanged();
0058     void volumeChanged();
0059     void mutedChanged();
0060     void channelsChanged();
0061     void channelVolumesChanged();
0062     void deviceIndexChanged();
0063 
0064 private:
0065     explicit StreamRestore(quint32 index, const QVariantMap &properties, QObject *parent);
0066 
0067     class StreamRestorePrivate *const d;
0068     friend class MapBase<StreamRestore, pa_ext_stream_restore_info>;
0069     friend class ContextPrivate;
0070 };
0071 
0072 } // PulseAudioQt
0073 
0074 #endif // STREAMRESTORE_H