- handled the final piece where Timidity++ had a direct dependency on GZDoom - the error logging function.

This is npw a function pointer so that a simple stdout printout can be used as default, but allows to override it.
Also added the missing timidity_file.h header.
This commit is contained in:
Christoph Oelckers 2019-09-23 14:14:32 +02:00
commit 56e4c8f213
5 changed files with 200 additions and 29 deletions

View file

@ -27,6 +27,7 @@
#include <string.h>
#include <ctype.h>
#include "common.h"
#include "controls.h"
namespace TimidityPlus
{
@ -151,5 +152,31 @@ int tf_getc(struct timidity_file *tf)
return read == 0 ? EOF : c;
}
void default_ctl_cmsg(int type, int verbosity_level, const char* fmt, ...)
{
if (verbosity_level >= VERB_DEBUG) return; // Don't waste time on diagnostics.
char buffer[2048];
va_list args;
va_start(args, fmt);
switch (type)
{
case CMSG_ERROR:
vprintf("Error: %s\n", args);
break;
case CMSG_WARNING:
vprintf("Warning: %s\n", args);
break;
case CMSG_INFO:
vprintf("Info: %s\n", args);
break;
}
}
// Allow hosting applications to capture the messages and deal with them themselves.
void (*ctl_cmsg)(int type, int verbosity_level, const char* fmt, ...) = default_ctl_cmsg;
}