AudioHardwareUtilities.h [plain text]
#ifndef __AUDIOHARDWAREUTILITIES__
#define __AUDIOHARDWAREUTILITIES__
#ifdef DEBUGLOG
#define debugIOLog( message ) \
{IOLog( message ); IOSleep(20);}
#define debug2IOLog( message, arg2 ) \
{IOLog( message, arg2 ); IOSleep(20);}
#define debug3IOLog( message, arg2, arg3 ) \
{IOLog( message, arg2, arg3 ); IOSleep(20);}
#define debug4IOLog( message, arg2, arg3, arg4 ) \
{IOLog( message, arg2, arg3, arg4 ); IOSleep(20);}
#define debug5IOLog( message, arg2, arg3, arg4, arg5 ) \
{IOLog( message, arg2, arg3, arg4, arg5 ); IOSleep(20);}
#define debug6IOLog( message, arg2, arg3, arg4, arg5, arg6 ) \
{IOLog( message, arg2, arg3, arg4, arg5, arg6 ); IOSleep(20);}
#define debug7IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7 ) \
{IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7 ); IOSleep(20);}
#define debug8IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) \
{IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ); IOSleep(20);}
#define debug9IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) \
{IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ); IOSleep(20);}
#else
#define debugIOLog( message ) ;
#define debug2IOLog( message, arg2 ) ;
#define debug3IOLog( message, arg2, arg3 ) ;
#define debug4IOLog( message, arg2, arg3, arg4 ) ;
#define debug5IOLog( message, arg2, arg3, arg4, arg5 ) ;
#define debug6IOLog( message, arg2, arg3, arg4, arg5, arg6 ) ;
#define debug7IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7 ) ;
#define debug8IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) ;
#define debug9IOLog( message, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) ;
#endif
#define DEBUG_IOLOG debugIOLog
#define DEBUG2_IOLOG debug2IOLog
#define DEBUG3_IOLOG debug3IOLog
#ifdef DEBUGLOG
#define CLOG( stuff ) IOLog( stuff )
#else
#define CLOG( stuff ) ;
#endif
#define NEXTENDOFSTRING(bytes, idx) while('\0' != bytes[idx]) idx++;
#define ASSIGNSTARTSTRING(startidx, parser) startidx = ++parser;
#define ASSIGNSTOPSTRING(stopidx, parser) stopidx = parser+1;
#define NEXTENDOFWORD(bytes, idx) while(' ' != bytes[idx]) idx++;
#define ASSIGNNEXTWORD(bytes, startidx, stopidx) do {stopidx++; startidx = stopidx;}\
while((bytes[stopidx -1] == ' ') && (bytes[stopidx] == ' '))
#define READWORDASNUMBER(result, bytesPtr, startidx, stopidx) \
bytesPtr[stopidx] = '\0'; result = getStringAsNumber(bytesPtr+startidx);bytesPtr[stopidx] = ' ';
#define CLEAN_RELEASE(thingPtr) if(thingPtr) {thingPtr->release(); thingPtr=0;}
#define SoundAssertionMessage( cond, file, line, handler ) \
"Sound assertion \"" #cond "\" failed in " #file " at line " #line " goto " #handler "\n"
#define SoundAssertionFailed( cond, file, line, handler ) \
IOLog( SoundAssertionMessage( cond, file, line, handler ));
#ifdef DEBUG
#define FailIf( cond, handler ) \
if( cond ){ \
SoundAssertionFailed( cond, __FILE__, __LINE__, handler ) \
goto handler; \
}
#else
#define FailIf( cond, handler ) \
if( cond ){ \
goto handler; \
}
#endif
#ifdef DEBUG
#define FAIL_IF( cond, handler ) \
if( cond ){ \
SoundAssertionFailed( cond, __FILE__, __LINE__, handler ) \
goto handler; \
}
#else
#define FAIL_IF( cond, handler ) \
if( cond ){ \
goto handler; \
}
#endif
#ifdef DEBUG
#define FailWithAction( cond, action, handler ) \
if( cond ){ \
SoundAssertionFailed( cond, __FILE__, __LINE__, handler ) \
{ action; } \
goto handler; \
}
#else
#define FailWithAction( cond, action, handler ) \
if( cond ){ \
{ action; } \
goto handler; \
}
#endif
#ifdef DEBUG
#define FailMessage(cond) if (cond) SoundAssertionFailed(cond, __FILE__, __LINE__, handler)
#else
#define FailMessage(cond) {}
#endif
#endif //__AUDIOHARDWAREUTILITIES__