Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit 5b5caddc authored by Anne Heimes's avatar Anne Heimes
Browse files

use asio + bugfix matlab

parent 9fe17537
......@@ -8,18 +8,26 @@
#include <ITAFileDatasource.h>
#include <ITAStreamProbe.h>
#include <ITAStreamPatchbay.h>
#include <ITAAsioInterface.h>
#include <VistaBase\VistaTimeUtils.h>
using namespace std;
//static string g_sServerName = "137.226.61.163";
static string g_sServerName = "137.226.61.163";
static string g_sServerName = "137.226.61.85";
static int g_iServerPort = 12480;
static double g_dSampleRate = 44100;
static int g_iBufferSize = 1024;
static int g_iChannels = 100;
static int g_iBufferSize = 32;
static int g_iChannels = 10;
int main( int , char** )
{
std::cout << "BufferSize: " << endl;
cin >> g_iBufferSize;
cout << "ChannelAnzahl: " << endl;
cin >> g_iChannels;
CITANetAudioStream oNetAudioStream( g_iChannels, g_dSampleRate, g_iBufferSize, 1 * g_iBufferSize );
ITAStreamPatchbay oPatchbay( g_dSampleRate, g_iBufferSize );
......@@ -33,43 +41,98 @@ int main( int , char** )
ITAStreamProbe oProbe( oPatchbay.GetOutputDatasource( iOutputID ), "ITANetAudioTest.stream.wav" );
ITAPortaudioInterface ITAPA( g_dSampleRate, g_iBufferSize );
ITAPA.Initialize();
ITAPA.SetPlaybackDatasource( &oProbe );
ITAPA.Open();
ITAPA.Start();
ITAsioInitializeLibrary();
try {
cout << "Will now connect to '" << g_sServerName << "' on port " << g_iServerPort << endl;
if (ITAsioInitializeDriver("ASIO MADIface USB") != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioInit schlug fehl!\n");
return 255;
}
long lBuffersize, lDummy;
if (ITAsioGetBufferSize(&lDummy, &lDummy, &lBuffersize, &lDummy) != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioGetBufferSize schlug fehl!\n");
return 255;
}
if (ITAsioSetSampleRate((ASIOSampleRate)g_dSampleRate) != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioSetSamplerate schlug fehl!\n");
return 255;
}
long lNumInputChannels, lNumOutputChannels;
ASIOError ae;
if ((ae = ITAsioGetChannels(&lNumInputChannels, &lNumOutputChannels)) != ASE_OK)
{
cerr << "Error in ITAsioGetChannels, ASIO error " << ae << " encountered" << endl;
ITAsioFinalizeLibrary();
return 255;
}
if ((ae = ITAsioCreateBuffers(0, 2, lBuffersize)) != ASE_OK)
{
cerr << "Error in ITAsioCreateBuffers, ASIO error " << ae << " encountered" << endl;
ITAsioFinalizeLibrary();
return 255;
}
cout << "Waiting 3 seconds (net audio stream not connected and returning zeros)" << endl;
ITAPA.Sleep( 2.0f );
ITAsioSetPlaybackDatasource(&oProbe);
cout << "Will now connect to '" << g_sServerName << "' on port " << g_iServerPort << endl;
try
{
if( !oNetAudioStream.Connect( g_sServerName, g_iServerPort ) )
ITA_EXCEPT1( INVALID_PARAMETER, "Could not connect to server" );
if (ITAsioStart() != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioStart schlug fehl!\n");
return 255;
}
if (!oNetAudioStream.Connect(g_sServerName, g_iServerPort))
ITA_EXCEPT1(INVALID_PARAMETER, "Could not connect to server");
VistaTimeUtils::Sleep(2 * 1000);
printf("Wiedergabe gestartet ...\n");
VistaTimeUtils::Sleep(20 * 1000);
if (ITAsioStop() != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioStop schlug fehl!\n");
return 255;
}
printf("Wiedergabe beendet!\n");
if (ITAsioDisposeBuffers() != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioDisposeBuffers schlug fehl!\n");
return 255;
}
if (ITAsioFinalizeDriver() != ASE_OK) {
ITAsioFinalizeLibrary();
fprintf(stderr, "Fehler: ITAsioExit schlug fehl!\n");
return 255;
}
}
catch( ITAException e )
{
cout << "Connection failed." << endl;
catch (ITAException e) {
ITAsioFinalizeLibrary();
cerr << e << endl;
return 255;
}
cout << "Connected." << endl;
// Playback
float fSeconds = 900.0f; // 15min
cout << "Playback started, waiting " << fSeconds << " seconds" << endl;
ITAPA.Sleep( fSeconds ); // blocking
cout << "Done." << endl;
cout << "Will now disconnect from '" << g_sServerName << "' and port " << g_iServerPort << endl;
cout << "Closing in 3 seconds (net audio stream not connected and returning zeros)" << endl;
ITAPA.Sleep( 1.0f );
ITAPA.Stop();
ITAPA.Close();
ITAPA.Finalize();
ITAsioFinalizeLibrary();
return 0;
}
%% Einlesen der Logs
close all;
clear all;
NetAudioLogNet = readtable( 'NetAudioLogNet.txt' );
NetAudioLogStream = readtable( 'NetAudioLogStream.txt' );
NetAudioLogClient = readtable( 'NetAudioLogClient.txt' );
NetAudioLogBaseData = readtable( 'NetAudioLogBaseData.txt' );
NetAudioLogNet = readtable( 'NetAudioLogNet.txt', 'FileType', 'text', 'Delimiter', '\t');
NetAudioLogStream = readtable( 'NetAudioLogStream.txt', 'FileType', 'text', 'Delimiter', '\t')
NetAudioLogClient = readtable( 'NetAudioLogClient.txt', 'FileType', 'text', 'Delimiter', '\t' );
NetAudioLogBaseData = readtable( 'NetAudioLogBaseData.txt', 'FileType', 'text', 'Delimiter', '\t' );
% Save Base Data
Channel = NetAudioLogBaseData.Channel(1);
......@@ -54,7 +54,7 @@ sollLatenzVec = zeros(size(LatenzRunnning(:,1)));
sollLatenzVec = sollLatenzVec + sollLatenz;
subplot(2,2,1:4)
plot( LatenzRunnning(:,1), LatenzRunnning(:,2))
plot( LatenzRunnning(:,1), LatenzRunnning(:,2), 'b.')
hold on
plot( LatenzRunnning(:,1), medianRunningVec, 'r')
plot( LatenzRunnning(:,1), sollLatenzVec, 'g')
......@@ -63,9 +63,10 @@ plot( TimeOverrun, zeros(size(TimeOverrun)) + medianRunning,'r*')
AnzahlUnderruns = size(TimeUnderrun);
AnzahlUnderruns = AnzahlUnderruns(1);
AnzahlUnderruns = num2str(AnzahlUnderruns);
RelativeUnderruns = 100 * size(TimeUnderrun) / size(TimeState);
Durchsatz = [num2str((32 * SampleRate * Channel)/1000) ' kbit/s']
title(['Latenz pro Block (' num2str(BufferSize) ' Samples) bei ' num2str(Channel) ' Kanlen'])
legend('Latenz', ['Latenz (' num2str(medianRunning) ' ms)'], ['SollLatenz (' num2str(sollLatenz) ' ms)' ], ['Underruns (Anz. ' AnzahlUnderruns ')'], 'Overruns')
legend('Latenz', ['Latenz (' num2str(medianRunning) ' ms)'], ['SollLatenz (' num2str(sollLatenz) ' ms)' ], ['Underruns (Anz. ' AnzahlUnderruns ' - ' num2str(RelativeUnderruns) '%)'], 'Overruns')
xlabel('Zeit in s')
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