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

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 "device.h"
0008 
0009 QPulseAudio::Device::State QPulseAudio::Device::state() const
0010 {
0011     return m_state;
0012 }
0013 
0014 QString QPulseAudio::Device::name() const
0015 {
0016     return m_name;
0017 }
0018 
0019 QString QPulseAudio::Device::description() const
0020 {
0021     return m_description;
0022 }
0023 
0024 QString QPulseAudio::Device::formFactor() const
0025 {
0026     return m_formFactor;
0027 }
0028 
0029 quint32 QPulseAudio::Device::cardIndex() const
0030 {
0031     return m_cardIndex;
0032 }
0033 
0034 QList<QObject *> QPulseAudio::Device::ports() const
0035 {
0036     return m_ports;
0037 }
0038 
0039 quint32 QPulseAudio::Device::activePortIndex() const
0040 {
0041     return m_activePortIndex;
0042 }
0043 
0044 bool QPulseAudio::Device::isVirtualDevice() const
0045 {
0046     return m_virtualDevice;
0047 }
0048 
0049 QPulseAudio::Device::Device(QObject *parent)
0050     : VolumeObject(parent)
0051 {
0052 }
0053 
0054 QPulseAudio::Device::State QPulseAudio::Device::stateFromPaState(int value) const
0055 {
0056     switch (value) {
0057     case -1: // PA_X_INVALID_STATE
0058         return InvalidState;
0059     case 0: // PA_X_RUNNING
0060         return RunningState;
0061     case 1: // PA_X_IDLE
0062         return IdleState;
0063     case 2: // PA_X_SUSPENDED
0064         return SuspendedState;
0065     default:
0066         return UnknownState;
0067     }
0068 }