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}
29
30qint64 VolumeObject::volume() const
31{
32 return pa_cvolume_max(&d->m_volume);
33}
34
35bool VolumeObject::isMuted() const
36{
37 return d->m_muted;
38}
39
40pa_cvolume VolumeObjectPrivate::cvolume() const
41{
42 return m_volume;
43}
44
45bool VolumeObject::isVolumeWritable() const
46{
47 return d->m_volumeWritable;
48}
49
50QStringList VolumeObject::channels() const
51{
52 return d->m_channels;
53}
54
55QStringList VolumeObject::rawChannels() const
56{
57 return d->m_rawChannels;
58}
59
60QList<qint64> VolumeObject::channelVolumes() const
61{
62 QList<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:17
void reserve(qsizetype size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:50:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.