ITANetAudioStreamingServer.cpp 2.01 KB
Newer Older
1
#include <ITANetAudioStreamingServer.h>
2
#include <ITANetAudioServer.h>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// ITA includes
#include <ITADataSource.h>
#include <ITAException.h>
#include <ITAStreamInfo.h>

// Vista includes
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaInterProcComm/IPNet/VistaTCPServer.h>
#include <VistaInterProcComm/IPNet/VistaTCPSocket.h>
#include <VistaBase/VistaTimeUtils.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>

// STL
#include <cmath>
#include <cassert>

21 22 23
CITANetAudioStreamingServer::CITANetAudioStreamingServer()
	: m_pInputStream( NULL )
	, m_iUpdateStrategy( AUTO )
24
{
25
	m_pNetAudioServer = new CITANetAudioServer( this );
Anne's avatar
Anne committed
26
	// TODO: Init members
27
}
28

29
bool CITANetAudioStreamingServer::Start( const std::string& sAddress, int iPort )
30
{
31
	return m_pNetAudioServer->Start( sAddress, iPort );
32 33
}

34
bool CITANetAudioStreamingServer::IsClientConnected() const
35
{
36
	return m_pNetAudioServer->IsConnected();
37 38
}

39
std::string CITANetAudioStreamingServer::GetNetworkAddress() const
40
{
41
	return m_pNetAudioServer->GetServerAddress();
42 43
}

44
int CITANetAudioStreamingServer::GetNetworkPort() const
45
{
46
	return m_pNetAudioServer->GetNetworkPort();
47 48
}

Anne's avatar
Anne committed
49 50 51 52 53
void CITANetAudioStreamingServer::Stop() 
{
	m_pNetAudioServer->Disconnect();
}

54
void CITANetAudioStreamingServer::SetInputStream( ITADatasource* pInStream )
55
{
56
	m_pInputStream = pInStream;
57 58
}

Anne's avatar
Anne committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
int CITANetAudioStreamingServer::GetNetStreamBlocklength() const
{
	return m_sfTempTransmitBuffer.GetLength();
}

int CITANetAudioStreamingServer::GetNetStreamNumberOfChannels() const
{
	return m_sfTempTransmitBuffer.channels();
}

double CITANetAudioStreamingServer::GetNetStreamSampleRate() const
{
	return m_pNetAudioServer->GetClientSampleRate();
}

74
void CITANetAudioStreamingServer::SetAutomaticUpdateRate()
75
{
76
	m_iUpdateStrategy = AUTO;
77 78
}

79
ITADatasource* CITANetAudioStreamingServer::GetInputStream() const
80
{
81 82
	return m_pInputStream;
}
Anne's avatar
Anne committed
83 84 85 86 87

int CITANetAudioStreamingServer::Transmit(const ITASampleFrame& sfNewSamples, int iNumSamples)
{
	return 1;
}