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

parent 88240f88
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_DEBUG
#define INCLUDE_WATCHER_ITA_DEBUG
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_LOG
#define INCLUDE_WATCHER_ITA_LOG
......
......@@ -40,7 +40,6 @@ public:
std::vector< float > GetMagnitudesCopy() const;
const std::vector< float >& GetMagnitudes() const;
const std::vector< float >& GetFrequencies() const;
void SetMagnitudes( const std::vector< float >& vfMagnitudes );
void SetMagnitude( const int iFrequencyBandIndex, const float fMagnitudeValue );
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_OPS
#define INCLUDE_WATCHER_ITA_OPS
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_SAMPLE_FRAME
#define INCLUDE_WATCHER_ITA_SAMPLE_FRAME
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION
#define INCLUDE_WATCHER_ITA_SIMPLE_CONVOLUTION
......
......@@ -3,12 +3,12 @@
#define _WIN32_WINNT 0x0500
#include <windows.h>
typedef union {
typedef union
{
LONG longValue;
float floatValue;
} ConvLongFloat;
//inline int atomic_read_int(volatile const int* src) {
int atomic_read_int( volatile const int* src )
{
/*
......
This diff is collapsed.
......@@ -11,8 +11,10 @@
static ITAClock* pDefaultClock = NULL;
ITAClock* ITAClock::getDefaultClock() {
if (!pDefaultClock) {
ITAClock* ITAClock::getDefaultClock()
{
if( !pDefaultClock )
{
#ifdef WIN32
// Standard auf Windows-Systemen: Windows Performance Counters
pDefaultClock = ITAWinPCClock::getInstance();
......@@ -22,7 +24,7 @@ ITAClock* ITAClock::getDefaultClock() {
pDefaultClock = ITAPosixRealtimeClock::getInstance();
#endif
// 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;
......
This diff is collapsed.
......@@ -11,19 +11,20 @@
// Lock fr den Puffer in den Ausgabe-Routinen
static ITACriticalSection g_csDebugPrintf;
static char g_pszDebugPrintfBuf[16384];
static char g_pszDebugPrintfBuf[ 16384 ];
#ifdef _DEBUG
void DEBUG_PRINTF(const char * format, ... ) {
void DEBUG_PRINTF( const char * format, ... )
{
g_csDebugPrintf.enter();
va_list args;
va_start(args, format);
vsprintf_s(g_pszDebugPrintfBuf, DEBUG_PRINTF_BUFSIZE, format, args);
va_end(args);
va_start( args, format );
vsprintf_s( g_pszDebugPrintfBuf, DEBUG_PRINTF_BUFSIZE, format, args );
va_end( args );
OutputDebugStringA(g_pszDebugPrintfBuf);
OutputDebugStringA( g_pszDebugPrintfBuf );
g_csDebugPrintf.leave();
}
......@@ -56,17 +57,18 @@ typedef struct tagTHREADNAME_INFO {
DWORD dwFlags; // reserved for future use, must be zero
} THREADNAME_INFO;
void SetThreadName(long lThreadID, const char* szThreadName) {
void SetThreadName( long lThreadID, const char* szThreadName ) {
THREADNAME_INFO info;
{
info.dwType = 0x1000;
info.szName = szThreadName;
info.dwThreadID = (DWORD) lThreadID;
info.dwThreadID = ( DWORD ) lThreadID;
info.dwFlags = 0;
}
__try {
RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD), (ULONG_PTR*) &info );
} __except (EXCEPTION_CONTINUE_EXECUTION) {}
RaiseException( 0x406D1388, 0, sizeof( info ) / sizeof( DWORD ), ( ULONG_PTR* ) &info );
}
__except( EXCEPTION_CONTINUE_EXECUTION ) {}
}
#endif // Win32
......
......@@ -2,25 +2,25 @@
static int iEndianness = -1;
void byteswap_2byte(void*, size_t);
void byteswap_4byte(void*, size_t);
void byteswap_8byte(void*, size_t);
void byteswap_16byte(void*, size_t);
void noswap(void*,size_t);
void (*le2se_2byte)(void* src, size_t count);
void (*le2se_4byte)(void* src, size_t count);
void (*le2se_8byte)(void* src, size_t count);
void (*le2se_16byte)(void* src, size_t count);
void (*be2se_2byte)(void* src, size_t count);
void (*be2se_4byte)(void* src, size_t count);
void (*be2se_8byte)(void* src, size_t count);
void (*be2se_16byte)(void* src, size_t count);
void byteswap_2byte( void*, size_t );
void byteswap_4byte( void*, size_t );
void byteswap_8byte( void*, size_t );
void byteswap_16byte( void*, size_t );
void noswap( void*, size_t );
void( *le2se_2byte )( void* src, size_t count );
void( *le2se_4byte )( void* src, size_t count );
void( *le2se_8byte )( void* src, size_t count );
void( *le2se_16byte )( void* src, size_t count );
void( *be2se_2byte )( void* src, size_t count );
void( *be2se_4byte )( void* src, size_t count );
void( *be2se_8byte )( void* src, size_t count );
void( *be2se_16byte )( void* src, size_t count );
void Init()
{
char test[2] = {1, 0};
if ( *((short*) test) == 1) {
char test[ 2 ] = { 1, 0 };
if( *( ( short* ) test ) == 1 ) {
// Little endian - small value byte at beginning
iEndianness = ITA_LITTLE_ENDIAN;
......@@ -33,7 +33,8 @@ void Init()
be2se_4byte = &byteswap_4byte;
be2se_8byte = &byteswap_8byte;
be2se_16byte = &byteswap_16byte;
} else {
}
else {
// Big endian
iEndianness = ITA_BIG_ENDIAN;
......@@ -51,7 +52,7 @@ void Init()
int GetEndianness()
{
if (iEndianness == -1)
if( iEndianness == -1 )
Init();
return iEndianness;
}
......@@ -62,72 +63,72 @@ int GetEndianness()
p[i] = p[j]; \
p[j] = h;
void byteswap_2byte(void* src, size_t count) {
void byteswap_2byte( void* src, size_t count ) {
// In: | B1 | B0 |
// Out: | B0 | B1 |
char* p = (char*) src;
char* p = ( char* ) src;
char h;
for (size_t i=0; i<count; i++) {
TRI_SWAP(0, 1);
for( size_t i = 0; i < count; i++ ) {
TRI_SWAP( 0, 1 );
p = p + 2;
}
}
void byteswap_4byte(void* src, size_t count) {
void byteswap_4byte( void* src, size_t count ) {
// In: | B3 | B2 | B1 | B0 |
// Out: | B0 | B1 | B2 | B3 |
char* p = (char*) src;
char* p = ( char* ) src;
char h;
for (size_t i=0; i<count; i++) {
TRI_SWAP(0, 3);
TRI_SWAP(1, 2);
for( size_t i = 0; i < count; i++ ) {
TRI_SWAP( 0, 3 );
TRI_SWAP( 1, 2 );
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 |
// Out: | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 |
char* p = (char*) src;
char* p = ( char* ) src;
char h;
for (size_t i=0; i<count; i++) {
TRI_SWAP(0, 7);
TRI_SWAP(1, 6);
TRI_SWAP(2, 5);
TRI_SWAP(3, 4);
for( size_t i = 0; i < count; i++ ) {
TRI_SWAP( 0, 7 );
TRI_SWAP( 1, 6 );
TRI_SWAP( 2, 5 );
TRI_SWAP( 3, 4 );
p = p + 8;
}
}
void byteswap_16byte(void* src, size_t count) {
char* p = (char*) src;
void byteswap_16byte( void* src, size_t count ) {
char* p = ( char* ) src;
char h;
for (size_t i=0; i<count; i++) {
TRI_SWAP(0, 15);
TRI_SWAP(1, 14);
TRI_SWAP(2, 13);
TRI_SWAP(3, 12);
TRI_SWAP(4, 11);
TRI_SWAP(5, 10);
TRI_SWAP(6, 9);
TRI_SWAP(7, 8);
for( size_t i = 0; i < count; i++ ) {
TRI_SWAP( 0, 15 );
TRI_SWAP( 1, 14 );
TRI_SWAP( 2, 13 );
TRI_SWAP( 3, 12 );
TRI_SWAP( 4, 11 );
TRI_SWAP( 5, 10 );
TRI_SWAP( 6, 9 );
TRI_SWAP( 7, 8 );
p = p + 16;
}
}
// Dummy
void noswap(void*,size_t) {}
void noswap( void*, size_t ) {}
......@@ -4,14 +4,14 @@
#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 iFadeDirection = iFadeFlags & 1;
......@@ -19,70 +19,71 @@ void Fade(float* pfData, int iFadeLength, int iFadeFlags, int iOffset, int iLeng
const float halfPi = 1.5707963267948966192f;
float alpha;
switch (iFadeFunction) {
switch( iFadeFunction ) {
case ITA_FADE_LINEAR:
alpha = 1 / (float) iFadeLength;
if (iFadeDirection == ITA_FADE_IN) {
alpha = 1 / ( float ) iFadeLength;
if( iFadeDirection == ITA_FADE_IN ) {
// Einblenden
for (int i=0; i<iLength; i++) {
for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) < 0)
pfData[i] = 0;
if( ( i + iOffset ) < 0 )
pfData[ i ] = 0;
else
if ((i+iOffset) < iFadeLength)
pfData[i] *= alpha * (float) (i+iOffset);
if( ( i + iOffset ) < iFadeLength )
pfData[ i ] *= alpha * ( float ) ( i + iOffset );
}
} else {
}
else {
// Ausblenden
for (int i=0; i<iLength; i++) {
for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) >= iFadeLength)
pfData[i] = 0;
if( ( i + iOffset ) >= iFadeLength )
pfData[ i ] = 0;
else
if ((i+iOffset) >= 0)
pfData[i] *= 1 - (alpha * (float) (i+iOffset));
if( ( i + iOffset ) >= 0 )
pfData[ i ] *= 1 - ( alpha * ( float ) ( i + iOffset ) );
}
}
break;
case ITA_FADE_COSINE_SQUARE:
alpha = halfPi / (float) iFadeLength;
alpha = halfPi / ( float ) iFadeLength;
if (iFadeDirection == ITA_FADE_IN)
for (int i=0; i<iLength; i++) {
if( iFadeDirection == ITA_FADE_IN )
for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) < 0)
pfData[i] = 0;
if( ( i + iOffset ) < 0 )
pfData[ i ] = 0;
else
if ((i+iOffset) < iFadeLength) {
float c = cos(alpha * (float) (i+iOffset));
float csq = (float) (c*c);
pfData[i] *= (1-csq);
if( ( i + iOffset ) < iFadeLength ) {
float c = cos( alpha * ( float ) ( i + iOffset ) );
float csq = ( float ) ( c*c );
pfData[ i ] *= ( 1 - csq );
}
}
else
for (int i=0; i<iLength; i++) {
for( int i = 0; i < iLength; i++ ) {
// Saubere Werte vor bzw. hinter der Blendphase
if ((i+iOffset) >= iFadeLength)
pfData[i] = 0;
if( ( i + iOffset ) >= iFadeLength )
pfData[ i ] = 0;
else
if ((i+iOffset) >= 0) {
float c = cos(alpha * (float) (i+iOffset));
float csq = (float) (c*c);
pfData[i] *= csq;
if( ( i + iOffset ) >= 0 ) {
float c = cos( alpha * ( float ) ( i + iOffset ) );
float csq = ( float ) ( c*c );
pfData[ i ] *= csq;
}
}
break;
default:
ITA_EXCEPT1(INVALID_PARAMETER, "Invalid flags");
ITA_EXCEPT1( INVALID_PARAMETER, "Invalid flags" );
}
}
void Crossfade(const float* pfSrc1, const float* pfSrc2, float* pfDest, int iFadeLength, int iFadeFlags) {
if (iFadeLength == 0) return;
void Crossfade( const float* pfSrc1, const float* pfSrc2, float* pfDest, int iFadeLength, int iFadeFlags ) {
if( iFadeLength == 0 ) return;
int iFadeFunction = iFadeFlags & 6;
int iFadeDirection = iFadeFlags & 1;
......@@ -90,30 +91,30 @@ void Crossfade(const float* pfSrc1, const float* pfSrc2, float* pfDest, int iFad
const float halfPi = 1.5707963267948966192f;
float alpha;
switch (iFadeFunction) {
switch( iFadeFunction ) {
case ITA_FADE_LINEAR:
alpha = 1 / (float) iFadeLength;
alpha = 1 / ( float ) iFadeLength;
for (int i=0; i<iFadeLength; i++) {
for( int i = 0; i < iFadeLength; i++ ) {
float c = alpha*i;
pfDest[i] = (1-c)*pfSrc1[i] + c*pfSrc2[i];
pfDest[ i ] = ( 1 - c )*pfSrc1[ i ] + c*pfSrc2[ i ];
}
break;
case ITA_FADE_COSINE_SQUARE:
alpha = halfPi / (float) iFadeLength;
alpha = halfPi / ( float ) iFadeLength;
for (int i=0; i<iFadeLength; i++) {
float c = cos(alpha * (float) i);
float csq = (float) (c*c);
pfDest[i] = csq*pfSrc1[i] + (1-csq)*pfSrc2[i];
for( int i = 0; i < iFadeLength; i++ ) {
float c = cos( alpha * ( float ) i );
float csq = ( float ) ( c*c );
pfDest[ i ] = csq*pfSrc1[ i ] + ( 1 - csq )*pfSrc2[ i ];
}
break;
default:
ITA_EXCEPT1(INVALID_PARAMETER, "Invalid flags");
ITA_EXCEPT1( INVALID_PARAMETER, "Invalid flags" );
}
}
This diff is collapsed.
......@@ -6,150 +6,155 @@
#include <sys/stat.h>
bool doesPathExist(const std::string& sPath) {
bool doesPathExist( const std::string& sPath )
{
// Inspiration by FOX
#if !defined(WIN32) && !defined(PLATFORM_X64)
struct stat status;
return !sPath.empty() && (::stat(sPath.c_str(), &status)==0);
return !sPath.empty() && ( ::stat( sPath.c_str(), &status ) == 0 );
#else
return !sPath.empty() && (GetFileAttributesA(sPath.c_str()) != 0xFFFFFFFF);
return !sPath.empty() && ( GetFileAttributesA( sPath.c_str() ) != 0xFFFFFFFF );
#endif
}
bool doesFileExist(const std::string& sPath) {
return doesPathExist(sPath) && isFile(sPath);
bool doesFileExist( const std::string& sPath )
{
return doesPathExist( sPath ) && isFile( sPath );
}
bool doesDirectoryExist(const std::string& sPath) {
return doesPathExist(sPath) && isDirectory(sPath);