diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-05-17 23:38:18 -0400 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-05-17 23:38:18 -0400 |
| commit | 3909a06fe6786027c83e3adaef89c343cde4fbe3 (patch) | |
| tree | f5ea87c98b50764c8ad87e598f274319df0e74db /src/model/alsadevice.h | |
| parent | 311b69c14203860ab6d98bd11633eea287c8f04e (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/alsadevice.h')
| -rw-r--r-- | src/model/alsadevice.h | 67 |
1 files changed, 67 insertions, 0 deletions
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 <tqobject.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <alsa/asoundlib.h> + +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; +}; |
