add more spacing
[personal-kdebase.git] / runtime / phonon / libkaudiodevicelist / audiodeviceenumerator.h
blob65ef388d23b5ad47ce357928f580b74caea49854
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>
27 namespace Phonon
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:
36 * \code
37 * QList<AudioDevice> deviceList = AudioDeviceEnumerator::availableDevices();
38 * foreach (AudioDevice device, deviceList) {
39 * // do something with the device information
40 * }
41 * \endcode
43 * \ingroup Backend
44 * \author Matthias Kretz <kretz@kde.org>
46 class KAUDIODEVICELIST_EXPORT AudioDeviceEnumerator : public QObject
48 friend class AudioDevicePrivate;
49 friend class AudioDeviceEnumeratorPrivate;
51 Q_OBJECT
52 public:
53 /**
54 * Returns a pointer to an instance of AudioDeviceEnumerator.
56 static AudioDeviceEnumerator *self();
58 /**
59 * Returns a list of the available ALSA playback devices.
61 * \see AudioDevice
63 static QList<AudioDevice> availablePlaybackDevices();
65 /**
66 * Returns a list of the available ALSA capture devices.
68 * \see AudioDevice
70 static QList<AudioDevice> availableCaptureDevices();
72 Q_SIGNALS:
73 /**
74 * Emitted when a new device is available.
76 void devicePlugged(const Phonon::AudioDevice &device);
77 /**
78 * Emitted when a device disappeared.
80 void deviceUnplugged(const Phonon::AudioDevice &device);
82 protected:
83 AudioDeviceEnumerator(AudioDeviceEnumeratorPrivate *);
84 ~AudioDeviceEnumerator();
86 private:
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 &))
92 } // namespace Phonon
93 #endif // PHONON_AUDIODEVICEENUMERATOR_H