some file writing issues, some other fixes
This commit is contained in:
parent
6b39825665
commit
ccc664a084
6 changed files with 51 additions and 45 deletions
|
@ -210,7 +210,7 @@ void CClient::run()
|
||||||
|
|
||||||
|
|
||||||
// TEST
|
// TEST
|
||||||
Sleep(300);
|
//Sleep(300);
|
||||||
|
|
||||||
|
|
||||||
// copy data from one stereo buffer in two separate buffers
|
// copy data from one stereo buffer in two separate buffers
|
||||||
|
|
|
@ -109,7 +109,7 @@ void CLlconServerDlg::OnTimer()
|
||||||
{
|
{
|
||||||
// IP, port number
|
// IP, port number
|
||||||
vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d",
|
vecpListViewItems[i]->setText ( 0, QString().sprintf ( "%s : %d",
|
||||||
vecHostAddresses[i].InetAddr.toString().toStdString(),
|
vecHostAddresses[i].InetAddr.toString(),
|
||||||
vecHostAddresses[i].iPort ) /* IP, port */);
|
vecHostAddresses[i].iPort ) /* IP, port */);
|
||||||
|
|
||||||
// name
|
// name
|
||||||
|
|
|
@ -703,7 +703,7 @@ uint32_t CProtocol::GetValFromStream ( const CVector<uint8_t>& vecIn,
|
||||||
*/
|
*/
|
||||||
// 4 bytes maximum since we return uint32
|
// 4 bytes maximum since we return uint32
|
||||||
Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) );
|
Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) );
|
||||||
Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes );
|
Q_ASSERT ( static_cast<unsigned int> ( vecIn.Size() ) >= iPos + iNumOfBytes );
|
||||||
|
|
||||||
uint32_t iRet = 0;
|
uint32_t iRet = 0;
|
||||||
for ( unsigned int i = 0; i < iNumOfBytes; i++ )
|
for ( unsigned int i = 0; i < iNumOfBytes; i++ )
|
||||||
|
@ -782,7 +782,7 @@ void CProtocol::PutValOnStream ( CVector<uint8_t>& vecIn,
|
||||||
*/
|
*/
|
||||||
// 4 bytes maximum since we use uint32
|
// 4 bytes maximum since we use uint32
|
||||||
Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) );
|
Q_ASSERT ( ( iNumOfBytes > 0 ) && ( iNumOfBytes <= 4 ) );
|
||||||
Q_ASSERT ( vecIn.Size() >= iPos + iNumOfBytes );
|
Q_ASSERT ( static_cast<unsigned int> ( vecIn.Size() ) >= iPos + iNumOfBytes );
|
||||||
|
|
||||||
for ( unsigned int i = 0; i < iNumOfBytes; i++ )
|
for ( unsigned int i = 0; i < iNumOfBytes; i++ )
|
||||||
{
|
{
|
||||||
|
|
34
src/util.cpp
34
src/util.cpp
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Copyright (c) 2004-2006
|
* Copyright (c) 2004-2008
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Volker Fischer
|
* Volker Fischer
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
/* Input level meter implementation ------------------------------------------ */
|
// Input level meter implementation --------------------------------------------
|
||||||
void CSignalLevelMeter::Update ( CVector<double>& vecdAudio )
|
void CSignalLevelMeter::Update ( CVector<double>& vecdAudio )
|
||||||
{
|
{
|
||||||
// do the update for entire vector
|
// do the update for entire vector
|
||||||
|
@ -72,7 +72,7 @@ double CSignalLevelMeter::MicLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* CRC ---------------------------------------------------------------------- */
|
// CRC -------------------------------------------------------------------------
|
||||||
void CCRC::Reset()
|
void CCRC::Reset()
|
||||||
{
|
{
|
||||||
/* Init state shift-register with ones. Set all registers to "1" with
|
/* Init state shift-register with ones. Set all registers to "1" with
|
||||||
|
@ -268,7 +268,7 @@ double CAudioReverb::ProcessSample ( const double input )
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* GUI utilities *
|
* GUI utilities *
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
/* About dialog ------------------------------------------------------------- */
|
// About dialog ----------------------------------------------------------------
|
||||||
CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent )
|
CAboutDlg::CAboutDlg ( QWidget* parent ) : QDialog ( parent )
|
||||||
{
|
{
|
||||||
setupUi ( this );
|
setupUi ( this );
|
||||||
|
@ -352,7 +352,7 @@ QString CAboutDlg::GetVersionAndNameStr ( const bool bWithHtml )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Help menu ---------------------------------------------------------------- */
|
// Help menu -------------------------------------------------------------------
|
||||||
CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
|
CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
|
||||||
{
|
{
|
||||||
// standard help menu consists of about and what's this help
|
// standard help menu consists of about and what's this help
|
||||||
|
@ -367,17 +367,23 @@ CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Global functions implementation *
|
* Global functions implementation *
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
void DebugError ( const char* pchErDescr, const char* pchPar1Descr,
|
void DebugError ( const QString& pchErDescr, const QString& pchPar1Descr,
|
||||||
const double dPar1, const char* pchPar2Descr,
|
const double dPar1, const QString& pchPar2Descr,
|
||||||
const double dPar2 )
|
const double dPar2 )
|
||||||
{
|
{
|
||||||
FILE* pFile = fopen ( "DebugError.dat", "a" );
|
QFile File ( "DebugError.dat" );
|
||||||
fprintf ( pFile, pchErDescr ); fprintf ( pFile, " ### " );
|
if ( File.open ( QIODevice::Append ) )
|
||||||
fprintf ( pFile, pchPar1Descr ); fprintf ( pFile, ": " );
|
{
|
||||||
fprintf ( pFile, "%e ### ", dPar1);
|
// append new line in logging file
|
||||||
fprintf ( pFile, pchPar2Descr ); fprintf ( pFile, ": " );
|
QTextStream out ( &File );
|
||||||
fprintf ( pFile, "%e\n", dPar2 );
|
out << pchErDescr << " ### " <<
|
||||||
fclose ( pFile );
|
pchPar1Descr << ": " << QString().setNum ( dPar1, 'f', 2 ) <<
|
||||||
|
" ### " <<
|
||||||
|
pchPar2Descr << ": " << QString().setNum ( dPar2, 'f', 2 ) <<
|
||||||
|
endl;
|
||||||
|
|
||||||
|
File.close();
|
||||||
|
}
|
||||||
printf ( "\nDebug error! For more information see test/DebugError.dat\n" );
|
printf ( "\nDebug error! For more information see test/DebugError.dat\n" );
|
||||||
exit ( 1 );
|
exit ( 1 );
|
||||||
}
|
}
|
||||||
|
|
42
src/util.h
42
src/util.h
|
@ -31,6 +31,7 @@
|
||||||
#include <qtextbrowser.h>
|
#include <qtextbrowser.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
|
#include <qfile.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
using namespace std; // because of the library: "vector"
|
using namespace std; // because of the library: "vector"
|
||||||
|
@ -65,8 +66,8 @@ inline short Double2Short ( const double dInput )
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug error handling
|
// debug error handling
|
||||||
void DebugError ( const char* pchErDescr, const char* pchPar1Descr,
|
void DebugError ( const QString& pchErDescr, const QString& pchPar1Descr,
|
||||||
const double dPar1, const char* pchPar2Descr,
|
const double dPar1, const QString& pchPar2Descr,
|
||||||
const double dPar2 );
|
const double dPar2 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,8 +246,8 @@ template<class TData> class CMovingAv : public CVector<TData>
|
||||||
public:
|
public:
|
||||||
CMovingAv() : CVector<TData>(), iCurIdx ( 0 ), iNorm ( 0 ),
|
CMovingAv() : CVector<TData>(), iCurIdx ( 0 ), iNorm ( 0 ),
|
||||||
tCurAvResult ( TData ( 0 ) ) {}
|
tCurAvResult ( TData ( 0 ) ) {}
|
||||||
CMovingAv ( const int iNeSi ) : CVector<TData> ( iNeSi ), iCurIdx ( 0 ), iNorm ( 0 ),
|
CMovingAv ( const int iNeSi ) : CVector<TData> ( iNeSi ), iCurIdx ( 0 ),
|
||||||
tCurAvResult ( TData ( 0 ) ) {}
|
iNorm ( 0 ), tCurAvResult ( TData ( 0 ) ) {}
|
||||||
CMovingAv ( const int iNeSi, const TData tInVa ) :
|
CMovingAv ( const int iNeSi, const TData tInVa ) :
|
||||||
CVector<TData> ( iNeSi, tInVa ), iCurIdx ( 0 ), iNorm ( 0 ),
|
CVector<TData> ( iNeSi, tInVa ), iCurIdx ( 0 ), iNorm ( 0 ),
|
||||||
tCurAvResult ( TData ( 0 ) ) {}
|
tCurAvResult ( TData ( 0 ) ) {}
|
||||||
|
@ -313,7 +314,7 @@ template<class TData> void CMovingAv<TData>::Add ( const TData tNewD )
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* GUI utilities *
|
* GUI utilities *
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
/* About dialog ------------------------------------------------------------- */
|
// About dialog ----------------------------------------------------------------
|
||||||
class CAboutDlg : public QDialog, private Ui_CAboutDlgBase
|
class CAboutDlg : public QDialog, private Ui_CAboutDlgBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -325,7 +326,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Help menu ---------------------------------------------------------------- */
|
// Help menu -------------------------------------------------------------------
|
||||||
class CLlconHelpMenu : public QMenu
|
class CLlconHelpMenu : public QMenu
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -343,7 +344,7 @@ public slots:
|
||||||
|
|
||||||
|
|
||||||
/* Other Classes **************************************************************/
|
/* Other Classes **************************************************************/
|
||||||
/* Signal Level Meter ------------------------------------------------------- */
|
// Signal Level Meter ----------------------------------------------------------
|
||||||
class CSignalLevelMeter
|
class CSignalLevelMeter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -390,7 +391,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Audio Reverbration ------------------------------------------------------- */
|
// Audio Reverbration ----------------------------------------------------------
|
||||||
class CAudioReverb
|
class CAudioReverb
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -410,7 +411,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* CRC ---------------------------------------------------------------------- */
|
// CRC -------------------------------------------------------------------------
|
||||||
class CCRC
|
class CCRC
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -430,7 +431,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Time conversion ---------------------------------------------------------- */
|
// Time conversion -------------------------------------------------------------
|
||||||
// needed for ping measurement
|
// needed for ping measurement
|
||||||
class CTimeConv
|
class CTimeConv
|
||||||
{
|
{
|
||||||
|
@ -467,7 +468,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Time and Data to String conversion --------------------------------------- */
|
// Time and Data to String conversion ------------------------------------------
|
||||||
class CLogTimeDate
|
class CLogTimeDate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -484,25 +485,23 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Time and Data to String conversion --------------------------------------- */
|
// Logging ---------------------------------------------------------------------
|
||||||
class CLogging
|
class CLogging
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLogging() : bDoLogging ( false ), pFile ( NULL ) {}
|
CLogging() : bDoLogging ( false ), File ( LOG_FILE_NAME ) {}
|
||||||
virtual ~CLogging()
|
virtual ~CLogging()
|
||||||
{
|
{
|
||||||
if ( pFile != NULL )
|
if ( File.isOpen() )
|
||||||
{
|
{
|
||||||
fclose ( pFile );
|
File.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// open file
|
// open file
|
||||||
pFile = fopen ( LOG_FILE_NAME, "a" );
|
if ( File.open ( QIODevice::Append ) )
|
||||||
|
|
||||||
if ( pFile != NULL )
|
|
||||||
{
|
{
|
||||||
bDoLogging = true;
|
bDoLogging = true;
|
||||||
}
|
}
|
||||||
|
@ -512,14 +511,15 @@ public:
|
||||||
{
|
{
|
||||||
if ( bDoLogging )
|
if ( bDoLogging )
|
||||||
{
|
{
|
||||||
fprintf ( pFile, "%s\n", sNewStr.toStdString() );
|
// append new line in logging file
|
||||||
fflush ( pFile );
|
QTextStream out ( &File );
|
||||||
|
out << sNewStr << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool bDoLogging;
|
bool bDoLogging;
|
||||||
FILE* pFile;
|
QFile File;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* !defined ( UTIL_HOIH934256GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */
|
#endif /* !defined ( UTIL_HOIH934256GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
/* Definitions ****************************************************************/
|
/* Definitions ****************************************************************/
|
||||||
// switch here between ASIO (Steinberg) or native Windows(TM) sound interface
|
// switch here between ASIO (Steinberg) or native Windows(TM) sound interface
|
||||||
//#undef USE_ASIO_SND_INTERFACE
|
#undef USE_ASIO_SND_INTERFACE
|
||||||
#define USE_ASIO_SND_INTERFACE
|
//#define USE_ASIO_SND_INTERFACE
|
||||||
|
|
||||||
|
|
||||||
#define NUM_IN_OUT_CHANNELS 2 /* Stereo recording (but we only
|
#define NUM_IN_OUT_CHANNELS 2 /* Stereo recording (but we only
|
||||||
|
|
Loading…
Reference in a new issue