PulseAudio Qt Bindings

device.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 PA_DEVICE_H
8 #define PA_DEVICE_H
9 
10 #include <QString>
11 
12 #include "port.h"
13 #include "volumeobject.h"
14 
15 namespace PulseAudioQt
16 {
17 class Port;
18 class DevicePrivate;
19 
20 /**
21  * A PulseAudio device. Can be either a Sink or Source.
22  */
23 class PULSEAUDIOQT_EXPORT Device : public VolumeObject
24 {
25  Q_OBJECT
26  Q_PROPERTY(State state READ state NOTIFY stateChanged)
27  Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
28  Q_PROPERTY(QString formFactor READ formFactor NOTIFY formFactorChanged)
29  Q_PROPERTY(quint32 cardIndex READ cardIndex NOTIFY cardIndexChanged)
30  Q_PROPERTY(QList<Port *> ports READ ports NOTIFY portsChanged)
31  Q_PROPERTY(quint32 activePortIndex READ activePortIndex WRITE setActivePortIndex NOTIFY activePortIndexChanged)
32  Q_PROPERTY(bool default READ isDefault WRITE setDefault NOTIFY defaultChanged)
33 
34 public:
35  enum State {
36  /** This state is used when the server does not support sink/source state introspection. */
37  InvalidState = 0,
38  /** Running, sink/source is playing/recording and used by at least one non-corked sink-input/source-output. */
40  /** When idle, the sink/source is playing/recording but there is no non-corked sink-input/source-output attached to it. */
42  /** When suspended, actual sink/source access can be closed, for instance. */
44  UnknownState,
45  };
46  Q_ENUM(State);
47 
48  ~Device();
49 
50  /**
51  * The state of this device.
52  */
53  State state() const;
54 
55  /**
56  * A human readable description of this device.
57  */
58  QString description() const;
59 
60  /**
61  * The device's form factor.
62  * One of "internal", "speaker", "handset", "tv", "webcam", "microphone", "headset", "headphone", "hands-free", "car", "hifi", "computer", "portable".
63  * This is based on PA_PROP_DEVICE_FORM_FACTOR.
64  */
65  QString formFactor() const;
66 
67  /**
68  * Index of the card that owns this device.
69  */
70  quint32 cardIndex() const;
71 
72  /**
73  * The ports associated with this device.
74  */
75  QList<Port *> ports() const;
76 
77  /**
78  * The currently active port, by index.
79  */
80  quint32 activePortIndex() const;
81 
82  /**
83  * Set the currently active port, by index.
84  */
85  virtual void setActivePortIndex(quint32 port_index) = 0;
86 
87  /**
88  * Whether this is the default device.
89  */
90  virtual bool isDefault() const = 0;
91 
92  /**
93  * Set whether this is the default device.
94  */
95  virtual void setDefault(bool enable) = 0;
96 
97 Q_SIGNALS:
98  void stateChanged();
99  void descriptionChanged();
100  void formFactorChanged();
101  void cardIndexChanged();
102  void portsChanged();
103  void activePortIndexChanged();
104  void defaultChanged();
105 
106 protected:
107  /** @private */
108  explicit Device(QObject *parent);
109  /** @private */
110  DevicePrivate *d;
111 
112 private:
113  friend class SinkPrivate;
114  friend class SourcePrivate;
115 };
116 
117 } // PulseAudioQt
118 
119 #endif // DEVICE_H
@ SuspendedState
When suspended, actual sink/source access can be closed, for instance.
Definition: device.h:43
A PulseAudio device.
Definition: device.h:23
An PulseObject that has a volume.
Definition: volumeobject.h:17
The primary namespace of PulseAudioQt.
Definition: card.cpp:16
@ IdleState
When idle, the sink/source is playing/recording but there is no non-corked sink-input/source-output a...
Definition: device.h:41
@ RunningState
Running, sink/source is playing/recording and used by at least one non-corked sink-input/source-outpu...
Definition: device.h:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:00:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.