File indexing completed on 2024-09-08 12:45:03
0001 /* 0002 SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef VOLUMEOBJECT_H 0008 #define VOLUMEOBJECT_H 0009 0010 #include "indexedpulseobject.h" 0011 0012 namespace PulseAudioQt 0013 { 0014 /** 0015 * An PulseObject that has a volume. Can be a Device or a Stream. 0016 */ 0017 class PULSEAUDIOQT_EXPORT VolumeObject : public IndexedPulseObject 0018 { 0019 Q_OBJECT 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 volumeWritable READ isVolumeWritable NOTIFY isVolumeWritableChanged) 0023 Q_PROPERTY(QVector<QString> channels READ channels NOTIFY channelsChanged) 0024 Q_PROPERTY(QVector<qint64> channelVolumes READ channelVolumes WRITE setChannelVolumes NOTIFY channelVolumesChanged) 0025 Q_PROPERTY(QStringList rawChannels READ rawChannels NOTIFY rawChannelsChanged) 0026 0027 public: 0028 ~VolumeObject(); 0029 0030 /** 0031 * This object's volume 0032 */ 0033 qint64 volume() const; 0034 0035 /** 0036 * Set the volume for this object. 0037 * This affects all channels. 0038 * The volume must be between PulseAudioQt::minimumVolume() and PulseAudioQt::maximumVolume(). 0039 */ 0040 virtual void setVolume(qint64 volume) = 0; 0041 0042 /** 0043 * Whether this object is muted. 0044 */ 0045 bool isMuted() const; 0046 0047 /** 0048 * Set whether this object is muted. 0049 */ 0050 virtual void setMuted(bool muted) = 0; 0051 0052 bool isVolumeWritable() const; 0053 0054 QVector<QString> channels() const; 0055 QStringList rawChannels() const; 0056 QVector<qint64> channelVolumes() const; 0057 virtual void setChannelVolumes(const QVector<qint64> &channelVolumes) = 0; 0058 Q_INVOKABLE virtual void setChannelVolume(int channel, qint64 volume) = 0; 0059 0060 Q_SIGNALS: 0061 void volumeChanged(); 0062 void mutedChanged(); 0063 void isVolumeWritableChanged(); 0064 void channelsChanged(); 0065 void rawChannelsChanged(); 0066 void channelVolumesChanged(); 0067 0068 protected: 0069 /** @private */ 0070 explicit VolumeObject(QObject *parent); 0071 /** @private */ 0072 class VolumeObjectPrivate *const d; 0073 friend class DevicePrivate; 0074 friend class StreamPrivate; 0075 }; 0076 0077 } // PulseAudioQt 0078 0079 #endif // VOLUMEOBJECT_H