1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2  * (c)LGPL2+
3  *
4  * LXQt - a lightweight, Qt based, desktop toolset
5  * https://lxqt.org
6  *
7  * Copyright: 2012 Razor team
8  * Authors:
9  *   Johannes Zellner <webmaster@nebulon.de>
10  *
11  * This program or library is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20 
21  * You should have received a copy of the GNU Lesser General
22  * Public License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  * Boston, MA 02110-1301 USA
25  *
26  * END_COMMON_COPYRIGHT_HEADER */
27 
28 #ifndef ALSADEVICE_H
29 #define ALSADEVICE_H
30 
31 #include "audiodevice.h"
32 
33 #include <alsa/asoundlib.h>
34 
35 #include <QObject>
36 #include <QString>
37 
38 class AlsaDevice : public AudioDevice
39 {
40     Q_OBJECT
41 
42 public:
43     AlsaDevice(AudioDeviceType t, AudioEngine *engine, QObject *parent = nullptr);
44 
mixer()45     snd_mixer_t *mixer() const { return m_mixer; }
element()46     snd_mixer_elem_t *element() const { return m_elem; }
cardName()47     const QString &cardName() const { return m_cardName; }
volumeMin()48     inline long volumeMin() const { return m_volumeMin; }
volumeMax()49     inline long volumeMax() const { return m_volumeMax; }
50 
51     void setMixer(snd_mixer_t *mixer);
52     void setElement(snd_mixer_elem_t *elem);
53     void setCardName(const QString &cardName);
54     void setVolumeMinMax(long volumeMin, long volumeMax);
55 
56 signals:
57     void mixerChanged();
58     void elementChanged();
59     void cardNameChanged();
60 
61 private:
62     snd_mixer_t *m_mixer;
63     snd_mixer_elem_t *m_elem;
64     QString m_cardName;
65     long m_volumeMin;
66     long m_volumeMax;
67 };
68 
69 #endif // ALSADEVICE_H
70