summaryrefslogtreecommitdiff
path: root/src/model/pulsemodel.h
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-15 19:22:41 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-15 19:22:41 -0400
commitf8fa47123887452f48d0b523289ca6990c8a2e25 (patch)
tree1564e6d2d2d53a8c9e9f7c4aface696ea137c480 /src/model/pulsemodel.h
parent4a8a83f223bbc2b9d18ef91423c1ee807b297b35 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'src/model/pulsemodel.h')
-rw-r--r--src/model/pulsemodel.h28
1 files changed, 28 insertions, 0 deletions
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<PulseDevicePort> ports;
+ };
+ TQValueList<DevicePortInfo> sinksForCard( uint32_t cardIndex ) const;
+ TQValueList<DevicePortInfo> 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<PulseCardInfo> m_cards;
+ TQMap<uint32_t, uint32_t> m_sinkCard;
+ TQMap<uint32_t, TQString> m_sinkActivePort;
+ TQMap<uint32_t, TQValueList<PulseDevicePort>> m_sinkPorts;
+ TQMap<uint32_t, uint32_t> m_sourceCard;
+ TQMap<uint32_t, TQString> m_sourceActivePort;
+ TQMap<uint32_t, TQValueList<PulseDevicePort>> m_sourcePorts;
+
PulseDevice *findDevice( TQPtrList<PulseDevice> &list, uint32_t paIndex );
PulseCardInfo *findCard( uint32_t index );
};