1 /* This file is part of the KDE project
2 Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #ifndef PHONON_AUDIODEVICEENUMERATOR_H
21 #define PHONON_AUDIODEVICEENUMERATOR_H
23 #include "audiodevice.h"
24 #include <QtCore/QList>
25 #include <QtCore/QObject>
29 class AudioDeviceEnumeratorPrivate
;
31 /** \class AudioDeviceEnumerator audiodeviceenumerator.h Phonon/AudioDeviceEnumerator
32 * \brief Lists available ALSA devices.
34 * Simple (singleton) class to list the ALSA devices that are available on the system. A typical
35 * use looks like this:
37 * QList<AudioDevice> deviceList = AudioDeviceEnumerator::availableDevices();
38 * foreach (AudioDevice device, deviceList) {
39 * // do something with the device information
44 * \author Matthias Kretz <kretz@kde.org>
46 class KAUDIODEVICELIST_EXPORT AudioDeviceEnumerator
: public QObject
48 friend class AudioDevicePrivate
;
49 friend class AudioDeviceEnumeratorPrivate
;
54 * Returns a pointer to an instance of AudioDeviceEnumerator.
56 static AudioDeviceEnumerator
*self();
59 * Returns a list of the available ALSA playback devices.
63 static QList
<AudioDevice
> availablePlaybackDevices();
66 * Returns a list of the available ALSA capture devices.
70 static QList
<AudioDevice
> availableCaptureDevices();
74 * Emitted when a new device is available.
76 void devicePlugged(const Phonon::AudioDevice
&device
);
78 * Emitted when a device disappeared.
80 void deviceUnplugged(const Phonon::AudioDevice
&device
);
83 AudioDeviceEnumerator(AudioDeviceEnumeratorPrivate
*);
84 ~AudioDeviceEnumerator();
87 AudioDeviceEnumeratorPrivate
*const d
;
88 Q_PRIVATE_SLOT(d
, void _k_deviceAdded(const QString
&))
89 Q_PRIVATE_SLOT(d
, void _k_deviceRemoved(const QString
&))
90 Q_PRIVATE_SLOT(d
, void _k_asoundrcChanged(const QString
&))
93 #endif // PHONON_AUDIODEVICEENUMERATOR_H