File indexing completed on 2024-04-14 15:40:19

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "sinkinput.h"
0008 
0009 #include "context.h"
0010 
0011 #include "sink.h"
0012 
0013 namespace QPulseAudio
0014 {
0015 SinkInput::SinkInput(QObject *parent)
0016     : Stream(parent)
0017 {
0018 }
0019 
0020 void SinkInput::update(const pa_sink_input_info *info)
0021 {
0022     updateStream(info);
0023     if (m_deviceIndex != info->sink) {
0024         m_deviceIndex = info->sink;
0025         Q_EMIT deviceIndexChanged();
0026     }
0027 }
0028 
0029 void SinkInput::setDeviceIndex(quint32 deviceIndex)
0030 {
0031     context()->setGenericDeviceForStream(index(), deviceIndex, &pa_context_move_sink_input_by_index);
0032 }
0033 
0034 void SinkInput::setVolume(qint64 volume)
0035 {
0036     context()->setGenericVolume(index(), -1, volume, cvolume(), &pa_context_set_sink_input_volume);
0037 }
0038 
0039 void SinkInput::setMuted(bool muted)
0040 {
0041     context()->setGenericMute(index(), muted, &pa_context_set_sink_input_mute);
0042 }
0043 
0044 void SinkInput::setChannelVolume(int channel, qint64 volume)
0045 {
0046     context()->setGenericVolume(index(), channel, volume, cvolume(), &pa_context_set_sink_input_volume);
0047 }
0048 
0049 void SinkInput::setChannelVolumes(const QVector<qint64> &channelVolumes)
0050 {
0051     context()->setGenericVolumes(index(), channelVolumes, cvolume(), &pa_context_set_sink_input_volume);
0052 }
0053 
0054 } // QPulseAudio