audio_core: Add realtime audio
This commit is contained in:
parent
cbfe2718be
commit
8771cde5fc
@ -17,6 +17,7 @@
|
|||||||
#elif HAVE_FDK
|
#elif HAVE_FDK
|
||||||
#include "audio_core/hle/fdk_decoder.h"
|
#include "audio_core/hle/fdk_decoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <algorithm>
|
||||||
#include "audio_core/hle/common.h"
|
#include "audio_core/hle/common.h"
|
||||||
#include "audio_core/hle/decoder.h"
|
#include "audio_core/hle/decoder.h"
|
||||||
#include "audio_core/hle/hle.h"
|
#include "audio_core/hle/hle.h"
|
||||||
@ -30,6 +31,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
|
#include "core/settings.h"
|
||||||
|
|
||||||
SERIALIZE_EXPORT_IMPL(AudioCore::DspHle)
|
SERIALIZE_EXPORT_IMPL(AudioCore::DspHle)
|
||||||
|
|
||||||
@ -453,7 +455,11 @@ void DspHle::Impl::AudioTickCallback(s64 cycles_late) {
|
|||||||
|
|
||||||
// Reschedule recurrent event
|
// Reschedule recurrent event
|
||||||
Core::Timing& timing = Core::System::GetInstance().CoreTiming();
|
Core::Timing& timing = Core::System::GetInstance().CoreTiming();
|
||||||
timing.ScheduleEvent(audio_frame_ticks - cycles_late, tick_event);
|
const double time_scale =
|
||||||
|
Settings::values.enable_realtime_audio
|
||||||
|
? std::clamp(Core::System::GetInstance().GetLastFrameTimeScale(), 1.0, 3.0)
|
||||||
|
: 1.0;
|
||||||
|
timing.ScheduleEvent(audio_frame_ticks / time_scale - cycles_late, tick_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(*this, memory)) {}
|
DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(*this, memory)) {}
|
||||||
|
@ -339,6 +339,10 @@ PerfStats::Results System::GetAndResetPerfStats() {
|
|||||||
: PerfStats::Results{};
|
: PerfStats::Results{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double System::GetLastFrameTimeScale() {
|
||||||
|
return perf_stats->GetLastFrameTimeScale();
|
||||||
|
}
|
||||||
|
|
||||||
void System::Reschedule() {
|
void System::Reschedule() {
|
||||||
if (!reschedule_pending) {
|
if (!reschedule_pending) {
|
||||||
return;
|
return;
|
||||||
|
@ -168,6 +168,8 @@ public:
|
|||||||
|
|
||||||
PerfStats::Results GetAndResetPerfStats();
|
PerfStats::Results GetAndResetPerfStats();
|
||||||
|
|
||||||
|
double GetLastFrameTimeScale();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a reference to the emulated CPU.
|
* Gets a reference to the emulated CPU.
|
||||||
* @returns A reference to the emulated CPU.
|
* @returns A reference to the emulated CPU.
|
||||||
|
@ -107,6 +107,7 @@ void LogSettings() {
|
|||||||
log_setting("Audio_OutputDevice", values.audio_device_id);
|
log_setting("Audio_OutputDevice", values.audio_device_id);
|
||||||
log_setting("Audio_InputDeviceType", static_cast<int>(values.mic_input_type));
|
log_setting("Audio_InputDeviceType", static_cast<int>(values.mic_input_type));
|
||||||
log_setting("Audio_InputDevice", values.mic_input_device);
|
log_setting("Audio_InputDevice", values.mic_input_device);
|
||||||
|
log_setting("Audio_EnableRealTime", Settings::values.enable_realtime_audio);
|
||||||
using namespace Service::CAM;
|
using namespace Service::CAM;
|
||||||
log_setting("Camera_OuterRightName", values.camera_name[OuterRightCamera]);
|
log_setting("Camera_OuterRightName", values.camera_name[OuterRightCamera]);
|
||||||
log_setting("Camera_OuterRightConfig", values.camera_config[OuterRightCamera]);
|
log_setting("Camera_OuterRightConfig", values.camera_config[OuterRightCamera]);
|
||||||
|
@ -202,6 +202,7 @@ struct Values {
|
|||||||
bool enable_dsp_lle_multithread;
|
bool enable_dsp_lle_multithread;
|
||||||
std::string sink_id;
|
std::string sink_id;
|
||||||
bool enable_audio_stretching;
|
bool enable_audio_stretching;
|
||||||
|
bool enable_realtime_audio;
|
||||||
std::string audio_device_id;
|
std::string audio_device_id;
|
||||||
float volume;
|
float volume;
|
||||||
MicInputType mic_input_type;
|
MicInputType mic_input_type;
|
||||||
|
@ -162,6 +162,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader) {
|
|||||||
AddField(Telemetry::FieldType::UserConfig, "Audio_SinkId", Settings::values.sink_id);
|
AddField(Telemetry::FieldType::UserConfig, "Audio_SinkId", Settings::values.sink_id);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
|
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableAudioStretching",
|
||||||
Settings::values.enable_audio_stretching);
|
Settings::values.enable_audio_stretching);
|
||||||
|
AddField(Telemetry::FieldType::UserConfig, "Audio_EnableRealTime",
|
||||||
|
Settings::values.enable_realtime_audio);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);
|
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_ResolutionFactor",
|
||||||
Settings::values.resolution_factor);
|
Settings::values.resolution_factor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user