diff options
author | Chris Robinson <[email protected]> | 2007-11-30 00:28:34 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2007-11-30 00:28:34 -0800 |
commit | ab34e7c613aad78e193ba6f8a4d5631f1ba6a613 (patch) | |
tree | b50af3eed21b778be4599f5cd90b4c96ffb2616c /OpenAL32 | |
parent | aea161d98774d1281df02ae6231348890c5a0f3f (diff) |
Use an AL_PRINT macro for printing lib messages/errors to the console
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 13 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 8 |
2 files changed, 14 insertions, 7 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 3d34cf38..9957a741 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -62,6 +62,19 @@ extern "C" { #endif +extern char szDebug[256]; + +#define AL_PRINT(...) do { \ + int _al_print_i; \ + char *_al_print_fn = strrchr(__FILE__, '/'); \ + if(!_al_print_fn) _al_print_fn = __FILE__; \ + else _al_print_fn += 1; \ + _al_print_i = snprintf(szDebug, sizeof(szDebug), "AL lib: %s:%d: ", _al_print_fn, __LINE__); \ + snprintf(szDebug+_al_print_i, sizeof(szDebug)-_al_print_i, __VA_ARGS__); \ + fprintf(stderr, "%s", szDebug); \ +} while(0) + + #define AL_FORMAT_MONO_IMA4 0x1300 #define AL_FORMAT_STEREO_IMA4 0x1301 // These are from AL_EXT_MCFORMATS, which we don't support yet but the mixer diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 53ee128a..972c4ece 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -28,9 +28,6 @@ #include "alError.h" #include "alBuffer.h" -#ifdef _DEBUG - char szDebug[256]; -#endif /* * AL Buffer Functions @@ -966,10 +963,7 @@ ALvoid ReleaseALBuffers(ALvoid) #ifdef _DEBUG if(g_uiBufferCount > 0) - { - sprintf(szDebug, "OpenAL32 : DllMain() %d Buffer(s) NOT deleted\n", g_uiBufferCount); - OutputDebugString(szDebug); - } + AL_PRINT("exit() %d Buffer(s) NOT deleted\n", g_uiBufferCount); #endif ALBuffer = g_pBuffers; |