summaryrefslogtreecommitdiff
path: root/src/ui/backendcontroller.cpp
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2026-05-18 00:00:17 -0400
committerCalvin Morrison <calvin@pobox.com>2026-05-18 00:00:17 -0400
commit65c7ea9fbf4886fa3d6127c5fa699520f30f386c (patch)
treebca364e1c1f0244d477349345ec7dd531b8032f8 /src/ui/backendcontroller.cpp
parent3909a06fe6786027c83e3adaef89c343cde4fbe3 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'src/ui/backendcontroller.cpp')
-rw-r--r--src/ui/backendcontroller.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/ui/backendcontroller.cpp b/src/ui/backendcontroller.cpp
index 3a41b8d..037c797 100644
--- a/src/ui/backendcontroller.cpp
+++ b/src/ui/backendcontroller.cpp
@@ -17,6 +17,12 @@
#include "alsa/alsatray.h"
#endif
+#ifdef WITH_OSS
+#include "../model/ossmodel.h"
+#include "oss/ossmixerwindow.h"
+#include "oss/osstray.h"
+#endif
+
BackendController::BackendController( TQObject *parent )
: TQObject(parent)
#ifdef WITH_PULSE
@@ -25,6 +31,9 @@ BackendController::BackendController( TQObject *parent )
#ifdef WITH_ALSA
, m_alsaModel(0), m_alsaWin(0), m_alsaTray(0)
#endif
+#ifdef WITH_OSS
+ , m_ossModel(0), m_ossWin(0), m_ossTray(0)
+#endif
{}
BackendController::~BackendController()
@@ -41,6 +50,9 @@ void BackendController::start()
#ifdef WITH_ALSA
if ( m_currentBackend == "alsa" ) { startAlsa(); return; }
#endif
+#ifdef WITH_OSS
+ if ( m_currentBackend == "oss" ) { startOss(); return; }
+#endif
#ifdef WITH_PULSE
startPulse();
#endif
@@ -53,6 +65,11 @@ void BackendController::stop()
if ( m_alsaWin ) { delete m_alsaWin; m_alsaWin = 0; }
if ( m_alsaModel ) { delete m_alsaModel; m_alsaModel = 0; }
#endif
+#ifdef WITH_OSS
+ if ( m_ossTray ) { delete m_ossTray; m_ossTray = 0; }
+ if ( m_ossWin ) { delete m_ossWin; m_ossWin = 0; }
+ if ( m_ossModel ) { delete m_ossModel; m_ossModel = 0; }
+#endif
#ifdef WITH_PULSE
// Model first: stops the PA mainloop thread before any widget is destroyed.
if ( m_pulseModel ) { delete m_pulseModel; m_pulseModel = 0; }
@@ -109,6 +126,33 @@ void BackendController::startAlsa( bool showWindow )
}
#endif
+#ifdef WITH_OSS
+void BackendController::startOss( bool showWindow )
+{
+ m_ossModel = new OssModel( this );
+ if ( !m_ossModel->open() ) {
+ delete m_ossModel;
+ m_ossModel = 0;
+ return;
+ }
+ m_ossWin = new OssMixerWindow( m_ossModel );
+ connect( m_ossWin, TQ_SIGNAL(settingsChanged()),
+ this, TQ_SLOT(onSettingsChanged()) );
+ static_cast<TmixApp*>(kapp)->setMainWindow( m_ossWin );
+
+ TDEConfig *cfg = TDEGlobal::config();
+ cfg->setGroup("Tray");
+ bool dockInTray = cfg->readBoolEntry("DockInTray", true);
+ if ( dockInTray ) {
+ m_ossTray = new OssTray( m_ossModel, m_ossWin, m_ossWin );
+ m_ossWin->setTray( m_ossTray );
+ m_ossTray->show();
+ }
+ if ( !dockInTray || showWindow )
+ m_ossWin->show();
+}
+#endif
+
void BackendController::onSettingsChanged()
{
TDEConfig *cfg = TDEGlobal::config();
@@ -148,12 +192,26 @@ void BackendController::doSwitch()
}
}
#endif
+#ifdef WITH_OSS
+ if ( m_ossWin ) {
+ wasVisible = wasVisible || m_ossWin->isVisible();
+ if ( m_ossWin->isVisible() ) {
+ cfg->setGroup("MainWindow");
+ cfg->writeEntry("XPos", m_ossWin->x());
+ cfg->writeEntry("YPos", m_ossWin->y());
+ cfg->sync();
+ }
+ }
+#endif
stop();
#ifdef WITH_ALSA
if ( m_currentBackend == "alsa" ) { startAlsa( wasVisible ); return; }
#endif
+#ifdef WITH_OSS
+ if ( m_currentBackend == "oss" ) { startOss( wasVisible ); return; }
+#endif
#ifdef WITH_PULSE
startPulse( wasVisible );
#endif