mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-02 19:08:03 -06:00
fixed settings for the openal backend
This commit is contained in:
parent
3157382d8e
commit
fa1deb4845
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <memory>
|
||||
@ -6,8 +6,8 @@
|
||||
#include <shared_mutex>
|
||||
#include <stop_token>
|
||||
#include <thread>
|
||||
#include <core/emulator_settings.h>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/thread.h"
|
||||
@ -205,7 +205,11 @@ s32 PS4_SYSV_ABI sceAudioOutInit() {
|
||||
return ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT;
|
||||
}
|
||||
|
||||
audio = std::make_unique<OpenALAudioOut>();
|
||||
if (EmulatorSettings.GetAudioBackend() == AudioBackend::OpenAL) {
|
||||
audio = std::make_unique<OpenALAudioOut>();
|
||||
} else {
|
||||
audio = std::make_unique<SDLAudioOut>();
|
||||
}
|
||||
|
||||
LOG_INFO(Lib_AudioOut, "Audio system initialized");
|
||||
return ORBIS_OK;
|
||||
|
||||
@ -11,9 +11,8 @@
|
||||
#include <AL/alc.h>
|
||||
#include <alext.h>
|
||||
#include <queue>
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/libraries/audio/audioout.h"
|
||||
#include "core/libraries/audio/audioout_backend.h"
|
||||
#include "core/libraries/audio/openal_manager.h"
|
||||
@ -168,7 +167,7 @@ public:
|
||||
max_channel_gain = std::max(max_channel_gain, channel_gain);
|
||||
}
|
||||
|
||||
const float slider_gain = Config::getVolumeSlider() * 0.01f;
|
||||
const float slider_gain = EmulatorSettings.GetVolumeSlider() * 0.01f;
|
||||
const float total_gain = max_channel_gain * slider_gain;
|
||||
|
||||
const float current = current_gain.load(std::memory_order_acquire);
|
||||
@ -256,7 +255,7 @@ private:
|
||||
}
|
||||
|
||||
// Initialize current gain
|
||||
current_gain.store(Config::getVolumeSlider() * 0.01f, std::memory_order_relaxed);
|
||||
current_gain.store(EmulatorSettings.GetVolumeSlider() * 0.01f, std::memory_order_relaxed);
|
||||
alSourcef(source, AL_GAIN, current_gain.load(std::memory_order_relaxed));
|
||||
|
||||
// Prime buffers with silence
|
||||
@ -316,11 +315,11 @@ private:
|
||||
switch (type) {
|
||||
case OrbisAudioOutPort::Main:
|
||||
case OrbisAudioOutPort::Bgm:
|
||||
return Config::getMainOutputDevice();
|
||||
return EmulatorSettings.GetOpenALMainOutputDevice();
|
||||
case OrbisAudioOutPort::PadSpk:
|
||||
return Config::getPadSpkOutputDevice();
|
||||
return EmulatorSettings.GetOpenALPadSpkOutputDevice();
|
||||
default:
|
||||
return Config::getMainOutputDevice();
|
||||
return EmulatorSettings.GetOpenALMainOutputDevice();
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +332,7 @@ private:
|
||||
|
||||
last_volume_check_time = current_time;
|
||||
|
||||
const float config_volume = Config::getVolumeSlider() * 0.01f;
|
||||
const float config_volume = EmulatorSettings.GetVolumeSlider() * 0.01f;
|
||||
const float stored_gain = current_gain.load(std::memory_order_acquire);
|
||||
|
||||
if (std::abs(config_volume - stored_gain) > VOLUME_EPSILON) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/libraries/ajm/ajm.h"
|
||||
@ -127,8 +127,11 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
||||
Libraries::AvPlayer::RegisterLib(sym);
|
||||
Libraries::Videodec::RegisterLib(sym);
|
||||
Libraries::Videodec2::RegisterLib(sym);
|
||||
// Libraries::Audio3d::RegisterLib(sym);
|
||||
Libraries::Audio3dOpenAL::RegisterLib(sym);
|
||||
if (EmulatorSettings.GetAudioBackend() == AudioBackend::OpenAL) {
|
||||
Libraries::Audio3dOpenAL::RegisterLib(sym);
|
||||
} else {
|
||||
Libraries::Audio3d::RegisterLib(sym);
|
||||
}
|
||||
Libraries::Ime::RegisterLib(sym);
|
||||
Libraries::GameLiveStreaming::RegisterLib(sym);
|
||||
Libraries::SharePlay::RegisterLib(sym);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user