Option for Unprocessed Mic Audio

This commit is contained in:
mitsuami-megane
2025-02-13 06:07:18 +09:00
parent a6d4632f0f
commit 1d3f3d7727
5 changed files with 59 additions and 30 deletions
+5
View File
@@ -19,6 +19,7 @@
#include "audio.h"
#include "application.h"
#include "utils/named_thread.h"
#include "wivrn_client.h"
#include "xr/instance.h"
@@ -157,6 +158,10 @@ void wivrn::android::audio::build_microphone(AAudioStreamBuilder * builder, int3
AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
AAudioStreamBuilder_setSharingMode(builder, AAUDIO_SHARING_MODE_EXCLUSIVE);
AAudioStreamBuilder_setFormat(builder, AAUDIO_FORMAT_PCM_I16);
if (application::get_config().mic_unprocessed_audio)
{
AAudioStreamBuilder_setInputPreset(builder, AAUDIO_INPUT_PRESET_UNPROCESSED);
}
AAudioStreamBuilder_setDataCallback(builder, &microphone_data_cb, this);
AAudioStreamBuilder_setErrorCallback(builder, &microphone_error_cb, this);
+4
View File
@@ -188,6 +188,9 @@ configuration::configuration(xr::system & system)
if (auto val = root["passthrough_enabled"]; val.is_bool())
passthrough_enabled = val.get_bool();
if (auto val = root["mic_unprocessed_audio"]; val.is_bool())
mic_unprocessed_audio = val.get_bool();
if (auto val = root["virtual_keyboard_layout"]; val.is_string())
virtual_keyboard_layout = val.get_string().value();
@@ -252,6 +255,7 @@ void configuration::save()
json << ",\"preferred_refresh_rate\":" << preferred_refresh_rate;
json << ",\"resolution_scale\":" << resolution_scale;
json << ",\"passthrough_enabled\":" << std::boolalpha << passthrough_enabled;
json << ",\"mic_unprocessed_audio\":" << std::boolalpha << mic_unprocessed_audio;
for (auto & [key, value]: features)
json << "," << key << ":" << std::boolalpha << value;
json << ",\"virtual_keyboard_layout\":" << json_string(virtual_keyboard_layout);
+1
View File
@@ -49,6 +49,7 @@ public:
float resolution_scale = 1.4;
bool show_performance_metrics = false;
bool passthrough_enabled = false;
bool mic_unprocessed_audio = false;
std::string virtual_keyboard_layout = "QWERTY";
+11
View File
@@ -636,6 +636,17 @@ void scenes::lobby::gui_settings()
}
vibrate_on_hover();
}
{
ImGui::BeginDisabled(not config.check_feature(feature::microphone));
if (ImGui::Checkbox(_S("Unprocessed Microphone Audio"), &config.mic_unprocessed_audio))
{
config.save();
}
vibrate_on_hover();
if (ImGui::IsItemHovered())
tooltip(_("Force disable audio filters, such as noise cancellation"));
ImGui::EndDisabled();
}
{
ImGui::BeginDisabled(not application::get_hand_tracking_supported());
bool enabled = config.check_feature(feature::hand_tracking);