summaryrefslogtreecommitdiff
path: root/src/model/alsamodel.h
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-17 23:38:18 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-17 23:38:18 -0400
commit3909a06fe6786027c83e3adaef89c343cde4fbe3 (patch)
treef5ea87c98b50764c8ad87e598f274319df0e74db /src/model/alsamodel.h
parent311b69c14203860ab6d98bd11633eea287c8f04e (diff)
ALSA backend, backend switcher, UX fixesalsa-wip
- ALSA backend: AlsaModel, AlsaDevice, AlsaMixerWindow, AlsaTray, AlsaPopup - BackendController: live pulse↔alsa switching, preserves window position/visibility - PA shutdown fix: stop mainloop thread before disconnect/free to prevent crash - Exit crash fix: BackendController deleted explicitly before TQApplication exits - Waiting-for-PulseAudio placeholder when PA not connected - Preferences: live backend stack (Pulse/ALSA), Startup/Exit card with autostart, Recording card, no-tabs greying, remove stale "requires restart" label - Recording tray: track source outputs directly; fix LED init in popup; level meter forwarding for monitor-source recordings via m_monitorSourceToSink - TmixTray: fix config group General→Tray for scroll/mute/popup settings; RecordingTray suppresses right-click menu - audiodevice.h: add recordingActive() virtual accessor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/model/alsamodel.h')
-rw-r--r--src/model/alsamodel.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/model/alsamodel.h b/src/model/alsamodel.h
new file mode 100644
index 0000000..fc8a0f0
--- /dev/null
+++ b/src/model/alsamodel.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <tqobject.h>
+#include <tqptrlist.h>
+#include <tqvaluelist.h>
+#include <tqmap.h>
+#include <tqstring.h>
+#include <alsa/asoundlib.h>
+
+#include "alsadevice.h"
+
+class TQSocketNotifier;
+
+struct AlsaCard {
+ int index;
+ TQString name;
+};
+
+class AlsaModel : public TQObject
+{
+ TQ_OBJECT
+public:
+ explicit AlsaModel( TQObject *parent = 0 );
+ ~AlsaModel();
+
+ bool open();
+ void close();
+
+ TQValueList<AlsaCard> cards() const { return m_cards; }
+ TQPtrList<AlsaDevice> devices() const { return m_devices; }
+ TQPtrList<AlsaDevice> devicesForCard( int cardIndex ) const;
+ AlsaDevice *defaultOutput() const;
+ AlsaDevice *preferredOutput() const;
+ void setPreferredOutput( int cardIndex, const TQString &name );
+
+signals:
+ void deviceAdded( AlsaDevice *dev );
+ void preferredOutputChanged( AlsaDevice *dev );
+ void ready();
+
+private slots:
+ void onMixerFd( int fd );
+
+private:
+ void openCard( int card );
+ void addElement( int card, const TQString &cardName,
+ snd_mixer_elem_t *elem, AlsaDevice::Category cat );
+
+ TQValueList<AlsaCard> m_cards;
+ TQPtrList<AlsaDevice> m_devices;
+ TQPtrList<TQSocketNotifier> m_notifiers;
+ TQValueList<snd_mixer_t*> m_mixers;
+ TQMap<int, snd_mixer_t*> m_fdToMixer;
+};