PulseAudio Qt Bindings

volumeobject.cpp
1/*
2 SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
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
12namespace PulseAudioQt
13{
14VolumeObject::VolumeObject(QObject *parent)
15 : IndexedPulseObject(parent)
16 , d(new VolumeObjectPrivate(this))
17{
18}
19
20VolumeObjectPrivate::VolumeObjectPrivate(VolumeObject *q)
21 : q(q)
22{
23 pa_cvolume_init(&m_volume);
24}
25
26VolumeObject::~VolumeObject()
27{
28 delete d;
29}
30
31qint64 VolumeObject::volume() const
32{
33 return pa_cvolume_max(&d->m_volume);
34}
35
36bool VolumeObject::isMuted() const
37{
38 return d->m_muted;
39}
40
41pa_cvolume VolumeObjectPrivate::cvolume() const
42{
43 return m_volume;
44}
45
46bool VolumeObject::isVolumeWritable() const
47{
48 return d->m_volumeWritable;
49}
50
51QList<QString> VolumeObject::channels() const
52{
53 return d->m_channels;
54}
55
56QStringList VolumeObject::rawChannels() const
57{
58 return d->m_rawChannels;
59}
60
61QList<qint64> VolumeObject::channelVolumes() const
62{
63 QList<qint64> ret;
64 ret.reserve(d->m_volume.channels);
65 for (int i = 0; i < d->m_volume.channels; ++i) {
66 ret << d->m_volume.values[i];
67 }
68 return ret;
69}
70
71} // PulseAudioQt
The primary namespace of PulseAudioQt.
Definition card.cpp:17
void reserve(qsizetype size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:54:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.