Skip to content

Commit

Permalink
audio: Accurate audio output timing. (#1986)
Browse files Browse the repository at this point in the history
* audio: Accurate audio output timing.

* audio: Handle SDL audio queue stalls.

* audio: Format info cleanup.
  • Loading branch information
squidbus authored Dec 31, 2024
1 parent 927dc6d commit 48c51bd
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 821 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,3 @@
path = externals/MoltenVK/cereal
url = https://github.com/USCiLab/cereal
shallow = true
[submodule "externals/cubeb"]
path = externals/cubeb
url = https://github.com/mozilla/cubeb
shallow = true
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ find_package(xxHash 0.8.2 MODULE)
find_package(ZLIB 1.3 MODULE)
find_package(Zydis 5.0.0 CONFIG)
find_package(pugixml 1.14 CONFIG)
find_package(cubeb CONFIG)

if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC)
find_package(cryptopp 8.9.0 MODULE)
Expand Down Expand Up @@ -203,7 +202,6 @@ set(AUDIO_LIB src/core/libraries/audio/audioin.cpp
src/core/libraries/audio/audioout.h
src/core/libraries/audio/audioout_backend.h
src/core/libraries/audio/audioout_error.h
src/core/libraries/audio/cubeb_audio.cpp
src/core/libraries/audio/sdl_audio.cpp
src/core/libraries/ngs2/ngs2.cpp
src/core/libraries/ngs2/ngs2.h
Expand Down Expand Up @@ -499,7 +497,6 @@ set(COMMON src/common/logging/backend.cpp
src/common/polyfill_thread.h
src/common/rdtsc.cpp
src/common/rdtsc.h
src/common/ringbuffer.h
src/common/signal_context.h
src/common/signal_context.cpp
src/common/singleton.h
Expand Down Expand Up @@ -892,7 +889,7 @@ endif()
create_target_directory_groups(shadps4)

target_link_libraries(shadps4 PRIVATE magic_enum::magic_enum fmt::fmt toml11::toml11 tsl::robin_map xbyak::xbyak Tracy::TracyClient RenderDoc::API FFmpeg::ffmpeg Dear_ImGui gcn half::half ZLIB::ZLIB PNG::PNG)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers cubeb::cubeb)
target_link_libraries(shadps4 PRIVATE Boost::headers GPUOpen::VulkanMemoryAllocator LibAtrac9 sirit Vulkan::Headers xxHash::xxhash Zydis::Zydis glslang::glslang SDL3::SDL3 pugixml::pugixml stb::headers)

target_compile_definitions(shadps4 PRIVATE IMGUI_USER_CONFIG="imgui/imgui_config.h")
target_compile_definitions(Dear_ImGui PRIVATE IMGUI_USER_CONFIG="${PROJECT_SOURCE_DIR}/src/imgui/imgui_config.h")
Expand Down
7 changes: 0 additions & 7 deletions LICENSES/ISC.txt

This file was deleted.

10 changes: 0 additions & 10 deletions externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,6 @@ if (NOT TARGET stb::headers)
add_library(stb::headers ALIAS stb)
endif()

# cubeb
if (NOT TARGET cubeb::cubeb)
option(BUILD_TESTS "" OFF)
option(BUILD_TOOLS "" OFF)
option(BUNDLE_SPEEX "" ON)
option(USE_SANITIZERS "" OFF)
add_subdirectory(cubeb)
add_library(cubeb::cubeb ALIAS cubeb)
endif()

# Apple-only dependencies
if (APPLE)
# date
Expand Down
1 change: 0 additions & 1 deletion externals/cubeb
Submodule cubeb deleted from 9a9d03
17 changes: 0 additions & 17 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ static int cursorHideTimeout = 5; // 5 seconds (default)
static bool separateupdatefolder = false;
static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false;
static std::string audioBackend = "cubeb";

// Gui
std::vector<std::filesystem::path> settings_install_dirs = {};
Expand Down Expand Up @@ -240,10 +239,6 @@ bool getCheckCompatibilityOnStartup() {
return checkCompatibilityOnStartup;
}

std::string getAudioBackend() {
return audioBackend;
}

void setGpuId(s32 selectedGpuId) {
gpuId = selectedGpuId;
}
Expand Down Expand Up @@ -376,10 +371,6 @@ void setCheckCompatibilityOnStartup(bool use) {
checkCompatibilityOnStartup = use;
}

void setAudioBackend(std::string backend) {
audioBackend = backend;
}

void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
main_window_geometry_x = x;
main_window_geometry_y = y;
Expand Down Expand Up @@ -620,12 +611,6 @@ void load(const std::filesystem::path& path) {
vkCrashDiagnostic = toml::find_or<bool>(vk, "crashDiagnostic", false);
}

if (data.contains("Audio")) {
const toml::value& audio = data.at("Audio");

audioBackend = toml::find_or<std::string>(audio, "backend", "cubeb");
}

if (data.contains("Debug")) {
const toml::value& debug = data.at("Debug");

Expand Down Expand Up @@ -724,7 +709,6 @@ void save(const std::filesystem::path& path) {
data["Vulkan"]["rdocEnable"] = rdocEnable;
data["Vulkan"]["rdocMarkersEnable"] = vkMarkers;
data["Vulkan"]["crashDiagnostic"] = vkCrashDiagnostic;
data["Audio"]["backend"] = audioBackend;
data["Debug"]["DebugDump"] = isDebugDump;
data["Debug"]["CollectShader"] = isShaderDebug;

Expand Down Expand Up @@ -828,7 +812,6 @@ void setDefaultValues() {
separateupdatefolder = false;
compatibilityData = false;
checkCompatibilityOnStartup = false;
audioBackend = "cubeb";
}

} // namespace Config
2 changes: 0 additions & 2 deletions src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bool getEnableDiscordRPC();
bool getSeparateUpdateEnabled();
bool getCompatibilityEnabled();
bool getCheckCompatibilityOnStartup();
std::string getAudioBackend();

std::string getLogFilter();
std::string getLogType();
Expand Down Expand Up @@ -76,7 +75,6 @@ void setSeparateUpdateEnabled(bool use);
void setGameInstallDirs(const std::vector<std::filesystem::path>& settings_install_dirs_config);
void setCompatibilityEnabled(bool use);
void setCheckCompatibilityOnStartup(bool use);
void setAudioBackend(std::string backend);

void setCursorState(s16 cursorState);
void setCursorHideTimeout(int newcursorHideTimeout);
Expand Down
Loading

0 comments on commit 48c51bd

Please sign in to comment.