mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
feat: add option to disable audio processing
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
bd5e452d34
commit
c90cc4d915
@ -12,25 +12,17 @@
|
|||||||
|
|
||||||
using namespace WallpaperEngine::Application;
|
using namespace WallpaperEngine::Application;
|
||||||
|
|
||||||
struct option long_options [] = {{"screen-root", required_argument, nullptr, 'r'},
|
struct option long_options [] = {
|
||||||
{"bg", required_argument, nullptr, 'b'},
|
{"screen-root", required_argument, nullptr, 'r'}, {"bg", required_argument, nullptr, 'b'},
|
||||||
{"window", required_argument, nullptr, 'w'},
|
{"window", required_argument, nullptr, 'w'}, {"pkg", required_argument, nullptr, 'p'},
|
||||||
{"pkg", required_argument, nullptr, 'p'},
|
{"dir", required_argument, nullptr, 'd'}, {"silent", no_argument, nullptr, 's'},
|
||||||
{"dir", required_argument, nullptr, 'd'},
|
{"volume", required_argument, nullptr, 'v'}, {"help", no_argument, nullptr, 'h'},
|
||||||
{"silent", no_argument, nullptr, 's'},
|
{"fps", required_argument, nullptr, 'f'}, {"assets-dir", required_argument, nullptr, 'a'},
|
||||||
{"volume", required_argument, nullptr, 'v'},
|
{"screenshot", required_argument, nullptr, 'c'}, {"list-properties", no_argument, nullptr, 'l'},
|
||||||
{"help", no_argument, nullptr, 'h'},
|
{"set-property", required_argument, nullptr, 'o'}, {"noautomute", no_argument, nullptr, 'm'},
|
||||||
{"fps", required_argument, nullptr, 'f'},
|
{"no-audio-processing", no_argument, nullptr, 'g'}, {"no-fullscreen-pause", no_argument, nullptr, 'n'},
|
||||||
{"assets-dir", required_argument, nullptr, 'a'},
|
{"disable-mouse", no_argument, nullptr, 'e'}, {"scaling", required_argument, nullptr, 't'},
|
||||||
{"screenshot", required_argument, nullptr, 'c'},
|
{"clamping", required_argument, nullptr, 't'}, {nullptr, 0, nullptr, 0}};
|
||||||
{"list-properties", no_argument, nullptr, 'l'},
|
|
||||||
{"set-property", required_argument, nullptr, 'o'},
|
|
||||||
{"noautomute", no_argument, nullptr, 'm'},
|
|
||||||
{"no-fullscreen-pause", no_argument, nullptr, 'n'},
|
|
||||||
{"disable-mouse", no_argument, nullptr, 'e'},
|
|
||||||
{"scaling", required_argument, nullptr, 't'},
|
|
||||||
{"clamping", required_argument, nullptr, 't'},
|
|
||||||
{nullptr, 0, nullptr, 0}};
|
|
||||||
|
|
||||||
/* std::hash::operator() isn't constexpr, so it can't be used to get hash values as compile-time constants
|
/* std::hash::operator() isn't constexpr, so it can't be used to get hash values as compile-time constants
|
||||||
* So here is customHash. It skips all spaces, so hashes for " find " and "fi nd" are the same
|
* So here is customHash. It skips all spaces, so hashes for " find " and "fi nd" are the same
|
||||||
@ -86,7 +78,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) {
|
|||||||
.scalingMode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs,
|
.scalingMode = WallpaperEngine::Render::CWallpaperState::TextureUVsScaling::DefaultUVs,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.audio = {.enabled = true, .volume = 15, .automute = true},
|
.audio = {.enabled = true, .volume = 15, .automute = true, .audioprocessing = true},
|
||||||
.mouse =
|
.mouse =
|
||||||
{
|
{
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
@ -189,6 +181,8 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) {
|
|||||||
|
|
||||||
case 'm': this->settings.audio.automute = false; break;
|
case 'm': this->settings.audio.automute = false; break;
|
||||||
|
|
||||||
|
case 'g': this->settings.audio.audioprocessing = false; break;
|
||||||
|
|
||||||
case 'e': this->settings.mouse.enabled = false; break;
|
case 'e': this->settings.mouse.enabled = false; break;
|
||||||
|
|
||||||
case 't': {
|
case 't': {
|
||||||
@ -305,6 +299,7 @@ void CApplicationContext::printHelp (const char* route) {
|
|||||||
sLog.out ("\t--silent\t\t\t\t\tMutes all the sound the wallpaper might produce");
|
sLog.out ("\t--silent\t\t\t\t\tMutes all the sound the wallpaper might produce");
|
||||||
sLog.out ("\t--volume <amount>\t\t\tSets the volume for all the sounds in the background");
|
sLog.out ("\t--volume <amount>\t\t\tSets the volume for all the sounds in the background");
|
||||||
sLog.out ("\t--noautomute\t\t\t\tDisables the automute when an app is playing sound");
|
sLog.out ("\t--noautomute\t\t\t\tDisables the automute when an app is playing sound");
|
||||||
|
sLog.out ("\t--no-audio-processing\t\t\t\tDisables audio processing for backgrounds");
|
||||||
sLog.out ("\t--screen-root <screen name>\tDisplay as screen's background");
|
sLog.out ("\t--screen-root <screen name>\tDisplay as screen's background");
|
||||||
sLog.out (
|
sLog.out (
|
||||||
"\t--window <geometry>\tRuns in window mode, geometry has to be XxYxWxH and sets the position and size of the window");
|
"\t--window <geometry>\tRuns in window mode, geometry has to be XxYxWxH and sets the position and size of the window");
|
||||||
|
@ -81,6 +81,8 @@ class CApplicationContext {
|
|||||||
int volume;
|
int volume;
|
||||||
/** If the audio must be muted if something else is playing sound */
|
/** If the audio must be muted if something else is playing sound */
|
||||||
bool automute;
|
bool automute;
|
||||||
|
/** If audio processing can be enabled or not */
|
||||||
|
bool audioprocessing;
|
||||||
} audio;
|
} audio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,13 +274,18 @@ void CWallpaperApplication::show () {
|
|||||||
videoDriver = x11Driver;
|
videoDriver = x11Driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stereo mix recorder for audio processing
|
if (this->m_context.settings.audio.audioprocessing) {
|
||||||
WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder audioRecorder;
|
this->audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPulseAudioPlaybackRecorder ();
|
||||||
|
} else {
|
||||||
|
this->audioRecorder = new WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder ();
|
||||||
|
}
|
||||||
|
|
||||||
// audio playing detector
|
// audio playing detector
|
||||||
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (
|
WallpaperEngine::Audio::Drivers::Detectors::CPulseAudioPlayingDetector audioDetector (
|
||||||
this->m_context, videoDriver->getFullscreenDetector ());
|
this->m_context, videoDriver->getFullscreenDetector ());
|
||||||
// initialize sdl audio driver
|
// initialize sdl audio driver
|
||||||
audioDriver = new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, audioRecorder);
|
audioDriver =
|
||||||
|
new WallpaperEngine::Audio::Drivers::CSDLAudioDriver (this->m_context, audioDetector, *this->audioRecorder);
|
||||||
// initialize audio context
|
// initialize audio context
|
||||||
audioContext = new WallpaperEngine::Audio::CAudioContext (*audioDriver);
|
audioContext = new WallpaperEngine::Audio::CAudioContext (*audioDriver);
|
||||||
// initialize render context
|
// initialize render context
|
||||||
|
@ -116,6 +116,7 @@ class CWallpaperApplication {
|
|||||||
/** Maps screens to backgrounds */
|
/** Maps screens to backgrounds */
|
||||||
std::map<std::string, Core::CProject*> m_backgrounds;
|
std::map<std::string, Core::CProject*> m_backgrounds;
|
||||||
|
|
||||||
|
WallpaperEngine::Audio::Drivers::Recorders::CPlaybackRecorder* audioRecorder;
|
||||||
WallpaperEngine::Render::Drivers::CVideoDriver* videoDriver;
|
WallpaperEngine::Render::Drivers::CVideoDriver* videoDriver;
|
||||||
WallpaperEngine::Input::CInputContext* inputContext;
|
WallpaperEngine::Input::CInputContext* inputContext;
|
||||||
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* audioDriver;
|
WallpaperEngine::Audio::Drivers::CSDLAudioDriver* audioDriver;
|
||||||
|
@ -1 +1,6 @@
|
|||||||
#include "CPlaybackRecorder.h"
|
#include "CPlaybackRecorder.h"
|
||||||
|
|
||||||
|
namespace WallpaperEngine::Audio::Drivers::Recorders {
|
||||||
|
void CPlaybackRecorder::update () {}
|
||||||
|
|
||||||
|
} // namespace WallpaperEngine::Audio::Drivers::Recorders
|
@ -5,7 +5,7 @@ class CPlaybackRecorder {
|
|||||||
public:
|
public:
|
||||||
virtual ~CPlaybackRecorder () = default;
|
virtual ~CPlaybackRecorder () = default;
|
||||||
|
|
||||||
virtual void update () = 0;
|
virtual void update ();
|
||||||
|
|
||||||
float audio16 [16] = {0};
|
float audio16 [16] = {0};
|
||||||
float audio32 [32] = {0};
|
float audio32 [32] = {0};
|
||||||
|
Loading…
Reference in New Issue
Block a user