summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorMaki <maki@hotmilk.space>2024-04-20 17:50:43 -0400
committerMaki <maki@hotmilk.space>2024-04-20 17:50:43 -0400
commite6ca21549ee1d4a23c82e12d9215ce993d99ca3e (patch)
tree21c65f4f0fb6e18817fb8494a0aa4eb22a8a2484 /indra/media_plugins
parent576508ebab789207c5d82c13ff627cb623d74994 (diff)
Only use one impl in Linux volume catcher
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/cef/linux/volume_catcher_linux.cpp59
-rw-r--r--indra/media_plugins/cef/volume_catcher.h1
2 files changed, 19 insertions, 41 deletions
diff --git a/indra/media_plugins/cef/linux/volume_catcher_linux.cpp b/indra/media_plugins/cef/linux/volume_catcher_linux.cpp
index 86cc329e66..3c037b45ba 100644
--- a/indra/media_plugins/cef/linux/volume_catcher_linux.cpp
+++ b/indra/media_plugins/cef/linux/volume_catcher_linux.cpp
@@ -28,9 +28,6 @@
#include "volume_catcher_linux.h"
-#define PULSEAUDIO pimpl
-#define PIPEWIRE pimpl2
-
////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
@@ -42,62 +39,44 @@ VolumeCatcher::VolumeCatcher()
}
void VolumeCatcher::onEnablePipeWireVolumeCatcher(bool enable) {
- if (enable) {
- // load pipewire
-
- if (PULSEAUDIO != nullptr) {
- delete PULSEAUDIO;
- PULSEAUDIO = nullptr;
- }
+ if (pimpl != nullptr)
+ return;
- if (PIPEWIRE == nullptr) {
- // debugPrint("volume catcher using pipewire\n");
- PIPEWIRE = new VolumeCatcherPipeWire();
- }
+ if (enable) {
+ // debugPrint("volume catcher using pipewire\n");
+ pimpl = new VolumeCatcherPipeWire();
} else {
- // load pulseaudio
-
- if (PIPEWIRE != nullptr) {
- delete PIPEWIRE;
- PIPEWIRE = nullptr;
- }
-
- if (PULSEAUDIO == nullptr) {
- // debugPrint("volume catcher using pulseaudio\n");
- PULSEAUDIO = new VolumeCatcherPulseAudio();
- }
+ // debugPrint("volume catcher using pulseaudio\n");
+ pimpl = new VolumeCatcherPulseAudio();
}
}
VolumeCatcher::~VolumeCatcher()
{
- if (PULSEAUDIO != nullptr) {
- delete PULSEAUDIO;
- PULSEAUDIO = nullptr;
- }
-
- if (PIPEWIRE != nullptr) {
- delete PIPEWIRE;
- PIPEWIRE = nullptr;
+ if (pimpl != nullptr) {
+ delete pimpl;
+ pimpl = nullptr;
}
}
void VolumeCatcher::setVolume(F32 volume)
{
- if (PULSEAUDIO != nullptr) PULSEAUDIO->setVolume(volume);
- if (PIPEWIRE != nullptr) PIPEWIRE->setVolume(volume);
+ if (pimpl != nullptr) {
+ pimpl->setVolume(volume);
+ }
}
void VolumeCatcher::setPan(F32 pan)
{
- // not implemented for both
- // if (PULSEAUDIO) PULSEAUDIO->setPan(pan);
- // if (PIPEWIRE) PIPEWIRE->setPan(pan);
+ if (pimpl != nullptr) {
+ pimpl->setPan(pan);
+ }
}
void VolumeCatcher::pump()
{
- if (PULSEAUDIO != nullptr) PULSEAUDIO->pump();
- if (PIPEWIRE != nullptr) PIPEWIRE->pump(); // doesn't need it
+ if (pimpl != nullptr) {
+ pimpl->pump();
+ }
}
diff --git a/indra/media_plugins/cef/volume_catcher.h b/indra/media_plugins/cef/volume_catcher.h
index 0c644b8b42..e11ecf5881 100644
--- a/indra/media_plugins/cef/volume_catcher.h
+++ b/indra/media_plugins/cef/volume_catcher.h
@@ -58,7 +58,6 @@ public:
private:
VolumeCatcherImpl *pimpl;
- VolumeCatcherImpl *pimpl2;
};
#endif // VOLUME_CATCHER_H