diff options
Diffstat (limited to 'src/model/pulsedevice.h')
| -rw-r--r-- | src/model/pulsedevice.h | 40 |
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; +}; |
