File indexing completed on 2024-05-19 09:29:50

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 "sourceoutput.h"
0008 
0009 #include "context.h"
0010 
0011 namespace QPulseAudio
0012 {
0013 SourceOutput::SourceOutput(QObject *parent)
0014     : Stream(parent)
0015 {
0016 }
0017 
0018 void SourceOutput::update(const pa_source_output_info *info)
0019 {
0020     updateStream(info);
0021     if (m_deviceIndex != info->source) {
0022         m_deviceIndex = info->source;
0023         Q_EMIT deviceIndexChanged();
0024     }
0025 }
0026 
0027 void SourceOutput::setDeviceIndex(quint32 deviceIndex)
0028 {
0029     context()->setGenericDeviceForStream(index(), deviceIndex, &pa_context_move_source_output_by_index);
0030 }
0031 
0032 void SourceOutput::setVolume(qint64 volume)
0033 {
0034     context()->setGenericVolume(index(), -1, volume, cvolume(), &pa_context_set_source_output_volume);
0035 }
0036 
0037 void SourceOutput::setMuted(bool muted)
0038 {
0039     context()->setGenericMute(index(), muted, &pa_context_set_source_output_mute);
0040 }
0041 
0042 void SourceOutput::setChannelVolume(int channel, qint64 volume)
0043 {
0044     context()->setGenericVolume(index(), channel, volume, cvolume(), &pa_context_set_source_output_volume);
0045 }
0046 
0047 void SourceOutput::setChannelVolumes(const QList<qint64> &channelVolumes)
0048 {
0049     context()->setGenericVolumes(index(), channelVolumes, cvolume(), &pa_context_set_source_output_volume);
0050 }
0051 
0052 } // QPulseAudio