Refactoring #3

parent dfea0f75
......@@ -139,10 +139,10 @@ public:
void SetNetAudioStreamingLoggerBaseName( const std::string& sBaseName );
//! Enabled/disables export of loggers
void SetLoggingExportEnabled( bool bEnabled );
void SetDebuggingEnabled( bool bEnabled );
//! Logging export flag getter
bool GetLoggingExportEnabled() const;
bool GetIsDebuggingEnabled() const;
//! Returns (static) size of ring buffer
/**
......@@ -236,7 +236,7 @@ private:
ITABufferedDataLoggerImplStream* m_pAudioStreamLogger; //!< Logging for the audio stream
ITABufferedDataLoggerImplNet* m_pNetworkStreamLogger; //!< Logging for the network stream
std::string m_sNetAudioStreamLoggerBaseName;
bool m_bExportLogs;
bool m_bDebuggingEnabled;
int m_iAudioStreamingBlockID; //!< Audio streaming block id
int m_iNetStreamingBlockID; //!< Network streaming block id
......
......@@ -71,10 +71,10 @@ public:
//! Enabled/disables export of loggers
void SetLoggingExportEnabled( bool bEnabled );
void SetDebuggingEnabled( bool bEnabled );
//! Logging export flag getter
bool GetLoggingExportEnabled() const;
bool GetIsDebuggingEnabled() const;
int GetSendingBlockLength() const;
void SetSendingBlockLength( const int iSendingBlockLength );
......@@ -101,7 +101,7 @@ private:
ITABufferedDataLoggerImplServer* m_pServerLogger;
std::string m_sServerLogBaseName;
ITAStopWatch m_swTryReadBlockStats, m_swTryReadAccessStats;
bool m_bExportLogs;
bool m_bDebuggingEnabled;
int m_iServerBlockId;
double m_dLastTimeStamp;
......
......@@ -97,7 +97,7 @@ CITANetAudioStream::CITANetAudioStream(int iChannels, double dSamplingRate, int
, m_iWriteCursor( 0 ) // always ahead, i.e. iWriteCursor >= iReadCursor if unwrapped
, m_iAudioStreamingBlockID( 0 )
, m_iNetStreamingBlockID( 0 )
, m_bExportLogs( false )
, m_bDebuggingEnabled( false )
{
if( iBufferSize > iRingBufferCapacity )
ITA_EXCEPT1( INVALID_PARAMETER, "Ring buffer capacity can not be smaller than Target Sample Latency." );
......@@ -115,7 +115,7 @@ CITANetAudioStream::CITANetAudioStream(int iChannels, double dSamplingRate, int
CITANetAudioStream::~CITANetAudioStream()
{
if( m_bExportLogs == false )
if( m_bDebuggingEnabled == false )
{
m_pAudioStreamLogger->setOutputFile( "" ); // Disables file storing
m_pNetworkStreamLogger->setOutputFile( "" ); // Disables file storing
......@@ -388,12 +388,12 @@ void CITANetAudioStream::SetNetAudioStreamingLoggerBaseName( const std::string&
m_pNetAudioStreamingClient->SetClientLoggerBaseName( sBaseName );
}
void CITANetAudioStream::SetLoggingExportEnabled( bool bEnabled )
void CITANetAudioStream::SetDebuggingEnabled( bool bEnabled )
{
m_bExportLogs = bEnabled;
m_bDebuggingEnabled = bEnabled;
}
bool CITANetAudioStream::GetLoggingExportEnabled() const
bool CITANetAudioStream::GetIsDebuggingEnabled() const
{
return m_bExportLogs;
return m_bDebuggingEnabled;
}
......@@ -63,7 +63,7 @@ CITANetAudioStreamingServer::CITANetAudioStreamingServer()
, m_dLastTimeStamp( 0 )
, m_iTargetLatencySamples( -1 )
, m_sServerLogBaseName( "ITANetAudioStreamingServer" )
, m_bExportLogs( false )
, m_bDebuggingEnabled( false )
, m_iMaxSendBlocks( 40 )
, m_iServerBlockId( 0 )
, m_iEstimatedClientRingBufferFreeSamples( 0 )
......@@ -77,12 +77,17 @@ CITANetAudioStreamingServer::~CITANetAudioStreamingServer()
{
delete m_pNetAudioServer;
if( m_bExportLogs == false )
if( GetIsDebuggingEnabled() )
{
vstr::out() << "[ ITANetAudioStreamingServer ] Processing statistics: " << m_swTryReadBlockStats.ToString() << std::endl;
vstr::out() << "[ ITANetAudioStreamingServer ] Try-read access statistics: " << m_swTryReadAccessStats.ToString() << std::endl;
}
else
m_pServerLogger->setOutputFile( "" ); // disables export
delete m_pServerLogger;
vstr::out() << "[ ITANetAudioStreamingServer ] Processing statistics: " << m_swTryReadBlockStats.ToString() << std::endl;
vstr::out() << "[ ITANetAudioStreamingServer ] Try-read access statistics: " << m_swTryReadAccessStats.ToString() << std::endl;
}
bool CITANetAudioStreamingServer::Start(const std::string& sAddress, int iPort, double dTimeIntervalCientSendStatus)
......@@ -288,14 +293,14 @@ int CITANetAudioStreamingServer::GetNetStreamNumberOfChannels() const
return m_sfTempTransmitBuffer.channels();
}
void CITANetAudioStreamingServer::SetLoggingExportEnabled( bool bEnabled )
void CITANetAudioStreamingServer::SetDebuggingEnabled( bool bEnabled )
{
m_bExportLogs = bEnabled;
m_bDebuggingEnabled = bEnabled;
}
bool CITANetAudioStreamingServer::GetLoggingExportEnabled() const
bool CITANetAudioStreamingServer::GetIsDebuggingEnabled() const
{
return m_bExportLogs;
return m_bDebuggingEnabled;
}
void CITANetAudioStreamingServer::SetTargetLatencySamples( const int iTargetLatency )
......
......@@ -62,7 +62,7 @@ int main( int argc, char* argv[] )
ss << "_RB" << g_iRingBufferSize;
ss << "_SB" << g_iSendingBlockLength;
oNetAudioStream.SetNetAudioStreamingLoggerBaseName( ss.str() );
oNetAudioStream.SetLoggingExportEnabled( true );
oNetAudioStream.SetDebuggingEnabled( true );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBlockLength );
oPatchbay.AddInput( &oNetAudioStream );
......
......@@ -32,6 +32,7 @@ int main(int argc, char* argv[])
int iBufferSize = atoi(argv[6]);
CITANetAudioStream oNetAudioStream( iChannels, dSampleRate, iBlockLength, iBlockLength*16 );
oNetAudioStream.SetDebuggingEnabled( true );
ITAStreamPatchbay oPatchbay( dSampleRate, iBlockLength );
oPatchbay.AddInput( &oNetAudioStream );
int iOutputID = oPatchbay.AddOutput( 2 );
......@@ -72,4 +73,4 @@ int main(int argc, char* argv[])
ITAPA.Finalize();
return 0;
}
\ No newline at end of file
}
......@@ -72,7 +72,7 @@ int main( int argc, char** argv )
ss << "_RB" << g_iRingBufferSize;
ss << "_SB" << g_iSendingBlockLength;
oStreamingServer.SetServerLogBaseName( ss.str() );
oStreamingServer.SetLoggingExportEnabled( true );
oStreamingServer.SetDebuggingEnabled( true );
oStreamingServer.SetInputStream( &oMuliplier );
oStreamingServer.SetTargetLatencySamples( g_iTargetLatencySamples );
......
......@@ -39,7 +39,7 @@ public:
inline CServer( const string& sInputFilePath )
{
pStreamingServer = new CITANetAudioStreamingServer;
pStreamingServer->SetLoggingExportEnabled( true );
pStreamingServer->SetDebuggingEnabled( true );
pStreamingServer->SetTargetLatencySamples( g_iTargetLatencySamples );
pStreamingServer->SetServerLogBaseName( "ITANetAudioTest_Server" );
......@@ -84,7 +84,7 @@ void run_test()
// Client dumping received stream and mixing down to two channels
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBlockLength, g_iRingerBufferCapacity );
oNetAudioStream.SetNetAudioStreamingLoggerBaseName( "ITANetAudioTest_Client" );
oNetAudioStream.SetLoggingExportEnabled( true );
oNetAudioStream.SetDebuggingEnabled( true );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBlockLength );
oPatchbay.AddInput( &oNetAudioStream );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment