PulseAudio Qt Bindings

volumeobject.cpp
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 #include <pulse/volume.h>
8 
9 #include "volumeobject.h"
10 #include "volumeobject_p.h"
11 
12 namespace PulseAudioQt
13 {
14 VolumeObject::VolumeObject(QObject *parent)
15  : IndexedPulseObject(parent)
16  , d(new VolumeObjectPrivate(this))
17 {
18 }
19 
20 VolumeObjectPrivate::VolumeObjectPrivate(VolumeObject *q)
21  : q(q)
22 {
23  pa_cvolume_init(&m_volume);
24 }
25 
26 VolumeObject::~VolumeObject()
27 {
28 }
29 
30 qint64 VolumeObject::volume() const
31 {
32  return pa_cvolume_max(&d->m_volume);
33 }
34 
36 {
37  return d->m_muted;
38 }
39 
40 pa_cvolume VolumeObjectPrivate::cvolume() const
41 {
42  return m_volume;
43 }
44 
45 bool VolumeObject::isVolumeWritable() const
46 {
47  return d->m_volumeWritable;
48 }
49 
50 QVector<QString> VolumeObject::channels() const
51 {
52  return d->m_channels;
53 }
54 
55 QStringList VolumeObject::rawChannels() const
56 {
57  return d->m_rawChannels;
58 }
59 
60 QVector<qint64> VolumeObject::channelVolumes() const
61 {
62  QVector<qint64> ret;
63  ret.reserve(d->m_volume.channels);
64  for (int i = 0; i < d->m_volume.channels; ++i) {
65  ret << d->m_volume.values[i];
66  }
67  return ret;
68 }
69 
70 } // PulseAudioQt
The primary namespace of PulseAudioQt.
Definition: card.cpp:16
bool isMuted() const
Whether this object is muted.
void reserve(int size)
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.