From 65c7ea9fbf4886fa3d6127c5fa699520f30f386c Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Mon, 18 May 2026 00:00:17 -0400 Subject: OSS backend for FreeBSD support Adds a complete OSS audio backend alongside PulseAudio and ALSA: - OssDevice/OssModel: enumerate /dev/mixer*, poll for changes at 500ms - Full UI layer: mixer window, system tray, mini popup, per-channel widgets - Fake mute (saves/restores volume since OSS has no mute bit) - BackendController and PreferencesDlg updated; backend combo now uses m_backendIds list so any combination of compiled-in backends works Co-Authored-By: Claude Sonnet 4.6 --- src/model/ossdevice.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/model/ossdevice.h (limited to 'src/model/ossdevice.h') diff --git a/src/model/ossdevice.h b/src/model/ossdevice.h new file mode 100644 index 0000000..66a0d1b --- /dev/null +++ b/src/model/ossdevice.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include + +class OssDevice : public TQObject +{ + TQ_OBJECT +public: + enum Category { Output, Input }; + + OssDevice( Category cat, int cardIdx, const TQString &cardPath, + int fd, int channelIdx, const TQString &name, bool stereo, + TQObject *parent = 0 ); + + TQString name() const { return m_name; } + TQString cardPath() const { return m_cardPath; } + int cardIndex() const { return m_cardIdx; } + Category category() const { return m_category; } + 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 true; } + + void setVolume( int v ); + void setMuted( bool m ); + void setPan( int p ); + + void syncFromOss(); + +signals: + void volumeChanged( int v ); + void muteChanged( bool m ); + void panChanged( int p ); + +private: + void pushVolume(); + + int m_fd; // borrowed from OssModel — do not close + int m_cardIdx; + TQString m_cardPath; + int m_channelIdx; + TQString m_name; + Category m_category; + bool m_stereo; + int m_volume; + int m_savedVol; // pre-mute volume for fake-mute + bool m_muted; + int m_pan; +}; -- cgit v1.2.3