From 8bfb211a2b2bd59be6d6b51bd269f07ec29d4241 Mon Sep 17 00:00:00 2001 From: Vestral <16190165+Vestrel@users.noreply.github.com> Date: Sun, 5 Jan 2025 08:21:26 +0900 Subject: [PATCH] Add Cubeb log callback --- rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp b/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp index 750e8f0ccd88..9fdd26df9a66 100644 --- a/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp +++ b/rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp @@ -1,6 +1,7 @@ #include "Emu/Audio/Cubeb/CubebBackend.h" #include +#include #include "util/logs.hpp" #include "Emu/Audio/audio_device_enumerator.h" @@ -38,6 +39,17 @@ CubebBackend::CubebBackend() m_dev_collection_cb_enabled = true; } + cubeb_set_log_callback(CUBEB_LOG_NORMAL, [](const char *fmt, ...) { + char buf[256] = "Cubeb log msg: "; + static constexpr size_t prefix_size = sizeof("Cubeb log msg: ") - 1; + + va_list va; + va_start(va, fmt); + vsnprintf(buf + prefix_size, sizeof(buf) - prefix_size, fmt, va); + va_end(va); + Cubeb.notice(buf); + }); + Cubeb.notice("Using backend %s", cubeb_get_backend_id(ctx)); std::lock_guard cb_lock{m_state_cb_mutex};