audio_core: Implement OpenAL backend (#6450)
This commit is contained in:
parent
ce553ab995
commit
055a58f01e
48 changed files with 1042 additions and 576 deletions
|
@ -400,10 +400,10 @@ public final class SettingsFragmentPresenter {
|
|||
|
||||
SettingSection audioSection = mSettings.getSection(Settings.SECTION_AUDIO);
|
||||
Setting audioStretch = audioSection.getSetting(SettingsFile.KEY_ENABLE_AUDIO_STRETCHING);
|
||||
Setting micInputType = audioSection.getSetting(SettingsFile.KEY_MIC_INPUT_TYPE);
|
||||
Setting audioInputType = audioSection.getSetting(SettingsFile.KEY_AUDIO_INPUT_TYPE);
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_ENABLE_AUDIO_STRETCHING, Settings.SECTION_AUDIO, R.string.audio_stretch, R.string.audio_stretch_description, true, audioStretch));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_MIC_INPUT_TYPE, Settings.SECTION_AUDIO, R.string.audio_input_type, 0, R.array.audioInputTypeNames, R.array.audioInputTypeValues, 1, micInputType));
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_AUDIO_INPUT_TYPE, Settings.SECTION_AUDIO, R.string.audio_input_type, 0, R.array.audioInputTypeNames, R.array.audioInputTypeValues, 0, audioInputType));
|
||||
}
|
||||
|
||||
private void addDebugSettings(ArrayList<SettingsItem> sl) {
|
||||
|
|
|
@ -75,10 +75,10 @@ public final class SettingsFile {
|
|||
public static final String KEY_PRELOAD_TEXTURES = "preload_textures";
|
||||
public static final String KEY_ASYNC_CUSTOM_LOADING = "async_custom_loading";
|
||||
|
||||
public static final String KEY_AUDIO_OUTPUT_ENGINE = "output_engine";
|
||||
public static final String KEY_AUDIO_OUTPUT_TYPE = "output_type";
|
||||
public static final String KEY_ENABLE_AUDIO_STRETCHING = "enable_audio_stretching";
|
||||
public static final String KEY_VOLUME = "volume";
|
||||
public static final String KEY_MIC_INPUT_TYPE = "mic_input_type";
|
||||
public static final String KEY_AUDIO_INPUT_TYPE = "input_type";
|
||||
|
||||
public static final String KEY_USE_VIRTUAL_SD = "use_virtual_sd";
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ add_library(citra-android SHARED
|
|||
game_settings.h
|
||||
id_cache.cpp
|
||||
id_cache.h
|
||||
mic.cpp
|
||||
mic.h
|
||||
native.cpp
|
||||
native.h
|
||||
ndk_motion.cpp
|
||||
|
|
|
@ -199,12 +199,12 @@ void Config::ReadValues() {
|
|||
|
||||
// Audio
|
||||
ReadSetting("Audio", Settings::values.audio_emulation);
|
||||
ReadSetting("Audio", Settings::values.sink_id);
|
||||
ReadSetting("Audio", Settings::values.enable_audio_stretching);
|
||||
ReadSetting("Audio", Settings::values.audio_device_id);
|
||||
ReadSetting("Audio", Settings::values.volume);
|
||||
ReadSetting("Audio", Settings::values.mic_input_device);
|
||||
ReadSetting("Audio", Settings::values.mic_input_type);
|
||||
ReadSetting("Audio", Settings::values.output_type);
|
||||
ReadSetting("Audio", Settings::values.output_device);
|
||||
ReadSetting("Audio", Settings::values.input_type);
|
||||
ReadSetting("Audio", Settings::values.input_device);
|
||||
|
||||
// Data Storage
|
||||
ReadSetting("Data Storage", Settings::values.use_virtual_sd);
|
||||
|
|
|
@ -226,28 +226,32 @@ enable_dsp_lle =
|
|||
# 0 (default): No, 1: Yes
|
||||
enable_dsp_lle_thread =
|
||||
|
||||
# Which audio output engine to use.
|
||||
# auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available)
|
||||
output_engine =
|
||||
|
||||
# Whether or not to enable the audio-stretching post-processing effect.
|
||||
# This effect adjusts audio speed to match emulation speed and helps prevent audio stutter,
|
||||
# at the cost of increasing audio latency.
|
||||
# 0: No, 1 (default): Yes
|
||||
enable_audio_stretching =
|
||||
|
||||
# Which audio device to use.
|
||||
# auto (default): Auto-select
|
||||
output_device =
|
||||
|
||||
# Which mic input type to use.
|
||||
# 0: None, 1 (default): Real device, 2: Static noise
|
||||
mic_input_type =
|
||||
|
||||
# Output volume.
|
||||
# 1.0 (default): 100%, 0.0; mute
|
||||
volume =
|
||||
|
||||
# Which audio output type to use.
|
||||
# 0 (default): Auto-select, 1: No audio output, 2: Cubeb (if available), 3: OpenAL (if available), 4: SDL2 (if available)
|
||||
output_type =
|
||||
|
||||
# Which audio output device to use.
|
||||
# auto (default): Auto-select
|
||||
output_device =
|
||||
|
||||
# Which audio input type to use.
|
||||
# 0 (default): Auto-select, 1: No audio input, 2: Static noise, 3: Cubeb (if available), 4: OpenAL (if available)
|
||||
input_type =
|
||||
|
||||
# Which audio input device to use.
|
||||
# auto (default): Auto-select
|
||||
input_device =
|
||||
|
||||
[Data Storage]
|
||||
# Whether to create a virtual SD card.
|
||||
# 1 (default): Yes, 0: No
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
// Copyright 2020 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <jni.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "jni/id_cache.h"
|
||||
#include "jni/mic.h"
|
||||
|
||||
#ifdef HAVE_CUBEB
|
||||
#include "audio_core/cubeb_input.h"
|
||||
#endif
|
||||
|
||||
namespace Mic {
|
||||
|
||||
AndroidFactory::~AndroidFactory() = default;
|
||||
|
||||
std::unique_ptr<Frontend::Mic::Interface> AndroidFactory::Create(std::string mic_device_name) {
|
||||
#ifdef HAVE_CUBEB
|
||||
if (!permission_granted) {
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
permission_granted = env->CallStaticBooleanMethod(IDCache::GetNativeLibraryClass(),
|
||||
IDCache::GetRequestMicPermission());
|
||||
}
|
||||
|
||||
if (permission_granted) {
|
||||
return std::make_unique<AudioCore::CubebInput>(std::move(mic_device_name));
|
||||
} else {
|
||||
LOG_WARNING(Frontend, "Mic permissions denied");
|
||||
return std::make_unique<Frontend::Mic::NullMic>();
|
||||
}
|
||||
#else
|
||||
LOG_WARNING(Frontend, "No cubeb support");
|
||||
return std::make_unique<Frontend::Mic::NullMic>();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Mic
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright 2020 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/frontend/mic.h"
|
||||
|
||||
namespace Mic {
|
||||
|
||||
class AndroidFactory final : public Frontend::Mic::RealMicFactory {
|
||||
public:
|
||||
~AndroidFactory() override;
|
||||
|
||||
std::unique_ptr<Frontend::Mic::Interface> Create(std::string mic_device_name) override;
|
||||
|
||||
private:
|
||||
bool permission_granted = false;
|
||||
};
|
||||
|
||||
} // namespace Mic
|
|
@ -24,7 +24,6 @@
|
|||
#include "core/core.h"
|
||||
#include "core/frontend/applets/default_applets.h"
|
||||
#include "core/frontend/camera/factory.h"
|
||||
#include "core/frontend/mic.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/nfc/nfc.h"
|
||||
#include "core/savestate.h"
|
||||
|
@ -39,7 +38,6 @@
|
|||
#include "jni/game_settings.h"
|
||||
#include "jni/id_cache.h"
|
||||
#include "jni/input_manager.h"
|
||||
#include "jni/mic.h"
|
||||
#include "jni/native.h"
|
||||
#include "jni/ndk_motion.h"
|
||||
#include "video_core/renderer_base.h"
|
||||
|
@ -134,6 +132,11 @@ static void TryShutdown() {
|
|||
MicroProfileShutdown();
|
||||
}
|
||||
|
||||
static bool CheckMicPermission() {
|
||||
return IDCache::GetEnvForThread()->CallStaticBooleanMethod(IDCache::GetNativeLibraryClass(),
|
||||
IDCache::GetRequestMicPermission());
|
||||
}
|
||||
|
||||
static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
||||
// Citra core only supports a single running instance
|
||||
std::lock_guard<std::mutex> lock(running_mutex);
|
||||
|
@ -183,8 +186,8 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||
system.RegisterMiiSelector(std::make_shared<MiiSelector::AndroidMiiSelector>());
|
||||
system.RegisterSoftwareKeyboard(std::make_shared<SoftwareKeyboard::AndroidKeyboard>());
|
||||
|
||||
// Register real Mic factory
|
||||
Frontend::Mic::RegisterRealMicFactory(std::make_unique<Mic::AndroidFactory>());
|
||||
// Register microphone permission check
|
||||
Core::System::GetInstance().RegisterMicPermissionCheck(&CheckMicPermission);
|
||||
|
||||
InputManager::Init();
|
||||
|
||||
|
|
|
@ -143,15 +143,19 @@
|
|||
</integer-array>
|
||||
|
||||
<string-array name="audioInputTypeNames">
|
||||
<item>Auto</item>
|
||||
<item>None</item>
|
||||
<item>Real Device</item>
|
||||
<item>Static Noise</item>
|
||||
<item>Real Device (Cubeb)</item>
|
||||
<item>Real Device (OpenAL)</item>
|
||||
</string-array>
|
||||
|
||||
<integer-array name="audioInputTypeValues">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="render3dModes">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue