PulseAudio Qt Bindings

volumeobject.h
1 /*
2  SPDX-FileCopyrightText: 2014-2015 Harald Sitter <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef VOLUMEOBJECT_H
8 #define VOLUMEOBJECT_H
9 
10 #include "indexedpulseobject.h"
11 
12 namespace PulseAudioQt
13 {
14 /**
15  * An PulseObject that has a volume. Can be a Device or a Stream.
16  */
17 class PULSEAUDIOQT_EXPORT VolumeObject : public IndexedPulseObject
18 {
19  Q_OBJECT
20  Q_PROPERTY(qint64 volume READ volume WRITE setVolume NOTIFY volumeChanged)
21  Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
22  Q_PROPERTY(bool volumeWritable READ isVolumeWritable NOTIFY isVolumeWritableChanged)
23  Q_PROPERTY(QVector<QString> channels READ channels NOTIFY channelsChanged)
24  Q_PROPERTY(QVector<qint64> channelVolumes READ channelVolumes WRITE setChannelVolumes NOTIFY channelVolumesChanged)
25  Q_PROPERTY(QStringList rawChannels READ rawChannels NOTIFY rawChannelsChanged)
26 
27 public:
28  ~VolumeObject();
29 
30  /**
31  * This object's volume
32  */
33  qint64 volume() const;
34 
35  /**
36  * Set the volume for this object.
37  * This affects all channels.
38  * The volume must be between PulseAudioQt::minimumVolume() and PulseAudioQt::maximumVolume().
39  */
40  virtual void setVolume(qint64 volume) = 0;
41 
42  /**
43  * Whether this object is muted.
44  */
45  bool isMuted() const;
46 
47  /**
48  * Set whether this object is muted.
49  */
50  virtual void setMuted(bool muted) = 0;
51 
52  bool isVolumeWritable() const;
53 
54  QVector<QString> channels() const;
55  QStringList rawChannels() const;
56  QVector<qint64> channelVolumes() const;
57  virtual void setChannelVolumes(const QVector<qint64> &channelVolumes) = 0;
58  Q_INVOKABLE virtual void setChannelVolume(int channel, qint64 volume) = 0;
59 
60 Q_SIGNALS:
61  void volumeChanged();
62  void mutedChanged();
63  void isVolumeWritableChanged();
64  void channelsChanged();
65  void rawChannelsChanged();
66  void channelVolumesChanged();
67 
68 protected:
69  /** @private */
70  explicit VolumeObject(QObject *parent);
71  /** @private */
72  class VolumeObjectPrivate *const d;
73  friend class DevicePrivate;
74  friend class StreamPrivate;
75 };
76 
77 } // PulseAudioQt
78 
79 #endif // VOLUMEOBJECT_H
An PulseObject that has a volume.
Definition: volumeobject.h:17
The primary namespace of PulseAudioQt.
Definition: card.cpp:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:12:40 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.