Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting optional logging to user-provided callback. #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Supporting optional logging to user-provided callback.
Some users might want to redirect this, or reconcile it with logging from
other subsystems in a single sink.
sherief committed Mar 16, 2025
commit a66e1f92c2626fc335d7a2e0f7f1df4c75fb0e3d
2 changes: 2 additions & 0 deletions include/FAudio.h
Original file line number Diff line number Diff line change
@@ -316,6 +316,8 @@ typedef struct FAudioDebugConfiguration
int32_t LogFileline;
int32_t LogFunctionName;
int32_t LogTiming;
void (*LogCallback)(const char* msg, void* userData);
void* LogUserData;
} FAudioDebugConfiguration;

#pragma pack(pop)
9 changes: 8 additions & 1 deletion src/FAudio_internal.c
Original file line number Diff line number Diff line change
@@ -90,7 +90,14 @@ void FAudio_INTERNAL_debug(
va_end(va);

/* Print, finally. */
FAudio_Log(output);
if (audio->debug.LogCallback)
{
audio->debug.LogCallback(output, audio->debug.LogUserData);
}
else
{
FAudio_Log(output);
}
}

static const char *get_wformattag_string(const FAudioWaveFormatEx *fmt)