...
 
Commits (48)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project( ITADataSources )
......
......@@ -6,13 +6,13 @@ include( VistaCommon )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
if( TA_DATA_SOURCES_WITH_INTEGRATED_ASIO )
if( ITA_DATA_SOURCES_WITH_INTEGRATED_ASIO )
add_definitions( "-DITA_WHAD_WITH_ASIO" )
endif( TA_DATA_SOURCES_WITH_INTEGRATED_ASIO )
endif( )
if( TA_DATA_SOURCES_WITH_INTEGRATED_PORTAUDIO )
if( ITA_DATA_SOURCES_WITH_INTEGRATED_PORTAUDIO )
add_definitions( "-DITA_WHAD_WITH_PORTAUDIO" )
endif( TA_DATA_SOURCES_WITH_INTEGRATED_PORTAUDIO )
endif( )
add_executable( ita_whad main.cpp )
target_link_libraries( ita_whad ${VISTA_USE_PACKAGE_LIBRARIES} )
......
......@@ -31,26 +31,65 @@ int main( int, char** )
#ifdef ITA_WHAD_WITH_ASIO
string sFileName = "ita_whad_asio.txt";
FILE* file = fopen( sFileName.c_str(), "w" );
string sASIOFileName = "ita_whad_asio.txt";
FILE* pASIOFile = fopen( sASIOFileName.c_str(), "w" );
ITAsioInitializeLibrary();
long lDrivers = ITAsioGetNumDrivers();
if( lDrivers == 0 )
long lASIODrivers = ITAsioGetNumDrivers();
if( lASIODrivers == 0 )
cerr << "Warning: no ASIO drivers found." << endl;
for( long i = 0; i < lDrivers; i++ )
cout << " ### ASIO ### " << endl;
for( long i = 0; i < lASIODrivers; i++ )
{
cout << "[" << i+1 << "] \"" << ITAsioGetDriverName(i) << "\"" << endl;
std::string sDriverName = ITAsioGetDriverName( i );
ASIOError ae = ITAsioInitializeDriver( i );
long iIn = -1, iOut = -1;
if( ae == ASE_OK )
{
ITAsioGetChannels( &iIn, &iOut );
ITAsioFinalizeDriver();
}
cout << "[" << i + 1 << "] \"" << sDriverName << "\" (" << iIn << " in, " << iOut << " out)" << endl;
}
cout << endl;
ITAsioFinalizeLibrary();
fclose( file );
fclose( pASIOFile );
#endif // ITA_WHAD_WITH_ASIO
#ifdef ITA_WHAD_WITH_PORTAUDIO
string sPAFileName = "ita_whad_portaudio.txt";
FILE* pPAFile = fopen( sPAFileName.c_str(), "w" );
ITAPortaudioInterface oITAPA( 44.1e3, 1024 );
oITAPA.Initialize();
int iPANumDevices = oITAPA.GetNumDevices();
int iPADefaultIn = oITAPA.GetDefaultInputDevice();
int iPADefaultOut = oITAPA.GetDefaultOutputDevice();
cout << " ### Portaudio ### " << endl;
for( int i = 0; i < iPANumDevices; i++ )
{
string sExtra = "";
if( i == iPADefaultIn || i == iPADefaultOut )
sExtra = " *";
cout << "[" << i + 1 << "] \"" << oITAPA.GetDeviceName( i ) << "\"" << sExtra << endl;
}
cout << endl;
oITAPA.Finalize();
fclose( pPAFile );
#endif // ITA_WHAD_WITH_PORTAUDIO
return 0;
}
......@@ -151,6 +151,18 @@ public:
//! Wiederholung Ein-/Ausschalten
void SetLoopMode(bool bLoopMode);
//! Sets the looping mode
/**
* @param[in] bLoopingEnabled True means looping, false will play until EOF
*/
void SetIsLooping( bool bLoopingEnabled );
//! Looping mode getter
/**
* @return True means looping, false will play until EOF
*/
bool GetIsLooping();
//! Arbeitsbereich (region of interest) festlegen
/**
* Legt den Arbeitsbereich fest, d.h. das Interval in den Quellendaten, aus dem die
......
......@@ -16,7 +16,7 @@
#ifndef _ITADATASOURCEDELEGATOR_H_
#define _ITADATASOURCEDELEGATOR_H_
#include <ITADatasource.h>
#include <ITADataSource.h>
/**
* Diese Klasse implementiert die Schnittstelle der ITADatasource, stellt die
......@@ -74,4 +74,4 @@ private:
ITADatasource* m_pDatasourceDelegatorTarget;
};
#endif // _ITADATASOURCEDELEGATOR_H_
\ No newline at end of file
#endif // _ITADATASOURCEDELEGATOR_H_
......@@ -49,7 +49,8 @@
*
* \ingroup datasources
*/
class ITA_DATA_SOURCES_API ITAFileDatasource : public ITABufferDatasource {
class ITA_DATA_SOURCES_API ITAFileDatasource : public ITABufferDatasource
{
public:
//! Konstruktor
/**
......
......@@ -38,27 +38,23 @@
class VistaConnectionIP;
//! Network audio messages
/*
* Messages consist of a message part and an answer part, each read or written
* separately. Messages have a three-int-header (SIZE, MSGTYPE, ID), and
* answers have a three-int header (SIZE, ANSWERTYPE, ID)
*
* @todo move to src folder
*/
/**
* Messages consist of a message part and an answer part, each read or written
* separately. Messages have a three-int-header (SIZE, MSGTYPE, ID), and
* answers have a three-int header (SIZE, ANSWERTYPE, ID)
*
* @todo move to src folder
*/
class ITA_DATA_SOURCES_API CITANetAudioMessage
{
public:
CITANetAudioMessage( VistaSerializingToolset::ByteOrderSwapBehavior bSwapBuffers );
CITANetAudioMessage( VistaConnectionIP* );
void SetConnection( VistaConnectionIP* );
VistaConnectionIP* GetConnection() const;
void ClearConnection();
void WriteMessage();
void ReadMessage();
void WriteAnswer();
void ReadAnswer();
bool TryReadMessage();
void ResetMessage();
......@@ -67,10 +63,7 @@ public:
bool GetOutgoingMessageHasData() const;
void SetMessageType( int nType );
void SetAnswerType( int nType );
int GetMessageType() const;
int GetAnswerType() const;
void WriteInt( const int );
void WriteBool( const bool );
......@@ -98,15 +91,14 @@ public:
int ReadRingBufferFree();
void ReadSampleFrame(ITASampleFrame* pSampleFrame);
private:
int m_nMessageType;
int m_nMessageId;
int m_nAnswerType;
VistaByteBufferSerializer m_oOutgoing; //!< Serialization buffer for messages
VistaByteBufferDeSerializer m_oIncoming; //!< Deserialization buffer for messages
std::vector< VistaType::byte > m_vecIncomingBuffer; // Net IO buffer
int m_nTimeoutMilliseconds; //!< Timeout for try-read message
VistaConnectionIP* m_pConnection;
};
......
......@@ -60,12 +60,11 @@ public:
static const int NP_SERVER_OPEN = 201;
static const int NP_SERVER_GET_RINGBUFFER_SIZE = 210;
static const int NP_SERVER_GET_RINGBUFFER_FREE = 211;
static const int NP_SERVER_WAITING_FOR_TRIGGER = 221;
static const int NP_SERVER_SEND_SAMPLES = 222;
CITANetAudioProtocol();
virtual ~CITANetAudioProtocol();
inline CITANetAudioProtocol() {};
inline ~CITANetAudioProtocol() {};
struct StreamingParameters
{
int iChannels;
......@@ -83,7 +82,9 @@ public:
{
if( ( iChannels == rhs.iChannels ) && ( dSampleRate == rhs.dSampleRate ) && ( iBlockSize == rhs.iBlockSize ) )
return true;
}
else
return false;
};
};
};
......
......@@ -34,6 +34,7 @@ using namespace std;
class CITANetAudioStreamingClient;
class ITABufferedDataLoggerImplStream;
class ITABufferedDataLoggerImplNet;
class ITABufferedDataLoggerImplAudio;
//! Network audio stream
/**
......@@ -94,12 +95,34 @@ public:
void SetAllowedLatencySamples( int iLatencySamples );
float GetAllowedLatencySeconds() const;
int GetAllowedLatencySamples() const;
//! Sets the minimal latency possible
/**
* Real-time network audio is considered to process at lowest latency possible.
* However, this implementation requires at least one block. Hence latency is
* depending on sampling rate and block length.
*
* @sa GetMinimumLatencySamples()
* @sa GetMinimumLatencySamples()
*/
float GetMinimumLatencySeconds() const;
float GetMaximumLatencySeconds() const;
int GetMinimumLatencySamples() const;
int GetMaximumLatencySamples() const;
//! Sets the latency for real-time processing
/**
* Real-time network audio is considered to process at lowest latency possible.
* However, this implementation requires at least one block. Hence latency is
* depending on sampling rate and block length. This method basically
* sets the minimum allowed latency to this value.
*
* @sa GetMinimumLatencySeconds()
* @sa SetAllowedLatencySeconds()
*/
void SetLatencyForRealtime();
//! Returns (static) size of ring buffer
/**
* @return Number of maximum samples that can be hold by internal ring buffer
......@@ -186,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
......
......@@ -36,6 +36,7 @@ class CITANetAudioClient;
class CITANetAudioMessage;
class CITANetAudioProtocol;
class CITANetAudioStream;
class ITABufferedDataLoggerImplClient;
//! Network audio streaming client
/**
......@@ -64,10 +65,11 @@ protected:
private:
CITANetAudioClient* m_pClient;
CITANetAudioStream* m_pStream;
ITAStreamProbe* m_pStreamProbe;
CITANetAudioProtocol* m_pProtocol;
CITANetAudioMessage* m_pMessage;
CITANetAudioMessage* m_pIncomingMessage;
CITANetAudioMessage* m_pOutgoingMessage;
VistaConnectionIP* m_pConnection;
VistaThreadEvent m_oBlockIncrementEvent;
......@@ -77,6 +79,8 @@ private:
CITANetAudioProtocol::StreamingParameters m_oParams;
bool m_bStopIndicated;
int iStreamingBlockId;
ITABufferedDataLoggerImplClient* m_pClientLogger;
friend class CITANetAudioStream;
};
......
......@@ -32,8 +32,6 @@
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
#include <ITASampleFrame.h>
using namespace std;
class ITADatasource;
class CITANetAudioMessage;
......@@ -79,7 +77,6 @@ public:
void SetAutomaticUpdateRate();
protected:
int Transmit( const ITASampleFrame& sfNewSamples, int iNumSamples );
ITADatasource* GetInputStream() const;
private:
......@@ -89,14 +86,13 @@ private:
VistaConnectionIP* m_pConnection;
CITANetAudioProtocol::StreamingParameters m_oServerParams;
CITANetAudioMessage* m_pMessage;
CITANetAudioMessage* m_pIncomingMessage;
CITANetAudioMessage* m_pOutgoingMessage;
int m_iUpdateStrategy;
int m_iClientRingBufferFreeSamples;
friend class CITANetAudioServer;
ofstream outputFile;
};
#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_STREAMING_SERVER
......@@ -40,7 +40,7 @@ class ITA_DATA_SOURCES_API ITAPortaudioInterface
{
public:
//! ITAPortaudio error code table
typedef enum ITA_PA_ERRORCODE
enum ITA_PA_ERRORCODE
{
//! Portaudio/ITAPortaudio no error
ITA_PA_NO_ERROR=0,
......@@ -161,7 +161,7 @@ public:
};
//! Portaudio available host APIs
typedef enum ITA_PA_HOST_APIS
enum ITA_PA_HOST_APIS
{
ITA_PA_DIRECT_SOUND = 1, //!< Windows DirectSound
ITA_PA_MME = 2, //!< Windows MME
......
......@@ -693,8 +693,17 @@ ITASIO_API ASIOError ITAsioInitializeDriver(const char* pszDriverName) {
// Mutex in Besitz bringen
EnterCriticalSection(&csExternal);
// Load the driver, this will setup all the necessary internal data structures
asioDrivers->loadDriver((char*) pszDriverName);
// Load the driver, this will setup all the necessary internal data structures
try
{
bool bLoadSuccess = asioDrivers->loadDriver( ( char* ) pszDriverName );
if( !bLoadSuccess )
return ASE_NotPresent;
}
catch( ... )
{
return ASE_NotPresent;
}
ASIOError aeResult = ASIOInit(&asioDriverInfo.driverInfo);
if (aeResult != ASE_OK) {
......
......@@ -176,6 +176,16 @@ void ITABufferDatasource::SetCursor(unsigned int uiNewCursor) {
m_iCursor = (int) uiNewCursor;
}
void ITABufferDatasource::SetIsLooping( bool bEnabled )
{
SetLoopMode( bEnabled );
}
bool ITABufferDatasource::GetIsLooping()
{
return GetLoopMode();
}
bool ITABufferDatasource::GetLoopMode() {
/* TODO: Diese Implementierung ist NICHT THREAD-SAFE.
m_bLoopMode kann durch IncrementReadPointer modifiziert werden,
......@@ -190,6 +200,7 @@ void ITABufferDatasource::SetLoopMode(bool bLoopMode) {
m_bChangeLoopMode = true;
}
bool ITABufferDatasource::IsPaused() const {
return m_bPaused;
}
......
......@@ -71,15 +71,18 @@ void WriteFromDatasourceToBuffer(ITADatasource* pSource,
unsigned int k = (uiNumberOfSamples - n);
if (k > uiBlocklength) k = uiBlocklength;
if (!pfData)
// Stille einfgen
for (unsigned int j=0; j<uiBlocklength; j++) ppfDest[i][n + j] = 0;
else {
if (dGain = 1.0)
memcpy(ppfDest[i] + n, pfData, k * sizeof(float));
if( !pfData )
{ // Stille einfgen
for( unsigned int j = 0; j < uiBlocklength; j++ )
ppfDest[ i ][ n + j ] = 0;
}
else
{
if( dGain == 1.0f )
memcpy( ppfDest[ i ] + n, pfData, k * sizeof( float ) );
else
for (unsigned int j=0; j<k; j++)
ppfDest[i][n + j] = (float) ((double) pfData[j] * dGain);
for( unsigned int j = 0; j < k; j++ )
ppfDest[ i ][ n + j ] = ( float ) ( ( double ) pfData[ j ] * dGain );
}
}
......
This diff is collapsed.
#include <ITANetAudioProtocol.h>
CITANetAudioProtocol::CITANetAudioProtocol()
{
}
CITANetAudioProtocol::~CITANetAudioProtocol()
{
}
// @todo remove (all inline implemented)
\ No newline at end of file
......@@ -9,12 +9,45 @@
#include <ITAClock.h>
#include <iomanip>
// STL
// Vista includes
#include <VistaBase/VistaStreamUtils.h>
// STL includes
#include <cmath>
#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 )
......@@ -79,6 +112,7 @@ struct ITANetLog : public ITALogDataBase
int iNumSamplesTransmitted;
};
class ITABufferedDataLoggerImplAudio : public ITABufferedDataLogger < ITAAudioLog > {};
class ITABufferedDataLoggerImplStream : public ITABufferedDataLogger < ITAStreamLog > {};
class ITABufferedDataLoggerImplNet : public ITABufferedDataLogger < ITANetLog > {};
......@@ -90,7 +124,7 @@ CITANetAudioStream::CITANetAudioStream( int iChannels, double dSamplingRate, int
, m_bRingBufferFull( false )
, m_iStreamingStatus( INVALID )
, m_dLastStreamingTimeCode( 0.0f )
, m_iTargetSampleLatency( 5*iBufferSize )
, m_iTargetSampleLatency( iRingBufferCapacity )
{
m_bRingBufferFull = false;
if( iBufferSize > iRingBufferCapacity )
......@@ -103,20 +137,36 @@ 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");
m_pAudioLogger = new ITABufferedDataLoggerImplAudio( );
m_pAudioLogger->setOutputFile(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( "NetAudioLogStream.txt" );
m_pStreamLogger->setOutputFile(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( "NetAudioLogNet.txt" );
m_pNetLogger->setOutputFile(paras);
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_pNetAudioStreamingClient;
delete m_pStreamLogger;
delete m_pNetLogger;
delete m_pStreamLogger;
delete m_pAudioLogger;
delete m_pNetAudioStreamingClient;
}
bool CITANetAudioStream::Connect( const std::string& sAddress, int iPort )
......@@ -176,11 +226,17 @@ int CITANetAudioStream::GetMaximumLatencySamples() const
return GetRingBufferSize();
}
void CITANetAudioStream::SetLatencyForRealtime()
{
SetAllowedLatencySamples( GetMinimumLatencySamples() );
}
const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const ITAStreamInfo* pInfo )
{
if( !GetIsConnected() )
{
m_sfOutputStreamBuffer[ uiChannel ].Zero( );
m_iStreamingStatus = STOPPED;
}
else
{
......@@ -188,6 +244,9 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const
{
m_sfOutputStreamBuffer[ uiChannel ].Zero();
m_iStreamingStatus = BUFFER_UNDERRUN;
#if NET_AUDIO_SHOW_TRAFFIC
//vstr::out() << "[ Stream ] Buffer underrun" << std::endl;
#endif
}
else
{
......@@ -196,12 +255,18 @@ const float* CITANetAudioStream::GetBlockPointer( unsigned int uiChannel, const
// @todo: fade out
m_sfRingBuffer[ uiChannel ].Zero();
m_iStreamingStatus = BUFFER_UNDERRUN;
#if NET_AUDIO_SHOW_TRAFFIC
//vstr::out() << "[ Stream ] Buffer underrun" << std::endl;
#endif
}
else
{
// Normal behaviour (if everything is OK with ring buffer status)
m_sfRingBuffer[ uiChannel ].cyclic_read( m_sfOutputStreamBuffer[ uiChannel ].GetData(), GetBlocklength(), m_iReadCursor );
m_iStreamingStatus = STREAMING;
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ Stream ] Streaming" << std::endl;
#endif
}
}
}
......@@ -216,20 +281,31 @@ void CITANetAudioStream::IncrementBlockPointer()
{
// Increment read cursor by one audio block and wrap around if exceeding ring buffer
int iSavedSample = GetRingBufferSize( ) - GetRingBufferFreeSamples( );
if ( iSavedSample >= int( GetBlocklength( ) ) )
if ( !GetIsConnected( ) )
{
m_iStreamingStatus = STOPPED;
} else if ( iSavedSample >= int( GetBlocklength( ) ) )
{
//es wurden Samples abgespielt
m_iReadCursor = ( m_iReadCursor + m_sfOutputStreamBuffer.GetLength() ) % m_sfRingBuffer.GetLength();
m_iStreamingStatus = STREAMING;
#if NET_AUDIO_SHOW_TRAFFIC
//vstr::out() << "[ Stream ] Streaming" << std::endl;
#endif
}
else if ( GetIsRingBufferEmpty( ) )
{
m_iStreamingStatus = BUFFER_UNDERRUN;
#if NET_AUDIO_SHOW_TRAFFIC
//vstr::out() << "[ Stream ] Buffer underrun" << std::endl;
#endif
}
else
{
m_iStreamingStatus = BUFFER_OVERRUN;
m_iStreamingStatus = BUFFER_UNDERRUN;
#if NET_AUDIO_SHOW_TRAFFIC
//vstr::out() << "[ Stream ] Buffer underrun" << std::endl;
#endif
m_iReadCursor = m_iWriteCursor;
}
m_bRingBufferFull = false;
......@@ -239,7 +315,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();
......@@ -258,32 +334,40 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
if ( ( m_iWriteCursor == m_iReadCursor ) && m_bRingBufferFull )
{
// BufferFull
oLog.iBufferStatus = 1;
m_iStreamingStatus = BUFFER_OVERRUN;
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ NetAudio ] Buffer overrun" << std::endl;
#endif
}
else if( GetRingBufferFreeSamples() < iNumSamples )
{
// @todo: only partly write
//std::cerr << "BUFFER_OVERRUN! Would partly write samples because ring buffer will be full then." << std::endl;
m_iStreamingStatus = BUFFER_OVERRUN;
m_iWriteCursor = m_iReadCursor;
oLog.iBufferStatus = 2;
}
else
{
// write samples into ring buffer
m_sfRingBuffer.cyclic_write( sfNewSamples, iNumSamples, 0, iCurrentWriteCursor );
m_bRingBufferFull = false;
oLog.iBufferStatus = 1;
m_iStreamingStatus = STREAMING;
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ NetAudio ] Buffer write" << std::endl;
#endif
// set write curser
m_iWriteCursor = ( m_iWriteCursor + iNumSamples ) % GetRingBufferSize( );
if ( m_iWriteCursor == m_iReadCursor )
{
m_bRingBufferFull = true;
oLog.iBufferStatus = 1;
#if NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ NetAudio ] Buffer overrun" << std::endl;
#endif
}
}
oLog.iBufferStatus = m_iStreamingStatus;
oLog.dWorldTimeStamp = ITAClock::getDefaultClock( )->getTime( );
oLog.uiBlockId = ++iAudioStreamingBlockID;
oLog.iFreeSamples = GetRingBufferFreeSamples( );
......@@ -293,7 +377,6 @@ int CITANetAudioStream::Transmit( const ITASampleFrame& sfNewSamples, int iNumSa
return GetRingBufferFreeSamples();
}
int CITANetAudioStream::GetRingBufferAvailableSamples() const
{
return GetRingBufferSize() - GetRingBufferFreeSamples();
......
......@@ -3,8 +3,47 @@
#include <ITANetAudioClient.h>
#include <ITANetAudioMessage.h>
#include <ITANetAudioStream.h>
#include <ITADataLog.h>
#include <ITAClock.h>
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaBase/VistaStreamUtils.h>
//! Audio streaming log item
struct ITAClientLog : public ITALogDataBase
{
inline static std::ostream& outputDesc( std::ostream& os )
{
os << "BlockId";
os << "\t" << "WorldTimeStamp";
os << "\t" << "ProtocolStatus";
os << "\t" << "FreeSamples";
os << "\t" << "Channel";
os << std::endl;
return os;
};
inline std::ostream& outputData( std::ostream& os ) const
{
os << uiBlockId;
os << "\t" << std::setprecision( 12 ) << dWorldTimeStamp;
os << "\t" << iProtocolStatus;
os << "\t" << iFreeSamples;
os << "\t" << iChannel;
os << std::endl;
return os;
};
unsigned int uiBlockId; //!< Block identifier (audio streaming)
double dWorldTimeStamp;
int iProtocolStatus; //!< ... usw
int iFreeSamples;
int iChannel;
};
class ITABufferedDataLoggerImplClient : public ITABufferedDataLogger < ITAClientLog > {};
CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pParent )
: m_oBlockIncrementEvent( VistaThreadEvent::WAITABLE_EVENT )
......@@ -12,27 +51,21 @@ CITANetAudioStreamingClient::CITANetAudioStreamingClient( CITANetAudioStream* pP
, m_pConnection( NULL )
, m_bStopIndicated( false )
{
m_pStreamProbe = new ITAStreamProbe( pParent, "output.wav" );
m_pClient = new CITANetAudioClient();
m_oParams.iChannels = pParent->GetNumberOfChannels();
m_oParams.dSampleRate = pParent->GetSampleRate();
m_oParams.iBlockSize = pParent->GetBlocklength();
m_pMessage = new CITANetAudioMessage( VistaSerializingToolset::SWAPS_MULTIBYTE_VALUES );
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");
m_pClientLogger = new ITABufferedDataLoggerImplClient( );
m_pClientLogger->setOutputFile(paras);
iStreamingBlockId = 0;
}
CITANetAudioStreamingClient::~CITANetAudioStreamingClient()
{
if( m_pConnection )
{
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_CLOSE );
m_pMessage->WriteMessage();
m_pClient->Disconnect();
}
delete m_pClientLogger;
}
bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPort )
......@@ -45,25 +78,13 @@ bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPor
m_pConnection = m_pClient->GetConnection();
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pIncomingMessage = new CITANetAudioMessage( m_pConnection );
m_pOutgoingMessage = new CITANetAudioMessage( m_pConnection );
// Validate streaming parameters of server and client
m_pMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_OPEN );
m_pMessage->WriteStreamingParameters( m_oParams );
m_pMessage->WriteMessage();
m_pMessage->ReadAnswer();
assert( m_pMessage->GetAnswerType() == CITANetAudioProtocol::NP_SERVER_OPEN );
bool bOK = m_pMessage->ReadBool();
/* Not yet
CITANetAudioProtocol::StreamingParameters oServerParams = m_pMessage->ReadStreamingParameters();
if (!(oServerParams == m_oParams))
ITA_EXCEPT1( INVALID_PARAMETER, "Streaming parameters of network audio server and client do not match." );
*/
if( !bOK )
ITA_EXCEPT1( INVALID_PARAMETER, "Streaming server declined connection, detected streaming parameter mismatch." );
m_pOutgoingMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_OPEN );
m_pOutgoingMessage->WriteStreamingParameters( m_oParams );
m_pOutgoingMessage->WriteMessage();
Run();
......@@ -72,39 +93,46 @@ bool CITANetAudioStreamingClient::Connect( const std::string& sAddress, int iPor
bool CITANetAudioStreamingClient::LoopBody()
{
ITAClientLog oLog;
oLog.uiBlockId = ++iStreamingBlockId;
if( m_bStopIndicated )
return true;
// Send message to server that samples can be received
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_WAITING_FOR_SAMPLES );
int iFreeSamplesUntilAllowedReached = m_pStream->GetAllowedLatencySamples() - m_pStream->GetRingBufferAvailableSamples();
if( iFreeSamplesUntilAllowedReached < 0 )
iFreeSamplesUntilAllowedReached = 0;
m_pMessage->WriteInt( iFreeSamplesUntilAllowedReached );
m_pMessage->WriteMessage();
// Wait for answer of server
m_pMessage->ReadAnswer();
int iAnswerType = m_pMessage->GetAnswerType();
switch( iAnswerType )
// Send message to server that (and how many) samples can be received
m_pIncomingMessage->ResetMessage();
if( !m_pIncomingMessage->TryReadMessage() )
{
int iFreeSamplesUntilAllowedReached = m_pStream->GetAllowedLatencySamples() - m_pStream->GetRingBufferAvailableSamples();
oLog.iFreeSamples = iFreeSamplesUntilAllowedReached;
if( iFreeSamplesUntilAllowedReached < 0 )
iFreeSamplesUntilAllowedReached = 0;
m_pOutgoingMessage->ResetMessage();
m_pIncomingMessage->SetMessageType( CITANetAudioProtocol::NP_CLIENT_WAITING_FOR_SAMPLES );
m_pOutgoingMessage->WriteInt( iFreeSamplesUntilAllowedReached );
m_pOutgoingMessage->WriteMessage();
return false;
}
int iIncomingMessageType = m_pIncomingMessage->GetMessageType();
switch( iIncomingMessageType )
{
case CITANetAudioProtocol::NP_INVALID:
// Something went wrong
std::cerr << "Received invalid message type" << std::endl;
vstr::err() << "Received invalid message type" << std::endl;
break;
case CITANetAudioProtocol::NP_SERVER_WAITING_FOR_TRIGGER:
// Wait until block increment is triggered by audio context (more free samples in ring buffer)
m_oBlockIncrementEvent.WaitForEvent( true );
case CITANetAudioProtocol::NP_SERVER_CLOSE:
Disconnect();
break;
case CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES:
// Receive samples from net message and forward them to the stream ring buffer
m_pMessage->ReadSampleFrame( &m_sfReceivingBuffer );
m_pIncomingMessage->ReadSampleFrame( &m_sfReceivingBuffer );
if ( m_pStream->GetRingBufferFreeSamples( ) >= m_sfReceivingBuffer.GetLength( ) )
m_pStream->Transmit( m_sfReceivingBuffer, m_sfReceivingBuffer.GetLength( ) );
//else
......@@ -114,7 +142,10 @@ bool CITANetAudioStreamingClient::LoopBody()
case CITANetAudioProtocol::NP_SERVER_GET_RINGBUFFER_FREE :
break;
}
oLog.iChannel = m_pStream->GetNumberOfChannels();
oLog.iProtocolStatus = iIncomingMessageType;
oLog.dWorldTimeStamp = ITAClock::getDefaultClock( )->getTime( );
m_pClientLogger->log( oLog );
return true;
}
......@@ -131,9 +162,10 @@ bool CITANetAudioStreamingClient::GetIsConnected() const
void CITANetAudioStreamingClient::Disconnect()
{
m_bStopIndicated = true;
StopGently( true );
delete m_pConnection;
delete m_pIncomingMessage;
delete m_pOutgoingMessage;
m_pConnection = NULL;
m_bStopIndicated = false;
......
......@@ -14,6 +14,7 @@
#include <VistaInterProcComm/IPNet/VistaTCPSocket.h>
#include <VistaBase/VistaTimeUtils.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>
#include <VistaBase/VistaStreamUtils.h>
// STL
#include <cmath>
......@@ -23,8 +24,8 @@ CITANetAudioStreamingServer::CITANetAudioStreamingServer()
: m_pInputStream( NULL )
, m_iUpdateStrategy( AUTO )
, m_pConnection( NULL )
, m_pNetAudioServer( new CITANetAudioServer() )
{
m_pNetAudioServer = new CITANetAudioServer( );
}
bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort )
......@@ -32,63 +33,91 @@ bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort
if( !m_pInputStream )
ITA_EXCEPT1( MODAL_EXCEPTION, "Can not start server without a valid input stream" );
// TODO: vorr�ckgabe noch anfangen zu senden (Samples)
if( !m_pNetAudioServer->Start( sAddress, iPort ) ) // blocking
return false;
m_pConnection = m_pNetAudioServer->GetConnection();
m_pMessage = new CITANetAudioMessage( m_pConnection->GetByteorderSwapFlag() );
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pMessage->ReadMessage(); // blocking
assert( m_pMessage->GetMessageType() == CITANetAudioProtocol::NP_CLIENT_OPEN );
CITANetAudioProtocol::StreamingParameters oClientParams = m_pMessage->ReadStreamingParameters();
bool bOK = false;
if (m_pInputStream->GetNumberOfChannels() == oClientParams.iChannels &&
m_pInputStream->GetSampleRate() == oClientParams.dSampleRate &&
m_pInputStream->GetBlocklength() == oClientParams.iBlockSize)
{
bOK = true;
}
std::cout << " Client Data: \nAnzahl Channel: " << oClientParams.iChannels << std::endl;
std::cout << "SampleRate: " << oClientParams.dSampleRate << std::endl;
std::cout << "Blockgroesse: " << oClientParams.iBlockSize << std::endl;
std::cout << " Server Data: \nAnzahl Channel: " << m_pInputStream->GetNumberOfChannels() << std::endl;
std::cout << "SampleRate: " << m_pInputStream->GetSampleRate() << std::endl;
std::cout << "Blockgroesse: " << m_pInputStream->GetBlocklength() << std::endl;
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_OPEN );
m_pMessage->WriteBool( bOK );
m_pMessage->WriteAnswer();
m_pIncomingMessage = new CITANetAudioMessage( m_pConnection );
m_pOutgoingMessage = new CITANetAudioMessage( m_pConnection );
Run();
return true;
}
bool CITANetAudioStreamingServer::IsClientConnected() const
bool CITANetAudioStreamingServer::LoopBody()
{
return m_pNetAudioServer->IsConnected();
}
m_pIncomingMessage->ResetMessage();
std::string CITANetAudioStreamingServer::GetNetworkAddress() const
{
return m_pNetAudioServer->GetServerAddress();
}
if( m_pIncomingMessage->TryReadMessage() )
{
int iMsgType = m_pIncomingMessage->GetMessageType();
switch( iMsgType )
{
case CITANetAudioProtocol::NP_CLIENT_OPEN:
vstr::out() << m_pIncomingMessage->ReadStreamingParameters().dSampleRate << std::endl;
break;
int CITANetAudioStreamingServer::GetNetworkPort() const
{
return m_pNetAudioServer->GetNetworkPort();
}
case CITANetAudioProtocol::NP_CLIENT_WAITING_FOR_SAMPLES:
{
int iFreeSamples = m_pIncomingMessage->ReadInt();
void CITANetAudioStreamingServer::Stop()
{
m_pNetAudioServer->Stop();
if( iFreeSamples >= int( m_pInputStream->GetBlocklength() ) )
{
// Send Samples
for( int i = 0; i < int( m_pInputStream->GetNumberOfChannels() ); i++ )
{
ITAStreamInfo oStreamInfo;
oStreamInfo.nSamples = m_sfTempTransmitBuffer.GetLength();
const float* pfData = m_pInputStream->GetBlockPointer( i, &oStreamInfo );
if( pfData != 0 )
m_sfTempTransmitBuffer[ i ].write( pfData, m_sfTempTransmitBuffer.GetLength() );
}
m_pInputStream->IncrementBlockPointer();
m_pOutgoingMessage->ResetMessage();
m_pOutgoingMessage->SetMessageType( CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES );
m_pIncomingMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pIncomingMessage->WriteMessage();
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ITANetAudioStreamingServer] Transmitted "<< m_sfTempTransmitBuffer.GetLength() << " samples for "
<< m_pInputStream->GetNumberOfChannels() << " channels" << std::endl;
#endif
}
else
{
#ifdef NET_AUDIO_SHOW_TRAFFIC
vstr::out() << "[ITANetAudioStreamingServer] Not enough free samples in client buffer, continuing without sending samples" << std::endl;
#endif
break;
}
break;
}
case CITANetAudioProtocol::NP_CLIENT_CLOSE:
{
Stop();
return false;
}
default:
{
vstr::out() << "[ITANetAudioStreamingServer] Unkown protocol type : " << iMsgType << std::endl;
break;
}
}
}
else
{
// Request ringbuffer free sample size
m_pOutgoingMessage->ResetMessage();
m_pOutgoingMessage->SetMessageType( CITANetAudioProtocol::NP_SERVER_GET_RINGBUFFER_FREE );
m_pOutgoingMessage->WriteMessage();
}
return false;
}
void CITANetAudioStreamingServer::SetInputStream( ITADatasource* pInStream )
......@@ -98,7 +127,14 @@ void CITANetAudioStreamingServer::SetInputStream( ITADatasource* pInStream )
m_pInputStream = pInStream;
m_sfTempTransmitBuffer.init( m_pInputStream->GetNumberOfChannels(), m_pInputStream->GetBlocklength(), true );
m_oServerParams.dSampleRate = m_pInputStream->GetSampleRate();
m_oServerParams.iBlockSize = m_pInputStream->GetBlocklength();
m_oServerParams.iChannels = m_pInputStream->GetNumberOfChannels();
}
ITADatasource* CITANetAudioStreamingServer::GetInputStream() const
{
return m_pInputStream;
}
int CITANetAudioStreamingServer::GetNetStreamBlocklength() const
......@@ -116,70 +152,22 @@ void CITANetAudioStreamingServer::SetAutomaticUpdateRate()
m_iUpdateStrategy = AUTO;
}
bool CITANetAudioStreamingServer::LoopBody()
bool CITANetAudioStreamingServer::IsClientConnected() const
{
m_pMessage->ResetMessage();
m_pMessage->SetConnection( m_pConnection );
m_pMessage->ReadMessage(); // blocking
int iMsgType = m_pMessage->GetMessageType();
switch( iMsgType )
{
case CITANetAudioProtocol::NP_CLIENT_WAITING_FOR_SAMPLES:
{
int iFreeSamples = m_pMessage->ReadInt();
if( iFreeSamples >= m_pInputStream->GetBlocklength() )
{
// Send Samples
for( int i = 0; i < m_pInputStream->GetNumberOfChannels(); i++ )
{
ITAStreamInfo oStreamInfo;
oStreamInfo.nSamples = m_sfTempTransmitBuffer.GetLength();
const float* pfData = m_pInputStream->GetBlockPointer( i, &oStreamInfo );
if( pfData != 0 )
m_sfTempTransmitBuffer[ i ].write( pfData, m_sfTempTransmitBuffer.GetLength() );
}
m_pInputStream->IncrementBlockPointer();
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_SEND_SAMPLES );
m_pMessage->WriteSampleFrame( &m_sfTempTransmitBuffer );
m_pMessage->WriteAnswer();
}
else
{
// Waiting for Trigger
m_pMessage->SetAnswerType( CITANetAudioProtocol::NP_SERVER_WAITING_FOR_TRIGGER );
m_pMessage->WriteAnswer();
break;
}
float fTimeOut = m_pInputStream->GetBlocklength() / m_pInputStream->GetSampleRate();
break;
}
case CITANetAudioProtocol::NP_CLIENT_CLOSE:
{
m_pConnection = NULL;
StopGently( true );
Stop();
return false;
}
default:
{
std::cout << "Unkown protocol type: " << iMsgType << std::endl;
break;
}
}
return m_pNetAudioServer->IsConnected();
}
return true;
std::string CITANetAudioStreamingServer::GetNetworkAddress() const
{
return m_pNetAudioServer->GetServerAddress();
}
ITADatasource* CITANetAudioStreamingServer::GetInputStream() const
int CITANetAudioStreamingServer::GetNetworkPort() const
{
return m_pInputStream;
return m_pNetAudioServer->GetNetworkPort();
}
int CITANetAudioStreamingServer::Transmit(const ITASampleFrame& sfNewSamples, int iNumSamples)
void CITANetAudioStreamingServer::Stop()
{
return 0;
m_pNetAudioServer->Stop();
}
......@@ -8,6 +8,8 @@
#include <ITADataSourceRealization.h>
#include <ITAStreamInfo.h>
class PaStreamCallbackTimeInfo;
// Portaudio Callback Function
static int PortaudioCallbackFunction( const void*, void*, unsigned long, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void* );
......
......@@ -150,7 +150,7 @@ void ITAStreamPatchbay::SetInputDatasource( const int iInput, ITADatasource* pds
ITA_EXCEPT1( INVALID_PARAMETER, "Datasource properties do not match the input properties (num channel missmatch" );
if( pdsDatasource->GetSampleRate() != m_dSamplerate )
ITA_EXCEPT1( INVALID_PARAMETER, "Datasource properties do not match the input properties (samplerate missmatch" );
if( (unsigned int) pdsDatasource->GetBlocklength() != m_iBlockLength )
if( (int) pdsDatasource->GetBlocklength() != m_iBlockLength )
ITA_EXCEPT1( INVALID_PARAMETER, "Datasource properties do not match the input properties (blocklength missmatch)" );
}
......@@ -445,6 +445,7 @@ void ITAStreamPatchbay::HandleProcessStream( ITADatasourceRealization* pSender,
{
// Output X wants data
OutputDesc* pOutput = dynamic_cast< OutputDesc* >( pSender );
assert( pOutput != nullptr );
// Produce all data?
if( m_bProcessData ) {
......
#include <ITAPortaudioInterface.h>
#include <ITADataSource.h>
//#include <ITADatasourceUtils.h>
#include <ITADataSourceUtils.h>
#include <ITABufferDataSink.h>
#include <ITASampleFrame.h>
......@@ -36,9 +36,9 @@ void record()
vpfRecordData[ i ] = sfRecordData[ i ].data();
ITAPA.Start();
ITABufferDataSink oBufferRec( pdsRecordDatasource, vpfRecordData, g_iBlockSize );
oBufferRec.Transfer( nRecordSamples );
//WriteFromDatasourceToFile( pdsRecordDatasource, sOutputFileName, (unsigned int)(5*g_dSampleRate), 1.0, true, true );
//ITABufferDataSink oBufferRec( pdsRecordDatasource, vpfRecordData, g_iBlockSize );
//oBufferRec.Transfer( nRecordSamples );
WriteFromDatasourceToFile( pdsRecordDatasource, g_sOutputFileName, (unsigned int)(5*g_dSampleRate), 1.0, true, true );
ITAPA.Stop();
ITAPA.Close();
......
#!/bin/bash
# Auto-generated file that sets the environment variables for the project
export LD_LIBRARY_PATH=/home/jst/dev/ITACoreLibs/build/lib:/home/jst/dev/ViSTA/build/lib:/home/jst/dev/ViSTA/build/lib/DriverPlugins:/usr/bin:$LD_LIBRARY_PATH
export VISTACORELIBS_DRIVER_PLUGIN_DIRS=/home/jst/dev/ViSTA/build/lib/DriverPlugins
#!/bin/bash
# Auto-generated file that sets the environment variables for the project
export LD_LIBRARY_PATH=/home/jst/dev/ITACoreLibs/build/lib:/home/jst/dev/ViSTA/build/lib:/home/jst/dev/ViSTA/build/lib/DriverPlugins:/usr/bin:$LD_LIBRARY_PATH
export VISTACORELIBS_DRIVER_PLUGIN_DIRS=/home/jst/dev/ViSTA/build/lib/DriverPlugins
#!/bin/bash
# Auto-generated file that sets the environment variables for the project
export LD_LIBRARY_PATH=/home/jst/dev/ITACoreLibs/build/lib:/home/jst/dev/ViSTA/build/lib:/home/jst/dev/ViSTA/build/lib/DriverPlugins:/usr/bin:$LD_LIBRARY_PATH
export VISTACORELIBS_DRIVER_PLUGIN_DIRS=/home/jst/dev/ViSTA/build/lib/DriverPlugins
......@@ -7,6 +7,7 @@ include( VistaCommon )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
add_definitions(-DIEEE754_64FLOAT)
add_executable( ITANABufferServerTest ITANABufferServerTest.cpp )
target_link_libraries( ITANABufferServerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
......@@ -38,11 +39,24 @@ vista_create_default_info_file( ITANetAudioStreamingServerTest )
set_property( TARGET ITANetAudioStreamingServerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
add_executable( ITANetAudioStreamingClientTest ITANetAudioStreamingClientTest.cpp )
target_link_libraries( ITANetAudioStreamingClientTest ${VISTA_USE_PACKAGE_LIBRARIES} )
if( WIN32 ) # uses ASIO
add_executable( ITANetAudioStreamingClientTest ITANetAudioStreamingClientTest.cpp )
target_link_libraries( ITANetAudioStreamingClientTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANetAudioStreamingClientTest )
vista_install( ITANetAudioStreamingClientTest )
vista_create_default_info_file( ITANetAudioStreamingClientTest )
vista_configure_app( ITANetAudioStreamingClientTest )
vista_install( ITANetAudioStreamingClientTest )
vista_create_default_info_file( ITANetAudioStreamingClientTest )
set_property( TARGET ITANetAudioStreamingClientTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
set_property( TARGET ITANetAudioStreamingClientTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
endif( )
add_executable( ITANetAudioTest ITANetAudioTest.cpp )
target_link_libraries( ITANetAudioTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANetAudioTest )
vista_install( ITANetAudioTest )
vista_create_default_info_file( ITANetAudioTest )
vista_install_all_dlls( bin )
set_property( TARGET ITANetAudioTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
cmake_minimum_required( VERSION 2.9 )
project( ITANetAudioTests )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
add_executable( ITANABufferServerTest ITANABufferServerTest.cpp )
target_link_libraries( ITANABufferServerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANABufferServerTest )
vista_install( ITANABufferServerTest )
vista_create_default_info_file( ITANABufferServerTest )
set_property( TARGET ITANABufferServerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
add_executable( ITANAPlayerTest ITANAPlayerTest.cpp )
target_link_libraries( ITANAPlayerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANAPlayerTest )
vista_install( ITANAPlayerTest )
vista_create_default_info_file( ITANAPlayerTest )
set_property( TARGET ITANAPlayerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
add_executable( ITANetAudioStreamingServerTest ITANetAudioStreamingServerTest.cpp )
target_link_libraries( ITANetAudioStreamingServerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANetAudioStreamingServerTest )
vista_install( ITANetAudioStreamingServerTest )
vista_create_default_info_file( ITANetAudioStreamingServerTest )
set_property( TARGET ITANetAudioStreamingServerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
if( WIN32 ) # uses ASIO
add_executable( ITANetAudioStreamingClientTest ITANetAudioStreamingClientTest.cpp )
target_link_libraries( ITANetAudioStreamingClientTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANetAudioStreamingClientTest )
vista_install( ITANetAudioStreamingClientTest )
vista_create_default_info_file( ITANetAudioStreamingClientTest )
set_property( TARGET ITANetAudioStreamingClientTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
endif( )
add_executable( ITANetAudioTest ITANetAudioTest.cpp )
target_link_libraries( ITANetAudioTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANetAudioTest )
vista_install( ITANetAudioTest )
vista_create_default_info_file( ITANetAudioTest )
set_property( TARGET ITANetAudioTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
#include <iostream>
#include <string>
#include <ITANetAudioStream.h>
#include <ITAPortaudioInterface.h>
#include <ITAStreamMultiplier1N.h>
#include <ITAException.h>
#include <ITAFileDatasource.h>
#include <ITAStreamProbe.h>
#include <ITAStreamPatchbay.h>