From f8fa47123887452f48d0b523289ca6990c8a2e25 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Fri, 15 May 2026 19:22:41 -0400 Subject: Devices tab: per-sink/source port switching Add Output port / Input port dropdowns in the Devices tab for any sink or source that has 2+ ports. Selecting a port calls pa_context_set_sink/source_port_by_index live. Active port selection updates in-place when PA reports a port change externally. Co-Authored-By: Claude Sonnet 4.6 --- src/model/pulsemodel.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/model/pulsemodel.h') diff --git a/src/model/pulsemodel.h b/src/model/pulsemodel.h index c1d4561..d0e93b4 100644 --- a/src/model/pulsemodel.h +++ b/src/model/pulsemodel.h @@ -11,6 +11,13 @@ class PulseDevice; +// ---- shared port struct ----------------------------------------------------- + +struct PulseDevicePort { + TQString name; + TQString description; +}; + // ---- card data structures --------------------------------------------------- struct PulseCardProfile { @@ -66,6 +73,17 @@ public: const PulseCardInfo *card( uint32_t index ) const; void setCardProfile( uint32_t cardIndex, const TQString &profileName ); + struct DevicePortInfo { + uint32_t paIndex; + TQString description; + TQString activePort; + TQValueList ports; + }; + TQValueList sinksForCard( uint32_t cardIndex ) const; + TQValueList sourcesForCard( uint32_t cardIndex ) const; + void setSinkPort( uint32_t sinkPaIndex, const TQString &portName ); + void setSourcePort( uint32_t sourcePaIndex, const TQString &portName ); + protected: void customEvent( TQCustomEvent *e ); @@ -80,6 +98,9 @@ signals: void cardRemoved( uint32_t index ); void cardUpdated( uint32_t index ); + void sinkUpdated( uint32_t paIndex ); + void sourceUpdated( uint32_t paIndex ); + private slots: void reconnect(); @@ -116,6 +137,13 @@ private: TQValueList m_cards; + TQMap m_sinkCard; + TQMap m_sinkActivePort; + TQMap> m_sinkPorts; + TQMap m_sourceCard; + TQMap m_sourceActivePort; + TQMap> m_sourcePorts; + PulseDevice *findDevice( TQPtrList &list, uint32_t paIndex ); PulseCardInfo *findCard( uint32_t index ); }; -- cgit v1.2.3