summaryrefslogtreecommitdiff
path: root/src/model/pulsedevice.h
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-12 21:32:53 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-12 21:32:53 -0400
commitf6f7c36909fa161efe53c40e9b4c34856e751536 (patch)
treeeff44527b0be61eb2e19c9f483ed38b72879af11 /src/model/pulsedevice.h
Initial tmix skeleton — model layer + basic UI
PulseModel: stable PulseDevice objects keyed by PA index, updated in-place via postEvent reconciliation. No bulk rebuilds. Three signals: deviceAdded, deviceRemoved (device changed handled per-device via volumeChanged/muteChanged/nameChanged). MixerWindow: four-tab layout (Output/Input/Playback/Recording), adds and removes individual DeviceWidgets in response to model signals. Builds and links cleanly against TQt3/TDE + libpulse. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/model/pulsedevice.h')
-rw-r--r--src/model/pulsedevice.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/model/pulsedevice.h b/src/model/pulsedevice.h
new file mode 100644
index 0000000..fbdf985
--- /dev/null
+++ b/src/model/pulsedevice.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <pulse/pulseaudio.h>
+#include "audiodevice.h"
+
+class PulseDevice : public AudioDevice
+{
+ TQ_OBJECT
+
+public:
+ PulseDevice( AudioDevice::Category cat, uint32_t paIndex, TQObject *parent = 0 );
+ ~PulseDevice() {}
+
+ TQString name() const { return m_name; }
+ Category category() const { return m_category; }
+ int volume() const { return m_volume; }
+ bool muted() const { return m_muted; }
+ uint32_t paIndex() const { return m_paIndex; }
+
+ void setVolume( int v );
+ void setMuted( bool m );
+
+ // Called by PulseModel when PA reports an update — updates in place and emits signals.
+ void update( const TQString &name, int volume, bool muted );
+
+ TQWidget *createWidget( TQWidget *parent );
+
+ // PA context needed to write volume back — set once by PulseModel after construction.
+ void setPAContext( pa_context *ctx, pa_threaded_mainloop *mainloop );
+
+private:
+ AudioDevice::Category m_category;
+ uint32_t m_paIndex;
+ TQString m_name;
+ int m_volume; // 0-100
+ bool m_muted;
+
+ pa_context *m_context;
+ pa_threaded_mainloop *m_mainloop;
+};