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>
29 class AudioDeviceAccess
42 inline AudioDeviceAccess(const QStringList
&deviceIds
, int accessPreference
,
43 AudioDriver driver
, bool capture
, bool playback
)
44 : m_deviceIds(deviceIds
),
45 m_accessPreference(accessPreference
),
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
); }
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
; }
77 friend QDebug
operator<<(QDebug
&, const AudioDeviceAccess
&);
79 // the udi is needed to identify a removed device
82 QStringList m_deviceIds
;
83 int m_accessPreference
;
84 AudioDriver m_driver
: 16;
89 QDebug
operator<<(QDebug
&s
, const AudioDeviceAccess
&a
);
93 #endif // AUDIODEVICEACCESS_H