mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-17 08:11:30 -06:00
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (appimage-wayland) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (googleplay) (push) Waiting to run
citra-build / android (vanilla) (push) Waiting to run
citra-build / docker (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-libretro / android (push) Waiting to run
citra-libretro / linux (push) Waiting to run
citra-libretro / windows (push) Waiting to run
citra-libretro / macos (arm64) (push) Waiting to run
citra-libretro / macos (x86_64) (push) Waiting to run
citra-libretro / ios (push) Waiting to run
citra-libretro / tvos (push) Waiting to run
citra-transifex / transifex (push) Waiting to run
* libretro core * Bringing citra libretro implementation over * libretro: hook up vulkan renderer * libretro: github actions * libretro: gyro * libretro: core options v2 * libretro: on ios turn off shader jit if unavailable * moltenvk 1.3.0 introduces 8-bit indexes but allocates 16-bit for metal; this ends up allocating stream buffer * 2 = 132MiB. Instead, just use 16-bit indexes. (This will be necessary for standalone when bumping moltenvk version.) * libretro core: address review feedback * libretro: microphone support * cmake: Add ENABLE_ROOM_STANDALONE to list of incompatible libretro flags * libretro: proper initial geometry * libretro: fix software renderer * libretro: address review feedback * .github/libretro.yml: Pin macOS runners at macOS 26 * ci: Remove explicit selection of Xcode 16.0 * .github/libretro.yml: remove unnecessary windows builder apt commands * .github/libretro.yml: bump min macos version to 11.0 * ci: Re-enable CI jobs for all libretro cores This is under the condition that we don't introduce build cache for these builds --------- Co-authored-by: OpenSauce04 <opensauce04@gmail.com> Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
99 lines
3.9 KiB
C++
99 lines
3.9 KiB
C++
// Copyright Citra Emulator Project / Azahar Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#include <algorithm>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "audio_core/input_details.h"
|
|
#include "audio_core/null_input.h"
|
|
#include "audio_core/static_input.h"
|
|
#ifdef HAVE_CUBEB
|
|
#include "audio_core/cubeb_input.h"
|
|
#endif
|
|
#ifdef HAVE_OPENAL
|
|
#include "audio_core/openal_input.h"
|
|
#endif
|
|
#ifdef HAVE_LIBRETRO
|
|
#include "audio_core/libretro_input.h"
|
|
#endif
|
|
#include "common/logging/log.h"
|
|
#include "core/core.h"
|
|
|
|
namespace AudioCore {
|
|
namespace {
|
|
// input_details is ordered in terms of desirability, with the best choice at the top.
|
|
constexpr std::array input_details = {
|
|
#ifdef HAVE_LIBRETRO
|
|
InputDetails{InputType::LibRetro, "Real Device (LibRetro)", true,
|
|
[](Core::System& system, std::string_view device_id) -> std::unique_ptr<Input> {
|
|
if (!system.HasMicPermission()) {
|
|
LOG_WARNING(Audio,
|
|
"Microphone permission denied, falling back to null input.");
|
|
return std::make_unique<NullInput>();
|
|
}
|
|
return std::make_unique<LibRetroInput>();
|
|
},
|
|
[] { return std::vector<std::string>{"LibRetro Microphone"}; }},
|
|
#endif
|
|
#ifdef HAVE_CUBEB
|
|
InputDetails{InputType::Cubeb, "Real Device (Cubeb)", true,
|
|
[](Core::System& system, std::string_view device_id) -> std::unique_ptr<Input> {
|
|
if (!system.HasMicPermission()) {
|
|
LOG_WARNING(Audio,
|
|
"Microphone permission denied, falling back to null input.");
|
|
return std::make_unique<NullInput>();
|
|
}
|
|
return std::make_unique<CubebInput>(std::string(device_id));
|
|
},
|
|
&ListCubebInputDevices},
|
|
#endif
|
|
#ifdef HAVE_OPENAL
|
|
InputDetails{InputType::OpenAL, "Real Device (OpenAL)", true,
|
|
[](Core::System& system, std::string_view device_id) -> std::unique_ptr<Input> {
|
|
if (!system.HasMicPermission()) {
|
|
LOG_WARNING(Audio,
|
|
"Microphone permission denied, falling back to null input.");
|
|
return std::make_unique<NullInput>();
|
|
}
|
|
return std::make_unique<OpenALInput>(std::string(device_id));
|
|
},
|
|
&ListOpenALInputDevices},
|
|
#endif
|
|
InputDetails{InputType::Static, "Static Noise", false,
|
|
[](Core::System& system, std::string_view device_id) -> std::unique_ptr<Input> {
|
|
return std::make_unique<StaticInput>();
|
|
},
|
|
[] { return std::vector<std::string>{"Static Noise"}; }},
|
|
InputDetails{InputType::Null, "None", false,
|
|
[](Core::System& system, std::string_view device_id) -> std::unique_ptr<Input> {
|
|
return std::make_unique<NullInput>();
|
|
},
|
|
[] { return std::vector<std::string>{"None"}; }},
|
|
};
|
|
} // Anonymous namespace
|
|
|
|
std::vector<InputDetails> ListInputs() {
|
|
return {input_details.begin(), input_details.end()};
|
|
}
|
|
|
|
const InputDetails& GetInputDetails(InputType input_type) {
|
|
auto iter = std::find_if(
|
|
input_details.begin(), input_details.end(),
|
|
[input_type](const auto& input_detail) { return input_detail.type == input_type; });
|
|
|
|
if (input_type == InputType::Auto || iter == input_details.end()) {
|
|
if (input_type != InputType::Auto) {
|
|
LOG_ERROR(Audio, "AudioCore::GetInputDetails given invalid input_type {}", input_type);
|
|
}
|
|
// Auto-select.
|
|
// input_details is ordered in terms of desirability, with the best choice at the front.
|
|
iter = input_details.begin();
|
|
}
|
|
|
|
return *iter;
|
|
}
|
|
|
|
} // namespace AudioCore
|