File indexing completed on 2023-12-10 11:57:37

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