From 3909a06fe6786027c83e3adaef89c343cde4fbe3 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Sun, 17 May 2026 23:38:18 -0400 Subject: ALSA backend, backend switcher, UX fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/model/alsamodel.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/model/alsamodel.h (limited to 'src/model/alsamodel.h') 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 +#include +#include +#include +#include +#include + +#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 cards() const { return m_cards; } + TQPtrList devices() const { return m_devices; } + TQPtrList 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 m_cards; + TQPtrList m_devices; + TQPtrList m_notifiers; + TQValueList m_mixers; + TQMap m_fdToMixer; +}; -- cgit v1.2.3