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/alsadevice.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/model/alsadevice.h (limited to 'src/model/alsadevice.h') diff --git a/src/model/alsadevice.h b/src/model/alsadevice.h new file mode 100644 index 0000000..cc26801 --- /dev/null +++ b/src/model/alsadevice.h @@ -0,0 +1,67 @@ +#pragma once + +#include +#include +#include +#include + +class AlsaDevice : public TQObject +{ + TQ_OBJECT +public: + enum Category { Output, Input, Neutral }; + enum Type { Slider, Switch, Enum }; + + AlsaDevice( Category cat, int cardIndex, snd_mixer_elem_t *elem, + const TQString &cardName, TQObject *parent = 0 ); + + TQString name() const { return m_name; } + TQString cardName() const { return m_cardName; } + int cardIndex() const { return m_cardIndex; } + Category category() const { return m_category; } + Type type() const { return m_type; } + + // Slider + 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 m_hasMute; } + void setVolume( int v ); + void setMuted( bool m ); + void setPan( int p ); + + // Enum + TQStringList enumValues() const { return m_enumValues; } + int enumId() const { return m_enumId; } + void setEnumId( int id ); + + void syncFromAlsa(); + static int elemCallback( snd_mixer_elem_t *elem, unsigned int mask ); + +signals: + void volumeChanged( int v ); + void muteChanged( bool m ); + void panChanged( int p ); + void enumChanged( int id ); + +private: + long toAlsaVol( int pct ) const; + void pushVolume(); + + Category m_category; + Type m_type; + int m_cardIndex; + snd_mixer_elem_t *m_elem; + TQString m_name; + TQString m_cardName; + bool m_stereo; + bool m_hasMute; + long m_volMin; + long m_volMax; + int m_volume; + bool m_muted; + int m_pan; + TQStringList m_enumValues; + int m_enumId; +}; -- cgit v1.2.3