File indexing completed on 2024-12-01 13:02:22

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 qint64 Device::baseVolume() const
0043 {
0044     return d->m_baseVolume;
0045 }
0046 
0047 QVariantMap Device::pulseProperties() const
0048 {
0049     return d->m_pulseProperties;
0050 }
0051 
0052 Device::Device(QObject *parent)
0053     : VolumeObject(parent)
0054     , d(new DevicePrivate(this))
0055 {
0056 }
0057 
0058 DevicePrivate::DevicePrivate(Device *q)
0059     : q(q)
0060 {
0061 }
0062 
0063 Device::State DevicePrivate::stateFromPaState(int value) const
0064 {
0065     switch (value) {
0066     case -1: // PA_X_INVALID_STATE
0067         return Device::InvalidState;
0068     case 0: // PA_X_RUNNING
0069         return Device::RunningState;
0070     case 1: // PA_X_IDLE
0071         return Device::IdleState;
0072     case 2: // PA_X_SUSPENDED
0073         return Device::SuspendedState;
0074     default:
0075         return Device::UnknownState;
0076     }
0077 }
0078 
0079 Device::~Device()
0080 {
0081     delete d;
0082 }
0083 
0084 } // namespace PulseAudioQt