blob: 0ab6b154975fbcf642d14314512cde5dc7f3fee0 (
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
52
53
|
#pragma once
#include <tqobject.h>
#include <tqptrlist.h>
#include <tqvaluelist.h>
#include <tqstring.h>
#include "ossdevice.h"
class TQTimer;
struct OssCard {
int index;
TQString path;
TQString name;
};
class OssModel : public TQObject
{
TQ_OBJECT
public:
explicit OssModel( TQObject *parent = 0 );
~OssModel();
bool open();
void close();
TQString lastError() const { return m_lastError; }
TQValueList<OssCard> cards() const { return m_cards; }
TQPtrList<OssDevice> devices() const { return m_devices; }
TQPtrList<OssDevice> devicesForCard( int cardIdx ) const;
OssDevice *defaultOutput() const;
OssDevice *preferredOutput() const;
void setPreferredOutput( int cardIdx, const TQString &name );
signals:
void deviceAdded( OssDevice *dev );
void preferredOutputChanged( OssDevice *dev );
void ready();
private slots:
void onPollTimer();
private:
void openCard( int cardIdx, const TQString &path );
TQValueList<OssCard> m_cards;
TQPtrList<OssDevice> m_devices;
TQValueList<int> m_fds; // one open fd per card, owned here
TQTimer *m_timer;
TQString m_lastError;
};
|