Commit a2e79cfd authored by Anne Heimes's avatar Anne Heimes
Browse files

Log BaseData & in Matlab benutzen

parent 8e67fa3f
......@@ -34,6 +34,7 @@ using namespace std;
class CITANetAudioStreamingClient;
class ITABufferedDataLoggerImplStream;
class ITABufferedDataLoggerImplNet;
class ITABufferedDataLoggerImplAudio;
//! Network audio stream
/**
......@@ -208,6 +209,7 @@ private:
int m_iStreamingStatus; //!< Current streaming status
double m_dLastStreamingTimeCode;
ITABufferedDataLoggerImplAudio* m_pAudioLogger; //!< Logging for the audio stream
ITABufferedDataLoggerImplStream* m_pStreamLogger; //!< Logging for the audio stream
ITABufferedDataLoggerImplNet* m_pNetLogger; //!< Logging for the network stream
int iAudioStreamingBlockID; //!< Audio streaming block id
......
......@@ -17,6 +17,37 @@
#include <iostream>
//! Audio streaming log item
struct ITAAudioLog : public ITALogDataBase
{
inline static std::ostream& outputDesc( std::ostream& os )
{
os << "\t" << "Channel";
os << "\t" << "Samplerate";
os << "\t" << "BufferSize";
os << "\t" << "RingBufferSize";
os << "\t" << "TargetSampleLatency";
os << std::endl;
return os;
};
inline std::ostream& outputData( std::ostream& os ) const
{
os << "\t" << iChannel;
os << "\t" << dSampleRate;
os << "\t" << iBufferSize;
os << "\t" << iRingBufferSize;
os << "\t" << iTargetSampleLatency;
os << std::endl;
return os;
};
int iChannel;
double dSampleRate;
int iBufferSize;
int iRingBufferSize;
int iTargetSampleLatency;
};
//! Audio streaming log item
struct ITAStreamLog : public ITALogDataBase
{
inline static std::ostream& outputDesc( std::ostream& os )
......@@ -81,6 +112,7 @@ struct ITANetLog : public ITALogDataBase
int iNumSamplesTransmitted;
};
class ITABufferedDataLoggerImplAudio : public ITABufferedDataLogger < ITAAudioLog > {};
class ITABufferedDataLoggerImplStream : public ITABufferedDataLogger < ITAStreamLog > {};
class ITABufferedDataLoggerImplNet : public ITABufferedDataLogger < ITANetLog > {};
......@@ -105,6 +137,9 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
m_iStreamingStatus = STOPPED;
// Logging
m_pAudioLogger = new ITABufferedDataLoggerImplAudio( );
m_pAudioLogger->setOutputFile( "NetAudioLogBaseData.txt" );
m_pStreamLogger = new ITABufferedDataLoggerImplStream();
m_pStreamLogger->setOutputFile( "NetAudioLogStream.txt" );
iAudioStreamingBlockID = 0;
......@@ -112,12 +147,22 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
m_pNetLogger = new ITABufferedDataLoggerImplNet();
m_pNetLogger->setOutputFile( "NetAudioLogNet.txt" );
iNetStreamingBlockID = 0;
// Logging Base Data
ITAAudioLog oLog;
oLog.iChannel = GetNumberOfChannels();
oLog.dSampleRate = m_dSampleRate;
oLog.iBufferSize = GetBlocklength();
oLog.iRingBufferSize = GetRingBufferSize();
oLog.iTargetSampleLatency = m_iTargetSampleLatency;
m_pAudioLogger->log( oLog );
}
CITANetAudioStream::~CITANetAudioStream()
{
delete m_pNetLogger;
delete m_pStreamLogger;
delete m_pAudioLogger;
delete m_pNetAudioStreamingClient;
}
......@@ -267,7 +312,7 @@ void CITANetAudioStream::IncrementBlockPointer()
oLog.dWorldTimeStamp = ITAClock::getDefaultClock()->getTime();
oLog.dStreamingTimeCode = m_dLastStreamingTimeCode;
oLog.uiBlockId = ++iAudioStreamingBlockID;
oLog.iFreeSamples = GetRingBufferFreeSamples();
oLog.iFreeSamples = GetRingBufferFreeSamples( );
m_pStreamLogger->log( oLog );
m_pNetAudioStreamingClient->TriggerBlockIncrement();
......
......@@ -15,12 +15,12 @@ using namespace std;
static string g_sServerName = "137.226.61.163";
static int g_iServerPort = 12480;
static double g_dSampleRate = 44100;
static int g_iBufferSize = 1024;
static int g_iChannels = 1;
static int g_iBufferSize = 2048;
static int g_iChannels = 150;
int main( int , char** )
{
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBufferSize, 100 * g_iBufferSize );
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBufferSize, 1 * g_iBufferSize );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBufferSize );
oPatchbay.AddInput( &oNetAudioStream );
......
......@@ -4,6 +4,14 @@ clear all;
NetAudioLogNet = readtable( 'NetAudioLogNet.txt' );
NetAudioLogStream = readtable( 'NetAudioLogStream.txt' );
NetAudioLogClient = readtable( 'NetAudioLogClient.txt' );
NetAudioLogBaseData = readtable( 'NetAudioLogBaseData.txt' );
% Save Base Data
Channel = NetAudioLogBaseData.Channel(1);
SampleRate = NetAudioLogBaseData.Samplerate(1);
BufferSize = NetAudioLogBaseData.BufferSize(1);
RingBufferSize = NetAudioLogBaseData.RingBufferSize(1);
TargetSampleLatency = NetAudioLogBaseData.TargetSampleLatency(1);
minTime = min(NetAudioLogStream.WorldTimeStamp(1),NetAudioLogNet.WorldTimeStamp(1));
TimeNet = NetAudioLogNet.WorldTimeStamp - minTime;
......@@ -42,9 +50,9 @@ LatenzRunnning = DiffTime(find(DiffTime(:,3)>221), (1:2));
medianRunning = mean(LatenzRunnning(:,2));
medianRunningVec = zeros(size(LatenzRunnning(:,1)));
medianRunningVec = medianRunningVec + medianRunning;
sollLatenz = (BlockLenght / 44100) * 1000;
sollLatenz = (BlockLenght / SampleRate) * 1000;
sollLatenzVec = zeros(size(LatenzRunnning(:,1)));
sollLatenzVec = sollLatenzVec + sollLatenz
sollLatenzVec = sollLatenzVec + sollLatenz;
subplot(2,2,3:4)
plot( LatenzRunnning(:,1), LatenzRunnning(:,2))
......@@ -53,8 +61,12 @@ plot( LatenzRunnning(:,1), medianRunningVec, 'r')
plot( LatenzRunnning(:,1), sollLatenzVec, 'g')
plot( TimeUnderrun, zeros(size(TimeUnderrun)) + sollLatenz,'r*')
plot( TimeOverrun, zeros(size(TimeOverrun)) + medianRunning,'r*')
AnzahlUnderruns = size(TimeUnderrun);
AnzahlUnderruns = AnzahlUnderruns(1);
AnzahlUnderruns = num2str(AnzahlUnderruns);
Durchsatz = [num2str((32 * SampleRate * Channel)/1000) ' kbit/s']
title('Latenz pro Block')
legend('Latenz', 'Durchschnittliche Latenz', 'SollLatenz', 'Underruns', 'Overruns')
legend('Latenz', 'Durchschnittliche Latenz', 'SollLatenz', ['Underruns (Anz. ' AnzahlUnderruns ')'], 'Overruns')
xlabel('Zeit in ms')
ylabel('Latenz in ms')
legend('show')
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