mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Add Cubeb log callback (#16510)
Co-authored-by: Elad <18193363+elad335@users.noreply.github.com>
This commit is contained in:
parent
b63140b423
commit
26df3a8452
2 changed files with 16 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "Emu/Audio/Cubeb/CubebBackend.h"
|
#include "Emu/Audio/Cubeb/CubebBackend.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstdarg>
|
||||||
#include "util/logs.hpp"
|
#include "util/logs.hpp"
|
||||||
#include "Emu/Audio/audio_device_enumerator.h"
|
#include "Emu/Audio/audio_device_enumerator.h"
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ CubebBackend::CubebBackend()
|
||||||
m_dev_collection_cb_enabled = true;
|
m_dev_collection_cb_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cubeb_set_log_callback(CUBEB_LOG_NORMAL, log_cb);
|
||||||
|
|
||||||
Cubeb.notice("Using backend %s", cubeb_get_backend_id(ctx));
|
Cubeb.notice("Using backend %s", cubeb_get_backend_id(ctx));
|
||||||
|
|
||||||
std::lock_guard cb_lock{m_state_cb_mutex};
|
std::lock_guard cb_lock{m_state_cb_mutex};
|
||||||
|
@ -568,3 +571,15 @@ void CubebBackend::device_collection_changed_cb(cubeb* context, void* user_ptr)
|
||||||
cubeb->m_state_callback(AudioStateEvent::DEFAULT_DEVICE_MAYBE_CHANGED);
|
cubeb->m_state_callback(AudioStateEvent::DEFAULT_DEVICE_MAYBE_CHANGED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CubebBackend::log_cb(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
char buf[256]{};
|
||||||
|
|
||||||
|
va_list va;
|
||||||
|
va_start(va, fmt);
|
||||||
|
vsnprintf(buf, sizeof(buf) - 1, fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
|
Cubeb.notice("Cubeb log: %s", buf);
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ private:
|
||||||
static long data_cb(cubeb_stream* stream, void* user_ptr, void const* input_buffer, void* output_buffer, long nframes);
|
static long data_cb(cubeb_stream* stream, void* user_ptr, void const* input_buffer, void* output_buffer, long nframes);
|
||||||
static void state_cb(cubeb_stream* stream, void* user_ptr, cubeb_state state);
|
static void state_cb(cubeb_stream* stream, void* user_ptr, cubeb_state state);
|
||||||
static void device_collection_changed_cb(cubeb* context, void* user_ptr);
|
static void device_collection_changed_cb(cubeb* context, void* user_ptr);
|
||||||
|
static void log_cb(const char *fmt, ...);
|
||||||
|
|
||||||
struct device_handle
|
struct device_handle
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue