audio_core: Implement OpenAL backend (#6450)

This commit is contained in:
Steveice10 2023-05-01 12:17:45 -07:00 committed by GitHub
parent ce553ab995
commit 055a58f01e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 1042 additions and 576 deletions

View file

@ -3,11 +3,12 @@
// Refer to the license.txt file included.
#include <boost/serialization/weak_ptr.hpp>
#include "audio_core/input.h"
#include "audio_core/input_details.h"
#include "common/archives.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/frontend/mic.h"
#include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"
@ -167,7 +168,7 @@ struct MIC_U::Impl {
return;
}
Frontend::Mic::Samples samples = mic->Read();
AudioCore::Samples samples = mic->Read();
if (!samples.empty()) {
// write the samples to sharedmem page
state.WriteSamples(samples);
@ -180,8 +181,8 @@ struct MIC_U::Impl {
void StartSampling() {
auto sign = encoding == Encoding::PCM8Signed || encoding == Encoding::PCM16Signed
? Frontend::Mic::Signedness::Signed
: Frontend::Mic::Signedness::Unsigned;
? AudioCore::Signedness::Signed
: AudioCore::Signedness::Unsigned;
mic->StartSampling({sign, state.sample_size, state.looped_buffer,
GetSampleRateInHz(state.sample_rate), state.initial_offset,
static_cast<u32>(state.size)});
@ -349,21 +350,9 @@ struct MIC_U::Impl {
}
void CreateMic() {
std::unique_ptr<Frontend::Mic::Interface> new_mic;
switch (Settings::values.mic_input_type.GetValue()) {
case Settings::MicInputType::None:
new_mic = std::make_unique<Frontend::Mic::NullMic>();
break;
case Settings::MicInputType::Real:
new_mic = Frontend::Mic::CreateRealMic(Settings::values.mic_input_device.GetValue());
break;
case Settings::MicInputType::Static:
new_mic = std::make_unique<Frontend::Mic::StaticMic>();
break;
default:
LOG_CRITICAL(Audio, "Mic type not found. Defaulting to null mic");
new_mic = std::make_unique<Frontend::Mic::NullMic>();
}
std::unique_ptr<AudioCore::Input> new_mic = AudioCore::CreateInputFromID(
Settings::values.input_type.GetValue(), Settings::values.input_device.GetValue());
// If theres already a mic, copy over any data to the new mic impl
if (mic) {
new_mic->SetGain(mic->GetGain());
@ -386,7 +375,7 @@ struct MIC_U::Impl {
u32 client_version = 0;
bool allow_shell_closed = false;
bool clamp = false;
std::unique_ptr<Frontend::Mic::Interface> mic;
std::unique_ptr<AudioCore::Input> mic;
Core::Timing& timing;
State state{};
Encoding encoding{};

View file

@ -26,7 +26,6 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/file_sys/plugin_3gx.h"
#include "core/frontend/mic.h"
#include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"