Skip to content

Commit

Permalink
Add Cubeb log callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Vestrel committed Jan 5, 2025
1 parent c9d39ce commit 8bfb211
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rpcs3/Emu/Audio/Cubeb/CubebBackend.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Emu/Audio/Cubeb/CubebBackend.h"

#include <algorithm>
#include <cstdarg>
#include "util/logs.hpp"
#include "Emu/Audio/audio_device_enumerator.h"

Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit 8bfb211

Please sign in to comment.