add more spacing
[personal-kdebase.git] / runtime / phonon / kded-module / audiodeviceaccess.h
blob4513419f502837785b81b15b3fd22c4f76cdbf6c
1 /* This file is part of the KDE project
2 Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) version 3.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #ifndef AUDIODEVICEACCESS_H
22 #define AUDIODEVICEACCESS_H
24 #include <QtCore/QDebug>
25 #include <QtCore/QStringList>
27 namespace PS
29 class AudioDeviceAccess
31 public:
32 enum AudioDriver {
33 InvalidDriver = 0,
34 AlsaDriver,
35 OssDriver,
36 PulseAudioDriver,
37 JackdDriver,
38 EsdDriver,
39 ArtsDriver
42 inline AudioDeviceAccess(const QStringList &deviceIds, int accessPreference,
43 AudioDriver driver, bool capture, bool playback)
44 : m_deviceIds(deviceIds),
45 m_accessPreference(accessPreference),
46 m_driver(driver),
47 m_capture(capture),
48 m_playback(playback)
52 inline bool operator<(const AudioDeviceAccess &rhs) const {
53 return m_accessPreference > rhs.m_accessPreference; }
54 inline bool operator==(const AudioDeviceAccess &rhs) const {
55 return m_deviceIds == rhs.m_deviceIds && m_capture == rhs.m_capture
56 && m_playback == rhs.m_playback; }
57 inline bool operator!=(const AudioDeviceAccess &rhs) const { return !operator==(rhs); }
59 /**
60 * UDI to identify which device was removed
62 inline const QString &udi() const { return m_udi; }
64 AudioDriver driver() const { return m_driver; }
66 const QString driverName() const;
68 inline const QStringList &deviceIds() const { return m_deviceIds; }
70 inline int accessPreference() const { return m_accessPreference; }
72 inline bool isCapture() const { return m_capture; }
74 inline bool isPlayback() const { return m_playback; }
76 private:
77 friend QDebug operator<<(QDebug &, const AudioDeviceAccess &);
79 // the udi is needed to identify a removed device
80 QString m_udi;
82 QStringList m_deviceIds;
83 int m_accessPreference;
84 AudioDriver m_driver : 16;
85 bool m_capture : 8;
86 bool m_playback : 8;
89 QDebug operator<<(QDebug &s, const AudioDeviceAccess &a);
91 } // namespace PS
93 #endif // AUDIODEVICEACCESS_H