Adding new Vista test for IPNet, also a lot of style

parent 88240f88
/* /*
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2017
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
* // / //__ ___/ // _ | * // / //__ ___/ // _ |
* // / // / // /_| | * // / // / // /_| |
* // / // / // ___ | * // / // / // ___ |
* //__/ //__/ //__/ |__| * //__/ //__/ //__/ |__|
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
*/ */
#ifndef INCLUDE_WATCHER_ITA_DEBUG #ifndef INCLUDE_WATCHER_ITA_DEBUG
#define INCLUDE_WATCHER_ITA_DEBUG #define INCLUDE_WATCHER_ITA_DEBUG
......
/* /*
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2017
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
* // / //__ ___/ // _ | * // / //__ ___/ // _ |
* // / // / // /_| | * // / // / // /_| |
* // / // / // ___ | * // / // / // ___ |
* //__/ //__/ //__/ |__| * //__/ //__/ //__/ |__|
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
*/ */
#ifndef INCLUDE_WATCHER_ITA_LOG #ifndef INCLUDE_WATCHER_ITA_LOG
#define INCLUDE_WATCHER_ITA_LOG #define INCLUDE_WATCHER_ITA_LOG
......
...@@ -40,7 +40,6 @@ public: ...@@ -40,7 +40,6 @@ public:
std::vector< float > GetMagnitudesCopy() const; std::vector< float > GetMagnitudesCopy() const;
const std::vector< float >& GetMagnitudes() const; const std::vector< float >& GetMagnitudes() const;
const std::vector< float >& GetFrequencies() const;
void SetMagnitudes( const std::vector< float >& vfMagnitudes ); void SetMagnitudes( const std::vector< float >& vfMagnitudes );
void SetMagnitude( const int iFrequencyBandIndex, const float fMagnitudeValue ); void SetMagnitude( const int iFrequencyBandIndex, const float fMagnitudeValue );
......
/* /*
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2017
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
* // / //__ ___/ // _ | * // / //__ ___/ // _ |
* // / // / // /_| | * // / // / // /_| |
* // / // / // ___ | * // / // / // ___ |
* //__/ //__/ //__/ |__| * //__/ //__/ //__/ |__|
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
*/ */
#ifndef INCLUDE_WATCHER_ITA_OPS #ifndef INCLUDE_WATCHER_ITA_OPS
#define INCLUDE_WATCHER_ITA_OPS #define INCLUDE_WATCHER_ITA_OPS
......
/* /*
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2017
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
* // / //__ ___/ // _ | * // / //__ ___/ // _ |
* // / // / // /_| | * // / // / // /_| |
* // / // / // ___ | * // / // / // ___ |
* //__/ //__/ //__/ |__| * //__/ //__/ //__/ |__|
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
*/ */
#ifndef INCLUDE_WATCHER_ITA_SAMPLE_FRAME #ifndef INCLUDE_WATCHER_ITA_SAMPLE_FRAME
#define INCLUDE_WATCHER_ITA_SAMPLE_FRAME #define INCLUDE_WATCHER_ITA_SAMPLE_FRAME
......
/* /*
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
* ITA core libs * ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA) * (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017 * RWTH Aachen University, Germany, 2015-2017
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* ____ __________ _______ * ____ __________ _______
* // / //__ ___/ // _ | * // / //__ ___/ // _ |
* // / // / // /_| | * // / // / // /_| |
* // / // / // ___ | * // / // / // ___ |
* //__/ //__/ //__/ |__| * //__/ //__/ //__/ |__|
* *
* ---------------------------------------------------------------- * ----------------------------------------------------------------
* *
*/ */
#ifndef INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION #ifndef INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION
#define INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION #define INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#include <windows.h> #include <windows.h>
typedef union { typedef union
{
LONG longValue; LONG longValue;
float floatValue; float floatValue;
} ConvLongFloat; } ConvLongFloat;
//inline int atomic_read_int(volatile const int* src) {
int atomic_read_int( volatile const int* src ) int atomic_read_int( volatile const int* src )
{ {
/* /*
......
This diff is collapsed.
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
static ITAClock* pDefaultClock = NULL; static ITAClock* pDefaultClock = NULL;
ITAClock* ITAClock::getDefaultClock() { ITAClock* ITAClock::getDefaultClock()
if (!pDefaultClock) { {
if( !pDefaultClock )
{
#ifdef WIN32 #ifdef WIN32
// Standard auf Windows-Systemen: Windows Performance Counters // Standard auf Windows-Systemen: Windows Performance Counters
pDefaultClock = ITAWinPCClock::getInstance(); pDefaultClock = ITAWinPCClock::getInstance();
...@@ -22,7 +24,7 @@ ITAClock* ITAClock::getDefaultClock() { ...@@ -22,7 +24,7 @@ ITAClock* ITAClock::getDefaultClock() {
pDefaultClock = ITAPosixRealtimeClock::getInstance(); pDefaultClock = ITAPosixRealtimeClock::getInstance();
#endif #endif
// Kein Standard-Zeitgeber fr diese Plattform -> Ausnahme! // Kein Standard-Zeitgeber fr diese Plattform -> Ausnahme!
if (!pDefaultClock) ITA_EXCEPT1(NOT_IMPLEMENTED, "Could not create a default clock instance (activate HAVE_POSIX if available)"); if( !pDefaultClock ) ITA_EXCEPT1( NOT_IMPLEMENTED, "Could not create a default clock instance (activate HAVE_POSIX if available)" );
} }
return pDefaultClock; return pDefaultClock;
......
This diff is collapsed.
...@@ -11,19 +11,20 @@ ...@@ -11,19 +11,20 @@
// Lock fr den Puffer in den Ausgabe-Routinen // Lock fr den Puffer in den Ausgabe-Routinen
static ITACriticalSection g_csDebugPrintf; static ITACriticalSection g_csDebugPrintf;
static char g_pszDebugPrintfBuf[16384]; static char g_pszDebugPrintfBuf[ 16384 ];
#ifdef _DEBUG #ifdef _DEBUG
void DEBUG_PRINTF(const char * format, ... ) { void DEBUG_PRINTF( const char * format, ... )
{
g_csDebugPrintf.enter(); g_csDebugPrintf.enter();
va_list args; va_list args;
va_start(args, format); va_start( args, format );
vsprintf_s(g_pszDebugPrintfBuf, DEBUG_PRINTF_BUFSIZE, format, args); vsprintf_s( g_pszDebugPrintfBuf, DEBUG_PRINTF_BUFSIZE, format, args );
va_end(args); va_end( args );
OutputDebugStringA(g_pszDebugPrintfBuf); OutputDebugStringA( g_pszDebugPrintfBuf );
g_csDebugPrintf.leave(); g_csDebugPrintf.leave();
} }
...@@ -50,23 +51,24 @@ void DEBUG_PRINTF(const char * format, ... ) { ...@@ -50,23 +51,24 @@ void DEBUG_PRINTF(const char * format, ... ) {
*/ */
typedef struct tagTHREADNAME_INFO { typedef struct tagTHREADNAME_INFO {
DWORD dwType; // must be 0x1000 DWORD dwType; // must be 0x1000
LPCSTR szName; // pointer to name (in user addr space) LPCSTR szName; // pointer to name (in user addr space)
DWORD dwThreadID; // thread ID (-1=caller thread) DWORD dwThreadID; // thread ID (-1=caller thread)
DWORD dwFlags; // reserved for future use, must be zero DWORD dwFlags; // reserved for future use, must be zero
} THREADNAME_INFO; } THREADNAME_INFO;
void SetThreadName(long lThreadID, const char* szThreadName) { void SetThreadName( long lThreadID, const char* szThreadName ) {
THREADNAME_INFO info; THREADNAME_INFO info;
{ {
info.dwType = 0x1000; info.dwType = 0x1000;
info.szName = szThreadName; info.szName = szThreadName;
info.dwThreadID = (DWORD) lThreadID; info.dwThreadID = ( DWORD ) lThreadID;
info.dwFlags = 0; info.dwFlags = 0;
} }
__try { __try {
RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD), (ULONG_PTR*) &info ); RaiseException( 0x406D1388, 0, sizeof( info ) / sizeof( DWORD ), ( ULONG_PTR* ) &info );
} __except (EXCEPTION_CONTINUE_EXECUTION) {} }
__except( EXCEPTION_CONTINUE_EXECUTION ) {}
} }
#endif // Win32 #endif // Win32
......
...@@ -2,56 +2,57 @@ ...@@ -2,56 +2,57 @@
static int iEndianness = -1; static int iEndianness = -1;
void byteswap_2byte(void*, size_t); void byteswap_2byte( void*, size_t );
void byteswap_4byte(void*, size_t); void byteswap_4byte( void*, size_t );
void byteswap_8byte(void*, size_t); void byteswap_8byte( void*, size_t );
void byteswap_16byte(void*, size_t); void byteswap_16byte( void*, size_t );
void noswap(void*,size_t); void noswap( void*, size_t );
void (*le2se_2byte)(void* src, size_t count); void( *le2se_2byte )( void* src, size_t count );
void (*le2se_4byte)(void* src, size_t count); void( *le2se_4byte )( void* src, size_t count );
void (*le2se_8byte)(void* src, size_t count); void( *le2se_8byte )( void* src, size_t count );
void (*le2se_16byte)(void* src, size_t count); void( *le2se_16byte )( void* src, size_t count );
void (*be2se_2byte)(void* src, size_t count); void( *be2se_2byte )( void* src, size_t count );
void (*be2se_4byte)(void* src, size_t count); void( *be2se_4byte )( void* src, size_t count );
void (*be2se_8byte)(void* src, size_t count); void( *be2se_8byte )( void* src, size_t count );
void (*be2se_16byte)(void* src, size_t count); void( *be2se_16byte )( void* src, size_t count );
void Init() void Init()
{ {
char test[2] = {1, 0}; char test[ 2 ] = { 1, 0 };
if ( *((short*) test) == 1) { if( *( ( short* ) test ) == 1 ) {
// Little endian - small value byte at beginning // Little endian - small value byte at beginning
iEndianness = ITA_LITTLE_ENDIAN; iEndianness = ITA_LITTLE_ENDIAN;
le2se_2byte = &noswap; le2se_2byte = &noswap;
le2se_4byte = &noswap; le2se_4byte = &noswap;
le2se_8byte = &noswap; le2se_8byte = &noswap;
le2se_16byte = &noswap; le2se_16byte = &noswap;
be2se_2byte = &byteswap_2byte; be2se_2byte = &byteswap_2byte;
be2se_4byte = &byteswap_4byte; be2se_4byte = &byteswap_4byte;
be2se_8byte = &byteswap_8byte; be2se_8byte = &byteswap_8byte;
be2se_16byte = &byteswap_16byte; be2se_16byte = &byteswap_16byte;
} else { }
else {
// Big endian // Big endian
iEndianness = ITA_BIG_ENDIAN; iEndianness = ITA_BIG_ENDIAN;
le2se_2byte = &byteswap_2byte; le2se_2byte = &byteswap_2byte;
le2se_4byte = &byteswap_4byte; le2se_4byte = &byteswap_4byte;
le2se_8byte = &byteswap_8byte; le2se_8byte = &byteswap_8byte;
le2se_16byte = &byteswap_16byte; le2se_16byte = &byteswap_16byte;
be2se_2byte = &noswap; be2se_2byte = &noswap;
be2se_4byte = &noswap; be2se_4byte = &noswap;
be2se_8byte = &noswap; be2se_8byte = &noswap;
be2se_16byte = &noswap; be2se_16byte = &noswap;
} }
} }
int GetEndianness() int GetEndianness()
{ {
if (iEndianness == -1) if( iEndianness == -1 )
Init(); Init();
return iEndianness; return iEndianness;
} }
...@@ -62,72 +63,72 @@ int GetEndianness() ...@@ -62,72 +63,72 @@ int GetEndianness()
p[i] = p[j]; \ p[i] = p[j]; \
p[j] = h; p[j] = h;
void byteswap_2byte(void* src, size_t count) { void byteswap_2byte( void* src, size_t count ) {
// In: | B1 | B0 | // In: | B1 | B0 |
// Out: | B0 | B1 | // Out: | B0 | B1 |
char* p = (char*) src; char* p = ( char* ) src;
char h; char h;
for (size_t i=0; i<count; i++) { for( size_t i = 0; i < count; i++ ) {
TRI_SWAP(0, 1); TRI_SWAP( 0, 1 );
p = p + 2; p = p + 2;
} }
} }
void byteswap_4byte(void* src, size_t count) { void byteswap_4byte( void* src, size_t count ) {
// In: | B3 | B2 | B1 | B0 | // In: | B3 | B2 | B1 | B0 |
// Out: | B0 | B1 | B2 | B3 | // Out: | B0 | B1 | B2 | B3 |
char* p = (char*) src; char* p = ( char* ) src;
char h; char h;
for (size_t i=0; i<count; i++) { for( size_t i = 0; i < count; i++ ) {
TRI_SWAP(0, 3); TRI_SWAP( 0, 3 );
TRI_SWAP(1, 2); TRI_SWAP( 1, 2 );
p = p + 4; p = p + 4;
} }
} }
void byteswap_8byte(void* src, size_t count) { void byteswap_8byte( void* src, size_t count ) {
// In: | B7 | B6 | B5 | B4 | B3 | B2 | B1 | B0 | // In: | B7 | B6 | B5 | B4 | B3 | B2 | B1 | B0 |
// Out: | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | // Out: | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 |
char* p = (char*) src; char* p = ( char* ) src;
char h; char h;
for (size_t i=0; i<count; i++) { for( size_t i = 0; i < count; i++ ) {
TRI_SWAP(0, 7); TRI_SWAP( 0, 7 );
TRI_SWAP(1, 6); TRI_SWAP( 1, 6 );
TRI_SWAP(2, 5); TRI_SWAP( 2, 5 );
TRI_SWAP(3, 4); TRI_SWAP( 3, 4 );
p = p + 8; p = p + 8;
} }
} }
void byteswap_16byte(void* src, size_t count) { void byteswap_16byte( void* src, size_t count ) {
char* p = (char*) src; char* p = ( char* ) src;
char h; char h;
for (size_t i=0; i<count; i++) { for( size_t i = 0; i < count; i++ ) {
TRI_SWAP(0, 15); TRI_SWAP( 0, 15 );
TRI_SWAP(1, 14); TRI_SWAP( 1, 14 );
TRI_SWAP(2, 13); TRI_SWAP( 2, 13 );
TRI_SWAP(3, 12); TRI_SWAP( 3, 12 );
TRI_SWAP(4, 11); TRI_SWAP( 4, 11 );
TRI_SWAP(5, 10); TRI_SWAP( 5, 10 );
TRI_SWAP(6, 9); TRI_SWAP( 6, 9 );
TRI_SWAP(7, 8); TRI_SWAP( 7, 8 );
p = p + 16; p = p + 16;
} }
} }
// Dummy // Dummy
void noswap(void*,size_t) {} void noswap( void*, size_t ) {}
...@@ -27,12 +27,12 @@ std::string ITAException::ToString() const ...@@ -27,12 +27,12 @@ std::string ITAException::ToString() const
sError = "Unkown error"; sError = "Unkown error";
} }
if( sModule.empty() == false ) if( sModule.empty() == false )
sError += " in " + sModule; sError += " in " + sModule;
if( sReason.empty() == false ) if( sReason.empty() == false )
sError += ": " + sReason; sError += ": " + sReason;
return sError; return sError;
} }
......
...@@ -4,116 +4,117 @@ ...@@ -4,116 +4,117 @@
#include <cmath> #include <cmath>
void Fade(float* pfData, int iFadeLength, int iFadeFlags) void Fade( float* pfData, int iFadeLength, int iFadeFlags )
{ {
Fade(pfData, iFadeLength, iFadeFlags, 0, iFadeLength); Fade( pfData, iFadeLength, iFadeFlags, 0, iFadeLength );
} }
void Fade(float* pfData, int iFadeLength, int iFadeFlags, int iOffset, int iLength) void Fade( float* pfData, int iFadeLength, int iFadeFlags, int iOffset, int iLength )
{ {
if (iFadeLength == 0) return; if( iFadeLength == 0 ) return;
int iFadeFunction = iFadeFlags & 6; int iFadeFunction = iFadeFlags & 6;
int iFadeDirection = iFadeFlags & 1; int iFadeDirection = iFadeFlags & 1;
const float halfPi = 1.5707963267948966192f; const float halfPi = 1.5707963267948966192f;
float alpha; float alpha;
switch (iFadeFunction) { switch( iFadeFunction ) {
case ITA_FADE_LINEAR: case ITA_FADE_LINEAR:
alpha = 1 / (float) iFadeLength; alpha = 1 / ( float ) iFadeLength;
if (iFadeDirection == ITA_FADE_IN) { if( iFadeDirection == ITA_FADE_IN ) {
// Einblenden // Einblenden
for (int i=0; i<iLength; i++) { for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase // Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) < 0) if( ( i + iOffset ) < 0 )
pfData[i] = 0; pfData[ i ] = 0;
else else
if ((i+iOffset) < iFadeLength) if( ( i + iOffset ) < iFadeLength )
pfData[i] *= alpha * (float) (i+iOffset); pfData[ i ] *= alpha * ( float ) ( i + iOffset );
} }
} else { }
else {
// Ausblenden // Ausblenden
for (int i=0; i<iLength; i++) { for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase // Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) >= iFadeLength) if( ( i + iOffset ) >= iFadeLength )
pfData[i] = 0; pfData[ i ] = 0;
else else
if ((i+iOffset) >= 0) if( ( i + iOffset ) >= 0 )
pfData[i] *= 1 - (alpha * (float) (i+iOffset)); pfData[ i ] *= 1 - ( alpha * ( float ) ( i + iOffset ) );
} }
} }
break; break;
case ITA_FADE_COSINE_SQUARE: case ITA_FADE_COSINE_SQUARE:
alpha = halfPi / (float) iFadeLength; alpha = halfPi / ( float ) iFadeLength;
if (iFadeDirection == ITA_FADE_IN) if( iFadeDirection == ITA_FADE_IN )
for (int i=0; i<iLength; i++) { for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase // Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) < 0) if( ( i + iOffset ) < 0 )
pfData[i] = 0; pfData[ i ] = 0;
else else
if ((i+iOffset) < iFadeLength) { if( ( i + iOffset ) < iFadeLength ) {
float c = cos(alpha * (float) (i+iOffset)); float c = cos( alpha * ( float ) ( i + iOffset ) );