From 8ef838bada7f6c361fb1e81d7423644ed442f944 Mon Sep 17 00:00:00 2001 From: Clutchnp <105556048+Clutchnp@users.noreply.github.com> Date: Thu, 1 May 2025 21:09:43 +0530 Subject: [PATCH] feat(audio): add an option to disable sound streaming (#3833) --- docs/configuration.md | 23 +++++++++++++++++++ src/audio.cpp | 4 ++++ src/config.cpp | 2 ++ src/config.h | 1 + .../assets/web/configs/tabs/AudioVideo.vue | 8 +++++++ .../assets/web/public/assets/locale/en.json | 2 ++ 6 files changed, 40 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index bdd187be..ef248643 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -770,6 +770,29 @@ editing the `conf` file in a text editor. Use the examples as reference. +### stream_audio + + + + + + + + + + + + + + +
Description + Whether to stream audio or not. Disabling this can be useful for streaming headless displays as second monitors. +
Default@code{} + enabled + @endcode
Example@code{} + stream_audio = disabled + @endcode
+ ### install_steam_audio_drivers diff --git a/src/audio.cpp b/src/audio.cpp index f060118d..0d287071 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -129,6 +129,10 @@ namespace audio { void capture(safe::mail_t mail, config_t config, void *channel_data) { auto shutdown_event = mail->event(mail::shutdown); + if (!config::audio.stream) { + shutdown_event->view(); + return; + } auto stream = stream_configs[map_stream(config.channels, config.flags[config_t::HIGH_QUALITY])]; if (config.flags[config_t::CUSTOM_SURROUND_PARAMS]) { apply_surround_params(stream, config.customStreamParams); diff --git a/src/config.cpp b/src/config.cpp index 167b244a..7147fd6c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -511,6 +511,7 @@ namespace config { audio_t audio { {}, // audio_sink {}, // virtual_sink + true, // stream audio true, // install_steam_drivers }; @@ -1160,6 +1161,7 @@ namespace config { string_f(vars, "audio_sink", audio.sink); string_f(vars, "virtual_sink", audio.virtual_sink); + bool_f(vars, "stream_audio", audio.stream); bool_f(vars, "install_steam_audio_drivers", audio.install_steam_drivers); string_restricted_f(vars, "origin_web_ui_allowed", nvhttp.origin_web_ui_allowed, {"pc"sv, "lan"sv, "wan"sv}); diff --git a/src/config.h b/src/config.h index 474cbb5a..066b95df 100644 --- a/src/config.h +++ b/src/config.h @@ -147,6 +147,7 @@ namespace config { struct audio_t { std::string sink; std::string virtual_sink; + bool stream; bool install_steam_drivers; }; diff --git a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue index 6791a9c6..27f58365 100644 --- a/src_assets/common/assets/web/configs/tabs/AudioVideo.vue +++ b/src_assets/common/assets/web/configs/tabs/AudioVideo.vue @@ -63,6 +63,14 @@ const config = ref(props.config) + + +