summaryrefslogtreecommitdiff
path: root/src/model/ossdevice.h
blob: 66a0d1b25e596601f61969998360e4aa20d91b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <tqobject.h>
#include <tqstring.h>

class OssDevice : public TQObject
{
    TQ_OBJECT
public:
    enum Category { Output, Input };

    OssDevice( Category cat, int cardIdx, const TQString &cardPath,
               int fd, int channelIdx, const TQString &name, bool stereo,
               TQObject *parent = 0 );

    TQString  name()      const { return m_name; }
    TQString  cardPath()  const { return m_cardPath; }
    int      cardIndex() const { return m_cardIdx; }
    Category category()  const { return m_category; }
    int      volume()    const { return m_volume; }
    bool     muted()     const { return m_muted; }
    int      pan()       const { return m_pan; }
    bool     stereo()    const { return m_stereo; }
    bool     hasMute()   const { return true; }

    void setVolume( int v );
    void setMuted( bool m );
    void setPan( int p );

    void syncFromOss();

signals:
    void volumeChanged( int v );
    void muteChanged( bool m );
    void panChanged( int p );

private:
    void pushVolume();

    int      m_fd;       // borrowed from OssModel — do not close
    int      m_cardIdx;
    TQString  m_cardPath;
    int      m_channelIdx;
    TQString  m_name;
    Category m_category;
    bool     m_stereo;
    int      m_volume;
    int      m_savedVol; // pre-mute volume for fake-mute
    bool     m_muted;
    int      m_pan;
};