...
 
Commits (4)
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -231,9 +231,9 @@ private:
ITASampleFrame m_sfRingBuffer; //!< Ring buffer
int m_iStreamingStatus; //!< Current streaming status
double m_dLastStreamingTimeCode;
ITABufferedDataLoggerImplStream* m_pAudioStreamLogger; //!< Logging for the audio stream
double m_dLastStreamingTimeCode;
ITABufferedDataLoggerImplStream* m_pAudioStreamLogger; //!< Logging for the audio stream
ITABufferedDataLoggerImplNet* m_pNetworkStreamLogger; //!< Logging for the network stream
std::string m_sNetAudioStreamLoggerBaseName;
bool m_bDebuggingEnabled;
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......@@ -23,8 +23,10 @@
#include <ITACriticalSection.h>
#include <ITADataSource.h>
#include <ITAStopWatch.h>
#include <atomic>
#include <string>
#include <vector>
//! Detektor for statistic values in audio stream (i.e. for level metering)
......@@ -162,6 +164,12 @@ public:
virtual const float* GetBlockPointer( unsigned int uiChannel, const ITAStreamInfo* pStreamInfo );
virtual void IncrementBlockPointer();
void SetProfilerEnabled( bool bEnabled );
bool GetProfilerEnabled() const;
double GetProfilerMeanCalculationTime( bool bReset = true );
std::string GetProfilerResult( bool bReset = true );
protected:
ITADatasource* m_pDataSource; //!< Angeschlossene Datenquelle
double m_dSamplerate; //!< Abtastrate [Hz]
......@@ -174,6 +182,8 @@ protected:
int m_iOverallPeakChannel; //!< Kanal in dem der Spitzenwert auftrat
std::vector< double > m_vdRMSSquaredSums;
int m_iRMSBlocks;
bool m_bProfilerEnabled;
ITAStopWatch m_sw;
};
#endif // INCLUDE_WATCHER_ITA_PEAK_DETECTOR
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -3,7 +3,7 @@
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2017
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
......
......@@ -9,6 +9,7 @@
ITAStreamDetector::ITAStreamDetector( ITADatasource* pDataSource, const int iMode )
: m_pDataSource( pDataSource )
, m_iMode( iMode )
, m_bProfilerEnabled( false )
{
m_dSamplerate = pDataSource->GetSampleRate();
m_iChannels = int( pDataSource->GetNumberOfChannels() );
......@@ -76,23 +77,7 @@ float ITAStreamDetector::GetOverallPeak( int& iChannel, const bool bReset )
double ITAStreamDetector::GetOverallPeakDecibel( int& iChannel, const bool bReset )
{
if( m_iMode != ITAStreamDetector::PEAK && m_iMode != ITAStreamDetector::PEAK_AND_RMS )
ITA_EXCEPT1( MODAL_EXCEPTION, "Can not provide stream detector data because it is not calculated in this mode" );
m_cs.enter();
const double dOverallPeakDB = ratio_to_db20( m_fOverallPeak );
iChannel = m_iOverallPeakChannel;
if( bReset )
{
m_fOverallPeak = 0;
m_iOverallPeakChannel = 0;
}
m_cs.leave();
return dOverallPeakDB;
return ratio_to_db20( GetOverallPeak( iChannel, bReset ) );
}
float ITAStreamDetector::GetPeak( const int iChannel, const bool bReset )
......@@ -163,7 +148,10 @@ float ITAStreamDetector::GetOverallRMS( const bool bReset )
m_cs.enter();
if( m_iRMSBlocks == 0 )
{
m_cs.leave();
return 0.0f;
}
double dOverallRMSSums = 0;
for( size_t i = 0; i < m_vdRMSSquaredSums.size(); i++ )
......@@ -220,7 +208,10 @@ void ITAStreamDetector::GetRMSs( std::vector< float >& vfDest, const bool bReset
vfDest.resize( m_vdRMSSquaredSums.size(), 0.0f );
if( m_iRMSBlocks == 0 )
{
m_cs.leave();
return;
}
for( size_t c = 0; c < m_vdRMSSquaredSums.size(); c++ )
vfDest[ c ] = float( std::sqrt( ( m_vdRMSSquaredSums[ c ] / double( m_iRMSBlocks ) ) ) ); // RMS
......@@ -236,9 +227,14 @@ void ITAStreamDetector::GetRMSsDecibel( std::vector< float >& vdDestDecibel, con
if( m_iMode != ITAStreamDetector::RMS && m_iMode != ITAStreamDetector::PEAK_AND_RMS )
ITA_EXCEPT1( MODAL_EXCEPTION, "Can not provide stream detector data because it is not calculated in this mode" );
m_cs.enter();
vdDestDecibel.resize( m_vdRMSSquaredSums.size(), ITAConstants::MINUS_INFINITY_F );
if( m_iRMSBlocks == 0 )
{
m_cs.leave();
return;
}
for( size_t c = 0; c < m_vdRMSSquaredSums.size(); c++ )
vdDestDecibel[ c ] = float( ratio_to_db20( std::sqrt( m_vdRMSSquaredSums[ c ] / double( m_iRMSBlocks * m_iBlocklength ) ) ) ); // RMS
......@@ -253,6 +249,10 @@ const float* ITAStreamDetector::GetBlockPointer( unsigned int uiChannel, const I
{
const float* pfData = m_pDataSource->GetBlockPointer( uiChannel, pStreamInfo );
const bool bProfilerEnabled = GetProfilerEnabled();
if( bProfilerEnabled )
m_sw.start();
if( pfData && m_iMode != ITAStreamDetector::DEACTIVATED )
{
m_cs.enter();
......@@ -286,6 +286,9 @@ const float* ITAStreamDetector::GetBlockPointer( unsigned int uiChannel, const I
m_cs.leave();
}
if( bProfilerEnabled )
m_sw.stop();
return pfData;
}
......@@ -294,3 +297,41 @@ void ITAStreamDetector::IncrementBlockPointer()
m_iRMSBlocks++;
m_pDataSource->IncrementBlockPointer();
}
void ITAStreamDetector::SetProfilerEnabled( bool bEnabled )
{
m_bProfilerEnabled = bEnabled;
}
bool ITAStreamDetector::GetProfilerEnabled() const
{
return m_bProfilerEnabled;
}
double ITAStreamDetector::GetProfilerMeanCalculationTime( bool bReset )
{
double dResult = 0.0f;
if( GetProfilerEnabled() )
{
dResult = m_sw.mean();
if( bReset )
m_sw.reset();
}
return dResult;
}
std::string ITAStreamDetector::GetProfilerResult( bool bReset )
{
std::string sResult;
if( GetProfilerEnabled() )
{
sResult = m_sw.ToString();
if( bReset )
m_sw.reset();
}
return sResult;
}
......@@ -421,7 +421,8 @@ void ITAStreamPatchbay::HandlePreGetBlockPointer( ITADatasourceRealization*, uns
void ITAStreamPatchbay::HandlePostIncrementBlockPointer( ITADatasourceRealization* )
{
// Ignore, if already called for another output
if( !m_bProcessIncrement ) return;
if( !m_bProcessIncrement )
return;
// Turn data producion on again, when the first output's block pointer is incremented
m_bProcessData = true;
......@@ -432,9 +433,11 @@ void ITAStreamPatchbay::HandlePostIncrementBlockPointer( ITADatasourceRealizatio
// Build a unique list of sources
std::set<ITADatasource*> vSources;
for( int i = 0; i < GetNumInputs(); i++ ) {
for( int i = 0; i < GetNumInputs(); i++ )
{
ITADatasource* pdsInputSource = m_vpInputs[ i ]->pDatasource;
if( pdsInputSource ) vSources.insert( pdsInputSource );
if( pdsInputSource )
vSources.insert( pdsInputSource );
}
// Increment each data source only once
......