~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/backends/mixer_alsa.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-*-C++-*-
 
2
/*
 
3
 * KMix -- KDE's full featured mini mixer
 
4
 *
 
5
 * Copyright Christian Esken <esken@kde.org>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Library General Public
 
9
 * License as published by the Free Software Foundation; either
 
10
 * version 2 of the License, or (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Library General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Library General Public
 
18
 * License along with this program; if not, write to the Free
 
19
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
20
 */
 
21
#ifndef MIXER_ALSA_H
 
22
#define MIXER_ALSA_H
 
23
 
 
24
// QT includes
 
25
#include <QList>
 
26
#include <QHash>
 
27
 
 
28
// Forward QT includes
 
29
class QString;
 
30
class QSocketNotifier;
 
31
 
 
32
#include "mixer_backend.h"
 
33
 
 
34
extern "C"
 
35
{
 
36
   #include <alsa/asoundlib.h>
 
37
}
 
38
 
 
39
class Mixer_ALSA : public Mixer_Backend
 
40
{
 
41
public:
 
42
    explicit Mixer_ALSA(Mixer *mixer, int device = -1 );
 
43
    ~Mixer_ALSA();
 
44
 
 
45
    virtual int  readVolumeFromHW( const QString& id, MixDevice *md );
 
46
    virtual int  writeVolumeToHW ( const QString& id, MixDevice *md );
 
47
    virtual void setRecsrcHW( const QString& id, bool on);
 
48
    virtual bool isRecsrcHW( const QString& id );
 
49
    virtual void setEnumIdHW( const QString& id, unsigned int);
 
50
    virtual unsigned int enumIdHW(const QString& id);
 
51
    virtual bool prepareUpdateFromHW();
 
52
 
 
53
    virtual bool needsPolling() { return false; }
 
54
    virtual QString getDriverName();
 
55
 
 
56
protected:
 
57
    virtual int open();
 
58
    virtual int close();
 
59
    int id2num(const QString& id);
 
60
 
 
61
private:
 
62
 
 
63
    int openAlsaDevice(const QString& devName);
 
64
    void addEnumerated(snd_mixer_elem_t *elem, QList<QString*>&);
 
65
    Volume* addVolume(snd_mixer_elem_t *elem, bool capture);
 
66
    int setupAlsaPolling();
 
67
    void deinitAlsaPolling();
 
68
 
 
69
    int identify( snd_mixer_selem_id_t *sid );
 
70
    snd_mixer_elem_t* getMixerElem(int devnum);
 
71
 
 
72
    virtual QString errorText(int mixer_error);
 
73
    typedef QList<snd_mixer_selem_id_t *>AlsaMixerSidList;
 
74
    AlsaMixerSidList mixer_sid_list;
 
75
    typedef QList<snd_mixer_elem_t *> AlsaMixerElemList;
 
76
    AlsaMixerElemList mixer_elem_list;
 
77
    typedef QHash<QString,int> Id2numHash;
 
78
    Id2numHash m_id2numHash;
 
79
 
 
80
    bool _initialUpdate;
 
81
    snd_mixer_t *_handle;
 
82
    QString devName;
 
83
    struct pollfd  *m_fds;
 
84
    QSocketNotifier **m_sns;
 
85
    int m_count;
 
86
};
 
87
 
 
88
#endif