PulseAudio Qt Bindings

sinkinput.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 "sinkinput.h"
8 #include "sinkinput_p.h"
9 
10 #include "context.h"
11 #include "context_p.h"
12 #include "stream_p.h"
13 
14 namespace PulseAudioQt
15 {
16 SinkInput::SinkInput(QObject *parent)
17  : Stream(parent)
18  , d(new SinkInputPrivate(this))
19 {
20 }
21 
22 SinkInputPrivate::SinkInputPrivate(SinkInput *q)
23  : q(q)
24 {
25 }
26 
27 SinkInput::~SinkInput()
28 {
29  delete d;
30 }
31 
32 void SinkInputPrivate::update(const pa_sink_input_info *info)
33 {
34  q->Stream::d->updateStream(info);
35  if (q->Stream::d->m_deviceIndex != info->sink) {
36  q->Stream::d->m_deviceIndex = info->sink;
37  Q_EMIT q->deviceIndexChanged();
38  }
39 }
40 
41 void SinkInput::setDeviceIndex(quint32 deviceIndex)
42 {
43  Context::instance()->d->setGenericDeviceForStream(index(), deviceIndex, &pa_context_move_sink_input_by_index);
44 }
45 
46 void SinkInput::setVolume(qint64 volume)
47 {
48  Context::instance()->d->setGenericVolume(index(), -1, volume, VolumeObject::d->cvolume(), &pa_context_set_sink_input_volume);
49 }
50 
51 void SinkInput::setMuted(bool muted)
52 {
53  Context::instance()->d->setGenericMute(index(), muted, &pa_context_set_sink_input_mute);
54 }
55 
56 void SinkInput::setChannelVolume(int channel, qint64 volume)
57 {
58  Context::instance()->d->setGenericVolume(index(), channel, volume, VolumeObject::d->cvolume(), &pa_context_set_sink_input_volume);
59 }
60 
61 void SinkInput::setChannelVolumes(const QVector<qint64> &channelVolumes)
62 {
63  Context::instance()->d->setGenericVolumes(index(), channelVolumes, VolumeObject::d->m_volume, &pa_context_set_sink_input_volume);
64 }
65 
66 } // PulseAudioQt
void setVolume(qint64 volume) override
Set the volume for this object.
Definition: sinkinput.cpp:46
void setMuted(bool muted) override
Set whether this object is muted.
Definition: sinkinput.cpp:51
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.