AudRecordLib
stdafx.h
Go to the documentation of this file.
00001 
00006 #ifndef STDAFX_H
00007 #define STDAFX_H
00008 
00009 #pragma once
00010 
00011 #define WIN32_LEAN_AND_MEAN
00012 #define _WIN32_WINNT 0x0600
00013 #define _DO_NOT_DECLARE_INTERLOCKED_INTRINSICS_IN_MEMORY
00014 #define NOMINMAX
00015 
00016 #include "macroutils.h"
00017 #include <intrin.h>
00018 #include <windows.h>
00019 #include "scoped.h"
00020 #include <string>
00021 #include <vector>
00022 #include "ETWEvents.h"
00023 
00030 #define LOG_TEXT(Function, string, ...) \
00031         DISABLE_CONST_COND() \
00032         do \
00033         { \
00034                 C_ASSERT(sizeof(*string) == sizeof(char)); \
00035                 char buffer[300]; \
00036                 LogFormat(buffer, __FUNCTION__  " " string "\n", __VA_ARGS__); \
00037                 Function(__FILE__, __LINE__, __FUNCTION__, buffer + ARRAYSIZE(__FUNCTION__) + 1); \
00038                 OutputDebugStringA(buffer); \
00039         } \
00040         while(0); \
00041         END_DISABLE_CONST_COND()
00042 
00049 #define SEVERE_TEXT(string, ...) \
00050         LOG_TEXT(LogSevereEvent, string, __VA_ARGS__)
00051 
00056 #define DBG_TEXT(string, ...) \
00057         LOG_TEXT(LogDebugEvent, string, __VA_ARGS__)
00058 
00066 #define RETURN_ON_FAILED_EXP(exp) \
00067         { \
00068                 HRESULT hr = (exp); \
00069                 if(FAILED(hr)) \
00070                 { \
00071                         DBG_TEXT(#exp " failed with error %#08x", hr); \
00072                         return hr; \
00073                 } \
00074         }
00075 
00081 #define RETURN_ON_FAILED_EXP_VOID(exp) \
00082         { \
00083                 HRESULT hr = (exp); \
00084                 if(FAILED(hr)) \
00085                 { \
00086                         DBG_TEXT(#exp " failed with error %#08x", hr); \
00087                         return; \
00088                 } \
00089         }
00090 
00092 static const ULONGLONG REFTIMES_PER_SEC = 10000000ULL;
00094 static const ULONGLONG REFTIMES_PER_MILLISEC = 10000ULL;
00096 static const ULONGLONG AUDIO_BUFFER_DURATION = REFTIMES_PER_SEC;
00098 static const DWORD HALF_BUFFER_DURATION_IN_MILLISEC = AUDIO_BUFFER_DURATION / REFTIMES_PER_MILLISEC / 2;
00099 
00103 void* __cdecl operator new(size_t bytes);
00107 void* __cdecl operator new[](size_t bytes);
00111 void __cdecl operator delete(void* ptr);
00115 void __cdecl operator delete[](void* ptr);
00116 
00119 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines