summaryrefslogtreecommitdiff
path: root/src/model/ossmodel.h
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-22 10:16:15 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-22 10:16:15 -0400
commitcdf72828e599a63fca4a0f1ceeb3145fba581aa3 (patch)
tree16ee02f0ce1e317a09fd4c2a3f9fbdc04aadfe60 /src/model/ossmodel.h
parentb30b234afa3ec18156e432b9f2a7ad2ca80cc672 (diff)
parentd9876849f0208291cc7010522e85593703ff52bd (diff)
Merge branch 'and-the-oss-you-rode-in-on'
Diffstat (limited to 'src/model/ossmodel.h')
-rw-r--r--src/model/ossmodel.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/model/ossmodel.h b/src/model/ossmodel.h
new file mode 100644
index 0000000..8c3db8b
--- /dev/null
+++ b/src/model/ossmodel.h
@@ -0,0 +1,50 @@
+#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();
+
+ 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;
+};