Try to make the audio sink mess clear
This commit is contained in:
+13
-8
@@ -192,6 +192,8 @@ namespace audio {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_LOG(info) << "Selected audio sink: "sv << *sink;
|
||||||
|
|
||||||
// Only the first to start a session may change the default sink
|
// Only the first to start a session may change the default sink
|
||||||
if (!ref->sink_flag->exchange(true, std::memory_order_acquire)) {
|
if (!ref->sink_flag->exchange(true, std::memory_order_acquire)) {
|
||||||
// If the selected sink is different than the current one, change sinks.
|
// If the selected sink is different than the current one, change sinks.
|
||||||
@@ -238,14 +240,17 @@ namespace audio {
|
|||||||
case platf::capture_e::timeout:
|
case platf::capture_e::timeout:
|
||||||
continue;
|
continue;
|
||||||
case platf::capture_e::reinit:
|
case platf::capture_e::reinit:
|
||||||
BOOST_LOG(info) << "Reinitializing audio capture"sv;
|
if (config::audio.auto_capture) {
|
||||||
mic.reset();
|
BOOST_LOG(info) << "Reinitializing audio capture"sv;
|
||||||
do {
|
mic.reset();
|
||||||
mic = control->microphone(stream.mapping, stream.channelCount, stream.sampleRate, frame_size);
|
do {
|
||||||
if (!mic) {
|
mic = control->microphone(stream.mapping, stream.channelCount, stream.sampleRate, frame_size);
|
||||||
BOOST_LOG(warning) << "Couldn't re-initialize audio input"sv;
|
if (!mic) {
|
||||||
}
|
BOOST_LOG(warning) << "Couldn't re-initialize audio input"sv;
|
||||||
} while (!mic && !shutdown_event->view(5s));
|
}
|
||||||
|
} while (!mic && !shutdown_event->view(5s));
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -384,6 +384,8 @@ namespace config {
|
|||||||
{}, // audio_sink
|
{}, // audio_sink
|
||||||
{}, // virtual_sink
|
{}, // virtual_sink
|
||||||
true, // install_steam_drivers
|
true, // install_steam_drivers
|
||||||
|
true, // keep_sink_default
|
||||||
|
true, // auto_capture
|
||||||
};
|
};
|
||||||
|
|
||||||
stream_t stream {
|
stream_t stream {
|
||||||
@@ -1051,6 +1053,8 @@ namespace config {
|
|||||||
string_f(vars, "audio_sink", audio.sink);
|
string_f(vars, "audio_sink", audio.sink);
|
||||||
string_f(vars, "virtual_sink", audio.virtual_sink);
|
string_f(vars, "virtual_sink", audio.virtual_sink);
|
||||||
bool_f(vars, "install_steam_audio_drivers", audio.install_steam_drivers);
|
bool_f(vars, "install_steam_audio_drivers", audio.install_steam_drivers);
|
||||||
|
bool_f(vars, "keep_sink_default", audio.keep_default);
|
||||||
|
bool_f(vars, "auto_capture_sink", audio.auto_capture);
|
||||||
|
|
||||||
string_restricted_f(vars, "origin_web_ui_allowed", nvhttp.origin_web_ui_allowed, { "pc"sv, "lan"sv, "wan"sv });
|
string_restricted_f(vars, "origin_web_ui_allowed", nvhttp.origin_web_ui_allowed, { "pc"sv, "lan"sv, "wan"sv });
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ namespace config {
|
|||||||
std::string sink;
|
std::string sink;
|
||||||
std::string virtual_sink;
|
std::string virtual_sink;
|
||||||
bool install_steam_drivers;
|
bool install_steam_drivers;
|
||||||
|
bool keep_default;
|
||||||
|
bool auto_capture;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr int ENCRYPTION_MODE_NEVER = 0; // Never use video encryption, even if the client supports it
|
constexpr int ENCRYPTION_MODE_NEVER = 0; // Never use video encryption, even if the client supports it
|
||||||
|
|||||||
@@ -758,13 +758,15 @@ namespace platf::audio {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a virtual sink, set a callback that will change the sink back if it's changed
|
if (config::audio.keep_default) {
|
||||||
auto virtual_sink_info = extract_virtual_sink_info(assigned_sink);
|
// If this is a virtual sink, set a callback that will change the sink back if it's changed
|
||||||
if (virtual_sink_info) {
|
auto virtual_sink_info = extract_virtual_sink_info(assigned_sink);
|
||||||
mic->default_endpt_changed_cb = [this] {
|
if (virtual_sink_info) {
|
||||||
BOOST_LOG(info) << "Resetting sink to ["sv << assigned_sink << "] after default changed";
|
mic->default_endpt_changed_cb = [this] {
|
||||||
set_sink(assigned_sink);
|
BOOST_LOG(info) << "Resetting sink to ["sv << assigned_sink << "] after default changed";
|
||||||
};
|
set_sink(assigned_sink);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mic;
|
return mic;
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pre-wrap {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
padding: 1em 0;
|
padding: 1em 0;
|
||||||
}
|
}
|
||||||
@@ -172,6 +176,8 @@
|
|||||||
"audio_sink": "",
|
"audio_sink": "",
|
||||||
"virtual_sink": "",
|
"virtual_sink": "",
|
||||||
"install_steam_audio_drivers": "enabled",
|
"install_steam_audio_drivers": "enabled",
|
||||||
|
"keep_sink_default": "enabled",
|
||||||
|
"auto_capture_sink": "enabled",
|
||||||
"adapter_name": "",
|
"adapter_name": "",
|
||||||
"output_name": "",
|
"output_name": "",
|
||||||
"resolutions": "[352x240,480x360,858x480,1280x720,1920x1080,2560x1080,2560x1440,3440x1440,1920x1200,3840x2160,3840x1600]",
|
"resolutions": "[352x240,480x360,858x480,1280x720,1920x1080,2560x1080,2560x1440,3440x1440,1920x1200,3840x2160,3840x1600]",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const config = ref(props.config)
|
|||||||
<input type="text" class="form-control" id="audio_sink"
|
<input type="text" class="form-control" id="audio_sink"
|
||||||
:placeholder="$tp('config.audio_sink_placeholder', 'alsa_output.pci-0000_09_00.3.analog-stereo')"
|
:placeholder="$tp('config.audio_sink_placeholder', 'alsa_output.pci-0000_09_00.3.analog-stereo')"
|
||||||
v-model="config.audio_sink" />
|
v-model="config.audio_sink" />
|
||||||
<div class="form-text">
|
<div class="form-text pre-wrap">
|
||||||
{{ $tp('config.audio_sink_desc') }}<br>
|
{{ $tp('config.audio_sink_desc') }}<br>
|
||||||
<PlatformLayout :platform="platform">
|
<PlatformLayout :platform="platform">
|
||||||
<template #windows>
|
<template #windows>
|
||||||
@@ -45,7 +45,6 @@ const config = ref(props.config)
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<PlatformLayout :platform="platform">
|
<PlatformLayout :platform="platform">
|
||||||
<template #windows>
|
<template #windows>
|
||||||
<!-- Virtual Sink -->
|
<!-- Virtual Sink -->
|
||||||
@@ -53,9 +52,8 @@ const config = ref(props.config)
|
|||||||
<label for="virtual_sink" class="form-label">{{ $t('config.virtual_sink') }}</label>
|
<label for="virtual_sink" class="form-label">{{ $t('config.virtual_sink') }}</label>
|
||||||
<input type="text" class="form-control" id="virtual_sink" :placeholder="$t('config.virtual_sink_placeholder')"
|
<input type="text" class="form-control" id="virtual_sink" :placeholder="$t('config.virtual_sink_placeholder')"
|
||||||
v-model="config.virtual_sink" />
|
v-model="config.virtual_sink" />
|
||||||
<div class="form-text">{{ $t('config.virtual_sink_desc') }}</div>
|
<div class="form-text pre-wrap">{{ $t('config.virtual_sink_desc') }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Install Steam Audio Drivers -->
|
<!-- Install Steam Audio Drivers -->
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="install_steam_audio_drivers" class="form-label">{{ $t('config.install_steam_audio_drivers') }}</label>
|
<label for="install_steam_audio_drivers" class="form-label">{{ $t('config.install_steam_audio_drivers') }}</label>
|
||||||
@@ -63,11 +61,28 @@ const config = ref(props.config)
|
|||||||
<option value="disabled">{{ $t('_common.disabled') }}</option>
|
<option value="disabled">{{ $t('_common.disabled') }}</option>
|
||||||
<option value="enabled">{{ $t('_common.enabled_def') }}</option>
|
<option value="enabled">{{ $t('_common.enabled_def') }}</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="form-text">{{ $t('config.install_steam_audio_drivers_desc') }}</div>
|
<div class="form-text pre-wrap">{{ $t('config.install_steam_audio_drivers_desc') }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="keep_sink_default" class="form-label">{{ 'Keep virtual sink as default' }}</label>
|
||||||
|
<select id="keep_sink_default" class="form-select" v-model="config.keep_sink_default">
|
||||||
|
<option value="disabled">{{ $t('_common.disabled') }}</option>
|
||||||
|
<option value="enabled">{{ $t('_common.enabled_def') }}</option>
|
||||||
|
</select>
|
||||||
|
<div class="form-text pre-wrap">{{ 'Whether to force selected virtual sink as default (effective when host audio output is disabled).' }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="auto_capture_sink" class="form-label">{{ 'Auto capture current sink' }}</label>
|
||||||
|
<select id="auto_capture_sink" class="form-select" v-model="config.auto_capture_sink">
|
||||||
|
<option value="disabled">{{ $t('_common.disabled') }}</option>
|
||||||
|
<option value="enabled">{{ $t('_common.enabled_def') }}</option>
|
||||||
|
</select>
|
||||||
|
<div class="form-text pre-wrap">{{ 'Auto capture current sink after default audio sink changed.' }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</PlatformLayout>
|
</PlatformLayout>
|
||||||
|
|
||||||
|
|
||||||
<AdapterNameSelector
|
<AdapterNameSelector
|
||||||
:platform="platform"
|
:platform="platform"
|
||||||
:config="config"
|
:config="config"
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
"audio_sink": "Audio Sink",
|
"audio_sink": "Audio Sink",
|
||||||
"audio_sink_desc_linux": "The name of the audio sink used for Audio Loopback. If you do not specify this variable, pulseaudio will select the default monitor device. You can find the name of the audio sink using either command:",
|
"audio_sink_desc_linux": "The name of the audio sink used for Audio Loopback. If you do not specify this variable, pulseaudio will select the default monitor device. You can find the name of the audio sink using either command:",
|
||||||
"audio_sink_desc_macos": "The name of the audio sink used for Audio Loopback. Apollo can only access microphones on macOS due to system limitations. To stream system audio using Soundflower or BlackHole.",
|
"audio_sink_desc_macos": "The name of the audio sink used for Audio Loopback. Apollo can only access microphones on macOS due to system limitations. To stream system audio using Soundflower or BlackHole.",
|
||||||
"audio_sink_desc_windows": "Manually specify a specific audio device to capture. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection! If you have multiple audio devices with identical names, you can get the Device ID using the following command:",
|
"audio_sink_desc_windows": "The audio device to be used when audio output is allowed on host by the client.\nIf unset, the device is chosen automatically.\nYou can get the Device ID using the following command:",
|
||||||
"audio_sink_placeholder_macos": "BlackHole 2ch",
|
"audio_sink_placeholder_macos": "BlackHole 2ch",
|
||||||
"audio_sink_placeholder_windows": "Speakers (High Definition Audio Device)",
|
"audio_sink_placeholder_windows": "Speakers (High Definition Audio Device)",
|
||||||
"av1_mode": "AV1 Support",
|
"av1_mode": "AV1 Support",
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
"upnp": "UPnP",
|
"upnp": "UPnP",
|
||||||
"upnp_desc": "Automatically configure port forwarding for streaming over the Internet",
|
"upnp_desc": "Automatically configure port forwarding for streaming over the Internet",
|
||||||
"virtual_sink": "Virtual Sink",
|
"virtual_sink": "Virtual Sink",
|
||||||
"virtual_sink_desc": "Manually specify a virtual audio device to use. If unset, the device is chosen automatically. We strongly recommend leaving this field blank to use automatic device selection!",
|
"virtual_sink_desc": "The audio device to be used when audio output isn't allowed on host by the client.\nIf unset, the device is chosen automatically.\nWe strongly recommend leaving this field blank to use automatic device selection!",
|
||||||
"virtual_sink_placeholder": "Steam Streaming Speakers",
|
"virtual_sink_placeholder": "Steam Streaming Speakers",
|
||||||
"vt_coder": "VideoToolbox Coder",
|
"vt_coder": "VideoToolbox Coder",
|
||||||
"vt_realtime": "VideoToolbox Realtime Encoding",
|
"vt_realtime": "VideoToolbox Realtime Encoding",
|
||||||
|
|||||||
Reference in New Issue
Block a user