Commit 82be59b0 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Merge branch 'ba_2016_heimes' of https://git.rwth-aachen.de/ita/ITADataSources into ba_2016_heimes

parents 4e81b87c 677458e7
......@@ -96,6 +96,7 @@ private:
int m_iUpdateStrategy;
int m_iClientRingBufferFreeSamples;
int m_iMaxSendBlocks;
double m_dLastTimeStamp;
friend class CITANetAudioServer;
};
......
......@@ -33,7 +33,7 @@ void CITANetAudioMessage::ResetMessage()
// wait till sending is complete -> this prevents us
// from deleting the buffer while it is still being read
// by the connection
if( m_pConnection )
if (m_pConnection != NULL)
m_pConnection->WaitForSendFinish();
m_nMessageId = S_nMessageIds++;
......@@ -318,8 +318,9 @@ CITANetAudioProtocol::StreamingParameters CITANetAudioMessage::ReadStreamingPara
oParams.iChannels = ReadInt();
oParams.dSampleRate = ReadDouble( );
oParams.iBlockSize = ReadInt( );
oParams.iRingBufferSize = ReadInt( );
oParams.iBlockSize = ReadInt();
oParams.iRingBufferSize = ReadInt();
oParams.iTargetSampleLatency = ReadInt();
return oParams;
}
......@@ -328,8 +329,9 @@ void CITANetAudioMessage::WriteStreamingParameters( const CITANetAudioProtocol::
{
WriteInt( oParams.iChannels );
WriteDouble( oParams.dSampleRate );
WriteInt( oParams.iBlockSize );
WriteInt( oParams.iRingBufferSize );
WriteInt(oParams.iBlockSize);
WriteInt(oParams.iRingBufferSize);
WriteInt(oParams.iTargetSampleLatency);
}
int CITANetAudioMessage::ReadRingBufferSize()
......
......@@ -117,18 +117,18 @@ class ITABufferedDataLoggerImplStream : public ITABufferedDataLogger < ITAStream
class ITABufferedDataLoggerImplNet : public ITABufferedDataLogger < ITANetLog > {};
CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int iBufferSize, int iRingBufferCapacity )
CITANetAudioStream::CITANetAudioStream(int iChannels, double dSamplingRate, int iBufferSize, int iTargetSampleLatencyServer)
: m_sfOutputStreamBuffer( iChannels, iBufferSize, true )
, m_dSampleRate( dSamplingRate )
, m_sfRingBuffer( iChannels, iRingBufferCapacity, true )
, m_sfRingBuffer(iChannels, iTargetSampleLatencyServer * 3, true)
, m_bRingBufferFull( false )
, m_iStreamingStatus( INVALID )
, m_dLastStreamingTimeCode( 0.0f )
, m_iTargetSampleLatencyServer( iRingBufferCapacity )
, m_iTargetSampleLatencyServer( iTargetSampleLatencyServer )
{
m_bRingBufferFull = false;
if( iBufferSize > iRingBufferCapacity )
ITA_EXCEPT1( INVALID_PARAMETER, "Ring buffer capacity can not be smaller than buffer size." );
if (iBufferSize > iTargetSampleLatencyServer)
ITA_EXCEPT1( INVALID_PARAMETER, "Ring buffer capacity can not be smaller than Target Sample Latency." );
m_pNetAudioStreamingClient = new CITANetAudioStreamingClient( this );
m_iReadCursor = 0;
......@@ -137,18 +137,16 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
m_iStreamingStatus = STOPPED;
// Logging
std::string paras = std::string("NetAudioLogBaseData") + std::string("_BS") + std::to_string(iBufferSize) + std::string("_Ch") + std::to_string(iChannels) + std::string(".txt");
std::string paras = std::string("_BS") + std::to_string(iBufferSize) + std::string("_Ch") + std::to_string(iChannels) + std::string("_tl") + std::to_string(iTargetSampleLatencyServer) + std::string(".txt");
m_pAudioLogger = new ITABufferedDataLoggerImplAudio( );
m_pAudioLogger->setOutputFile(paras);
m_pAudioLogger->setOutputFile(std::string("NetAudioLogBaseData") + paras);
paras = std::string("NetAudioLogStream") + std::string("_BS") + std::to_string(iBufferSize) + std::string("_Ch") + std::to_string(iChannels) + std::string(".txt");
m_pStreamLogger = new ITABufferedDataLoggerImplStream();
m_pStreamLogger->setOutputFile(paras);
m_pStreamLogger->setOutputFile(std::string("NetAudioLogStream") + paras);
iAudioStreamingBlockID = 0;
paras = std::string("NetAudioLogNet") + std::string("_BS") + std::to_string(iBufferSize) + std::string("_Ch") + std::to_string(iChannels) + std::string(".txt");
m_pNetLogger = new ITABufferedDataLoggerImplNet();
m_pNetLogger->setOutputFile(paras);
m_pNetLogger->setOutputFile(std::string("NetAudioLogNet") + paras);
iNetStreamingBlockID = 0;
// Logging Base Data
......@@ -397,7 +395,7 @@ int CITANetAudioStream::GetRingBufferFreeSamples() const
if( m_bRingBufferFull )
return 0;
int iFreeSamples = GetRingBufferSize() - ( ( m_iWriteCursor - m_iReadCursor + GetRingBufferSize() ) % GetRingBufferSize() );
int iFreeSamples = GetRingBufferSize() - ((m_iWriteCursor - m_iReadCursor + GetRingBufferSize()) % GetRingBufferSize());
assert( iFreeSamples > 0 );
return iFreeSamples;
}
......
......@@ -56,10 +56,11 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
m_oParams.iChannels = pParent->GetNumberOfChannels();
m_oParams.dSampleRate = pParent->GetSampleRate( );
m_oParams.iBlockSize = pParent->GetBlocklength( );
m_oParams.iRingBufferSize = pParent->GetRingBufferSize( );
m_oParams.iBlockSize = pParent->GetBlocklength();
m_oParams.iRingBufferSize = pParent->GetRingBufferSize();
m_oParams.iTargetSampleLatency = pParent->GetAllowedLatencySamples();
std::string paras = std::string("NetAudioLogClient") + std::string("_BS") + std::to_string(pParent->GetBlocklength()) + std::string("_Ch") + std::to_string(pParent->GetNumberOfChannels()) + std::string(".txt");
std::string paras = std::string("NetAudioLogClient") + std::string("_BS") + std::to_string(pParent->GetBlocklength()) + std::string("_Ch") + std::to_string(pParent->GetNumberOfChannels()) + std::string("_tl") + std::to_string(pParent->GetAllowedLatencySamples()) + std::string(".txt");
m_pClientLogger = new ITABufferedDataLoggerImplClient( );
m_pClientLogger->setOutputFile(paras);
iStreamingBlockId = 0;
......@@ -146,7 +147,7 @@ bool CITANetAudioStreamingClient::LoopBody()
// Read answer (blocking)
m_pMessage->ResetMessage( );
if( m_pMessage->ReadMessage( 0 ) )
if( m_pMessage->ReadMessage( 1 ) )
{
int iMsgType = m_pMessage->GetMessageType();
switch( iMsgType )
......@@ -179,6 +180,13 @@ bool CITANetAudioStreamingClient::LoopBody()
oLog.dWorldTimeStamp = ITAClock::getDefaultClock( )->getTime( );
m_pClientLogger->log( oLog );
}
else
{
// sende mal freie samples
m_pMessage->SetMessageType(CITANetAudioProtocol::NP_CLIENT_SENDING_RINGBUFFER_FREE_SAMPLES);
m_pMessage->WriteInt(m_pStream->GetRingBufferFreeSamples());
m_pMessage->WriteMessage();
}
return false;
}
......
......@@ -52,14 +52,15 @@ struct ITAServerLog : public ITALogDataBase
class ITABufferedDataLoggerImplServer : public ITABufferedDataLogger < ITAServerLog > {};
CITANetAudioStreamingServer::CITANetAudioStreamingServer( )
: m_pInputStream( NULL )
, m_iUpdateStrategy( AUTO )
, m_pConnection( NULL )
, m_pNetAudioServer( new CITANetAudioServer( ) )
CITANetAudioStreamingServer::CITANetAudioStreamingServer()
: m_pInputStream(NULL)
, m_iUpdateStrategy(AUTO)
, m_pConnection(NULL)
, m_pNetAudioServer(new CITANetAudioServer())
, m_dLastTimeStamp(0)
{
iServerBlockId = 0;
m_iMaxSendBlocks = 20;
m_iMaxSendBlocks = 40;
m_iClientRingBufferFreeSamples = 0;
}
......@@ -89,20 +90,26 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
bool bOK = false;
m_oServerParams.iRingBufferSize = oClientParams.iRingBufferSize;
m_iClientRingBufferFreeSamples = m_oServerParams.iRingBufferSize;
m_oServerParams.iTargetSampleLatency = oClientParams.iTargetSampleLatency;
m_oServerParams.iBlockSize = oClientParams.iBlockSize;
m_iClientRingBufferFreeSamples = m_oServerParams.iTargetSampleLatency;
m_dLastTimeStamp = ITAClock::getDefaultClock()->getTime();
if ( m_oServerParams == oClientParams )
{
bOK = true;
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ITANetAudioStreamingServer] Server and client parameters matched. Will resume with streaming" << std::endl;
#endif
}
else
{
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ITANetAudioStreamingServer] Server and client parameters mismatch detected. Will notify client and stop." << std::endl;
#endif
}
std::string paras = std::string( "NetAudioLogServer" ) + std::string( "_BS" ) + std::to_string( m_oServerParams.iBlockSize ) + std::string( "_Ch" ) + std::to_string( m_oServerParams.iChannels ) + std::string( ".txt" );
std::string paras = std::string("NetAudioLogServer") + std::string("_BS") + std::to_string(m_oServerParams.iBlockSize) + std::string("_Ch") + std::to_string(m_oServerParams.iChannels) + std::string("_tl") + std::to_string(m_oServerParams.iTargetSampleLatency) + std::string(".txt");
m_pServerLogger = new ITABufferedDataLoggerImplServer( );
m_pServerLogger->setOutputFile( paras );
......@@ -128,18 +135,15 @@ bool CITANetAudioStreamingServer::LoopBody( )
int iMsgType;
// Sending Samples
unsigned int uiBlockLength = m_pInputStream->GetBlocklength( );
if ( m_iClientRingBufferFreeSamples >= uiBlockLength )
int iClientRingBufferTargetFreeSamples = m_iClientRingBufferFreeSamples - (m_oServerParams.iRingBufferSize - m_oServerParams.iTargetSampleLatency);
if (iClientRingBufferTargetFreeSamples < 0)
iClientRingBufferTargetFreeSamples = 0;
if (iClientRingBufferTargetFreeSamples >= uiBlockLength)
{
// Send Samples
// Sende max 10 * Blocklnge aufeinmal
int iSendBlocks;
if ( m_iClientRingBufferFreeSamples > m_iMaxSendBlocks * uiBlockLength )
iSendBlocks = m_iMaxSendBlocks;
else
{
iSendBlocks = m_iClientRingBufferFreeSamples / uiBlockLength;
bAskClient = true;
}
int iSendBlocks = iClientRingBufferTargetFreeSamples / uiBlockLength;
bAskClient = true;
if ( m_sfTempTransmitBuffer.GetLength( ) != iSendBlocks * uiBlockLength )
m_sfTempTransmitBuffer.init( m_pInputStream->GetNumberOfChannels( ), iSendBlocks * uiBlockLength, false );
......@@ -157,37 +161,18 @@ bool CITANetAudioStreamingServer::LoopBody( )
m_pInputStream->IncrementBlockPointer( );
}
iMsgType = CITANetAudioProtocol::NP_SERVER_SENDING_SAMPLES;
m_pMessage->SetMessageType( iMsgType );
m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage->WriteMessage( );
m_pMessage->SetMessageType(iMsgType);
m_pMessage->WriteSampleFrame(&m_sfTempTransmitBuffer);
m_pMessage->WriteMessage();
m_iClientRingBufferFreeSamples -= iSendBlocks * uiBlockLength;
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out( ) << "[ITANetAudioStreamingServer] Transmitted " << iSendSamples << " samples for "
<< m_pInputStream->GetNumberOfChannels( ) << " channels" << std::endl;
vstr::out() << "[ITANetAudioStreamingServer] Transmitted " << iSendSamples << " samples for "
<< m_pInputStream->GetNumberOfChannels() << " channels" << std::endl;
#endif
}
else
bAskClient = true;
if ( bAskClient )
{
// Waiting for Trigger
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out( ) << "[ITANetAudioStreamingServer] Not enough free samples in client buffer, requesting a trigger when more free samples available" << std::endl;
#endif
ITAServerLog oLog;
oLog.uiBlockId = ++iServerBlockId;
m_pMessage->ResetMessage( );
iMsgType = CITANetAudioProtocol::NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES;
m_pMessage->SetMessageType( iMsgType );
m_pMessage->WriteBool( true );
m_pMessage->WriteMessage( );
oLog.iProtocolStatus = iMsgType;
oLog.iFreeSamples = m_iClientRingBufferFreeSamples;
oLog.dWorldTimeStamp = ITAClock::getDefaultClock( )->getTime( );
m_pServerLogger->log( oLog );
}
// Try to Empfange Daten
......@@ -203,6 +188,8 @@ bool CITANetAudioStreamingServer::LoopBody( )
case CITANetAudioProtocol::NP_CLIENT_SENDING_RINGBUFFER_FREE_SAMPLES:
{
m_iClientRingBufferFreeSamples = m_pMessage->ReadInt( );
m_dLastTimeStamp = ITAClock::getDefaultClock()->getTime();
bAskClient = false;
break;
}
case CITANetAudioProtocol::NP_CLIENT_CLOSE:
......@@ -214,6 +201,7 @@ bool CITANetAudioStreamingServer::LoopBody( )
StopGently( false );
m_pConnection = NULL;
Stop( );
bAskClient = false;
break;
}
default:
......@@ -230,14 +218,41 @@ bool CITANetAudioStreamingServer::LoopBody( )
else
{
/*
// Neue Sample bei ca 1ms (0,9ms) warten
float dSamples = 0.0009 * m_pInputStream->GetSampleRate();
ITAServerLog oLog;
oLog.uiBlockId = ++iServerBlockId;
// Neue Samples, bei ca 1ms warten
double dTimeDiff = ITAClock::getDefaultClock()->getTime() - m_dLastTimeStamp;
float dSamples = dTimeDiff * m_pInputStream->GetSampleRate();
m_dLastTimeStamp = ITAClock::getDefaultClock()->getTime();
int iSamples = ( int ) dSamples;
int offset = iSamples % m_pInputStream->GetBlocklength( );
m_iClientRingBufferFreeSamples += iSamples - offset;
oLog.iFreeSamples = m_iClientRingBufferFreeSamples;
oLog.iProtocolStatus = 555;
oLog.dWorldTimeStamp = ITAClock::getDefaultClock()->getTime();
m_pServerLogger->log(oLog);
*/
}
bAskClient = false;
if (bAskClient)
{
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ITANetAudioStreamingServer] Not enough free samples in client buffer, requesting a trigger when more free samples available" << std::endl;
#endif
ITAServerLog oLog;
oLog.uiBlockId = ++iServerBlockId;
m_pMessage->ResetMessage();
iMsgType = CITANetAudioProtocol::NP_SERVER_GET_RINGBUFFER_FREE_SAMPLES;
m_pMessage->SetMessageType(iMsgType);
m_pMessage->WriteBool(true);
m_pMessage->WriteMessage();
oLog.iProtocolStatus = iMsgType;
oLog.iFreeSamples = m_iClientRingBufferFreeSamples;
oLog.dWorldTimeStamp = ITAClock::getDefaultClock()->getTime();
m_pServerLogger->log(oLog);
}
return false;
}
......
......@@ -20,13 +20,13 @@ using namespace std;
const static string g_sServerName = "localhost";
const static string g_sInputFilePath = "gershwin-mono.wav";
const static int g_iServerPort = 12480;
const static double g_dSampleRate = 44100;
const static int g_iBlockLength = 1024;
const static int g_iChannels = 100;
class CServer : public VistaThread
{
public:
const static double g_dSampleRate = 44100;
const static int g_iBlockLength = 32;
const static int g_iChannels = 2;
class CServer : public VistaThread
{
public:
inline CServer( const string& sInputFilePath )
{
pInputFile = new ITAFileDatasource( sInputFilePath, g_iBlockLength );
......@@ -64,7 +64,7 @@ int main( int, char** )
CServer* pServer = new CServer( g_sInputFilePath );
// Client dumping received stream and mixing down to two channels
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBlockLength, 100 * g_iBlockLength );
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBlockLength, 20 * g_iBlockLength );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBlockLength );
oPatchbay.AddInput( &oNetAudioStream );
......
%% Einlesen der Logs
%% Konfig Kram
close all;
clear all;
BlockSize = '32';
plotServer = 1;
maxSamples = 5*3*2;
%% Einlesen der Logs
NetAudioLogServer = dir(['NetAudioLogServer_BS' BlockSize '*.txt']);
NetAudioLogServer = {NetAudioLogServer.name};
NetAudioLogServerTab = readtable(NetAudioLogServer{1}, 'FileType', 'text', 'Delimiter', '\t');
......@@ -12,8 +16,8 @@ channel = NetAudioLogServer{1}(28:end-4);
for k=2:numel(NetAudioLogServer)
temp = readtable(NetAudioLogServer{k}, 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogServerTab = [NetAudioLogServerTab; temp];
minTimeServer = min(minTime, temp.WorldTimeStamp(1));
maxTimeServer = max(maxTime, temp.WorldTimeStamp(end));
minTimeServer = min(minTimeServer, temp.WorldTimeStamp(1));
maxTimeServer = max(maxTimeServer, temp.WorldTimeStamp(end));
channel = [channel; NetAudioLogServer{k}(28:end-4)];
end
......@@ -25,13 +29,20 @@ maxTimeClient = NetAudioLogClientTab.WorldTimeStamp(end);
for k=2:numel(NetAudioLogClient)
temp = readtable(NetAudioLogClient{k}, 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogClientTab = [NetAudioLogClientTab; temp];
minTimeClient = min(minTime, temp.WorldTimeStamp(1));
maxTimeClient = max(maxTime, temp.WorldTimeStamp(end));
minTimeClient = min(minTimeClient, temp.WorldTimeStamp(1));
maxTimeClient = max(maxTimeClient, temp.WorldTimeStamp(end));
end
NetAudioLogClientTab.WorldTimeStamp = NetAudioLogClientTab.WorldTimeStamp - minTimeClient;
NetAudioLogServerTab.WorldTimeStamp = NetAudioLogServerTab.WorldTimeStamp - minTimeServer;
NetAudioStreamTab = readtable('NetAudioLogStream_BS32_Ch2.txt', 'FileType', 'text', 'Delimiter', '\t');
minTimeClient = min(minTimeClient, NetAudioStreamTab.WorldTimeStamp(1));
NetAudioStreamTab.WorldTimeStamp = (NetAudioStreamTab.WorldTimeStamp - minTimeClient) * 1000;
NetAudioLogClientTab.WorldTimeStamp = (NetAudioLogClientTab.WorldTimeStamp - minTimeClient) * 1000;
NetAudioLogServerTab.WorldTimeStamp = (NetAudioLogServerTab.WorldTimeStamp - minTimeServer) * 1000;
Streaming = NetAudioStreamTab.WorldTimeStamp(find(NetAudioStreamTab.StreamingStatus == 2));
Underruns = NetAudioStreamTab.WorldTimeStamp(find(NetAudioStreamTab.StreamingStatus == 3));
Overruns = NetAudioStreamTab.WorldTimeStamp(find(NetAudioStreamTab.StreamingStatus == 4));
%% Protocolstatus ersetzten
Protocol = {'100', 'NP CLIENT OPEN';...
'101', 'NP CLIENT CLOSE';...
......@@ -39,8 +50,10 @@ Protocol = {'100', 'NP CLIENT OPEN';...
'200', 'NP SERVER OPEN';...
'201', 'NP SERVER CLOSE';...
'211', 'NP SERVER GET RINGBUFFER FREE SAMPLES';...
'222', 'NP SERVER SENDING SAMPLES'};
%NumPro = zeros(size(NetAudioLogServerTab.ProtocolStatus));
'222', 'NP SERVER SENDING SAMPLES';...
'222', 'NP SERVER CALCULATE'};
%% Daten sammlen Client
Time100 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 100));
Time101 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 101));
Time111 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.ProtocolStatus == 111));
......@@ -51,6 +64,7 @@ Time222 = NetAudioLogClientTab.WorldTimeStamp(find(NetAudioLogClientTab.Protocol
TimeClient = {Time100 Time101 Time111 Time200 Time201 Time211 Time222};
%% Daten sammeln Server
Time100 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 100));
Time101 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 101));
Time111 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 111));
......@@ -58,56 +72,54 @@ Time200 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.Protocol
Time201 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 201));
Time211 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 211));
Time222 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 222));
Time555 = NetAudioLogServerTab.WorldTimeStamp(find(NetAudioLogServerTab.ProtocolStatus == 555));
TimeServer = {Time100 Time101 Time111 Time200 Time201 Time211 Time222};
TimeServer = {Time100 Time101 Time111 Time200 Time201 Time211 Time222 Time555};
%% Plot Protocol
%plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.ProtocolStatus)
plots1 = {};
plots2 = {};
subplot(2,2,1:2)
plots1{1} = plot([10 0],[3200 3200]);
hold on
plots1{2} = plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.FreeSamples, '-*');
subplot(2,2,3:4)
maxSamples = 3200;
plots2{1} = plot([10 0],[3200 3200]);
hold on;
plots2{2} = plot(NetAudioLogClientTab.WorldTimeStamp, NetAudioLogClientTab.FreeSamples, '-*');
legendeServer = {};
legendeClient = {};
legendeServer{1} = 'Maximal Freie Samples';
legendeServer{2} = 'Freie Samples Server';
legendeClient{1} = 'Maximal Freie Samples';
legendeClient{2} = 'Freie Samples Client';
legende = {};
if plotServer == 1
% Plot Server Samples
plots1{1} = plot([10 0],[maxSamples maxSamples]);
legende{1} = 'Maximal Freie Samples';
hold on
plots1{2} = plot(NetAudioLogServerTab.WorldTimeStamp, NetAudioLogServerTab.FreeSamples/32, '-*');
legende{2} = 'Freie Samples Server';
else
% Plot Client Samples
plots2{1} = plot([10 0],[maxSamples maxSamples]);
legende{1} = 'Maximal Freie Samples';
hold on;
plots2{2} = plot(NetAudioLogClientTab.WorldTimeStamp, NetAudioLogClientTab.FreeSamples/32, '-*');
legende{2} = 'Freie Samples Client';
plot(Underruns, maxSamples*ones(size(Underruns)), '*')
legende{3} = 'Underruns';
end
i = 3;
j = 3;
for k = (1:7)
if size(TimeServer{k}, 1) ~= 0
subplot(2,2,1:2)
plots1{i} = plot(TimeServer{k}, ones(size(TimeServer{k})),'.');
legendeServer{i} = Protocol{k,2};
i = i + 1;
end
if size(TimeClient{k}, 1) ~= 0
subplot(2,2,3:4)
p = 1;
if k == 3
p = 1500;
j = 4;
for k = (1:8)
if plotServer == 1
if size(TimeServer{k}, 1) ~= 0
plots1{i} = plot(TimeServer{k}, maxSamples*ones(size(TimeServer{k})),'.');
legende{i} = Protocol{k,2};
i = i + 1;
end
titel = 'Protokolstatus Server';
else
if size(TimeClient{k}, 1) ~= 0
p = 1;
if k == 3
p = 1500;
end
plots2{j} = plot(TimeClient{k}, maxSamples*ones(size(TimeClient{k})),'.');
legende{j} = Protocol{k,2};
j = j + 1;
end
plots2{j} = plot(TimeClient{k}, ones(size(TimeClient{k})),'.');
legendeClient{j} = Protocol{k,2};
j = j + 1;
titel = 'Protokolstatus Client';
end
end
subplot(2,2,1:2)
title(['Protokolstatus Server'])
xlabel('Zeit in s')
legend([plots1, plots2], {legendeServer, legendeClient});
subplot(2,2,3:4)
title(['Protokolstatus Client'])
title(titel)
xlabel('Zeit in s')
legend(legende);
legend('show');
\ No newline at end of file
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