ReactOS 0.4.15-dev-7961-gdcf9eb0
mmebuddy_debug.h
Go to the documentation of this file.
1#ifndef ROS_AUDIO_MMEBUDDY_DEBUG_H
2#define ROS_AUDIO_MMEBUDDY_DEBUG_H
3
4/*
5 Hacky debug macro
6*/
7
8#define POPUP(...) \
9 { \
10 WCHAR dbg_popup_msg[1024], dbg_popup_title[256]; \
11 wsprintf(dbg_popup_title, L"%hS(%d)", __FILE__, __LINE__); \
12 wsprintf(dbg_popup_msg, __VA_ARGS__); \
13 MessageBox(0, dbg_popup_msg, dbg_popup_title, MB_OK | MB_TASKMODAL); \
14 }
15
16#ifndef NDEBUG
17 #define SND_ERR(...) \
18 { \
19 WCHAR dbg_popup_msg[1024]; \
20 wsprintf(dbg_popup_msg, __VA_ARGS__); \
21 OutputDebugString(dbg_popup_msg); \
22 }
23 #define SND_WARN(...) \
24 { \
25 WCHAR dbg_popup_msg[1024]; \
26 wsprintf(dbg_popup_msg, __VA_ARGS__); \
27 OutputDebugString(dbg_popup_msg); \
28 }
29 #define SND_TRACE(...) \
30 { \
31 WCHAR dbg_popup_msg[1024]; \
32 wsprintf(dbg_popup_msg, __VA_ARGS__); \
33 OutputDebugString(dbg_popup_msg); \
34 }
35
36 #define SND_ASSERT(condition) \
37 { \
38 if ( ! ( condition ) ) \
39 { \
40 SND_ERR(L"ASSERT FAILED: %hS File %hS Line %u\n", #condition, __FILE__, __LINE__); \
41 POPUP(L"ASSERT FAILED: %hS\n", #condition); \
42 ExitProcess(1); \
43 } \
44 }
45
46 #define DUMP_WAVEHDR_QUEUE(sound_device_instance) \
47 { \
48 PWAVEHDR CurrDumpHdr = sound_device_instance->HeadWaveHeader; \
49 SND_TRACE(L"-- Current wave header list --\n"); \
50 while ( CurrDumpHdr ) \
51 { \
52 SND_TRACE(L"%x | %d bytes | flags: %x\n", CurrDumpHdr, \
53 CurrDumpHdr->dwBufferLength, \
54 CurrDumpHdr->dwFlags); \
55 CurrDumpHdr = CurrDumpHdr->lpNext; \
56 } \
57 }
58
59#else
60 #define SND_ERR(...) do {} while ( 0 )
61 #define SND_WARN(...) do {} while ( 0 )
62 #define SND_TRACE(...) do {} while ( 0 )
63 #define SND_ASSERT(condition) do {(void)(condition);} while ( 0 )
64 #define DUMP_WAVEHDR_QUEUE(condition) do {} while ( 0 )
65#endif
66
67#endif /* ROS_AUDIO_MMEBUDDY_DEBUG_H */