ITANetAudioStreamingServer.h 1.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * ----------------------------------------------------------------
 *
 *		ITA core libs
 *		(c) Copyright Institute of Technical Acoustics (ITA)
 *		RWTH Aachen University, Germany, 2015-2016
 *
 * ----------------------------------------------------------------
 *				    ____  __________  _______
 *				   //  / //__   ___/ //  _   |
 *				  //  /    //  /    //  /_|  |
 *				 //  /    //  /    //  ___   |
 *				//__/    //__/    //__/   |__|
 *
 * ----------------------------------------------------------------
 *
 */

#ifndef INCLUDE_WATCHER_ITA_NET_AUDIO_STREAMING_SERVER
#define INCLUDE_WATCHER_ITA_NET_AUDIO_STREAMING_SERVER

#include <ITADataSourcesDefinitions.h>

#include <ITASampleFrame.h>

#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>

#include <string>
#include <vector>

class VistaTCPSocket;
class CITANetAudioSampleServer;
class VistaTCPServer;

//! Realizes server functionality for network audio streaming
/**
  * Can be connected to an ITADataSource as a streaming source
  * or to a user-implemented sample producer, i.e. an audio sythesizer.
  */
40
class CITANetAudioStreamingServer : public VistaThreadLoop
41
42
{
public:
43
44
	CITANetAudioStreamingServer( CITANetAudioSampleServer* pParent );
	virtual ~CITANetAudioStreamingServer();
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

	std::string GetServerAddress() const;
	int GetNetworkPort() const;
	bool Start( const std::string& sAddress, int iPort );
	void Disconnect(); bool IsConnected() const; bool LoopBody();

private:
	VistaTCPServer* m_pServer;
	VistaTCPSocket* m_pSocket;
	int m_iServerPort;
	std::string m_sServerAddress;
	CITANetAudioSampleServer* m_pParent;
	ITASampleFrame m_sfReceivingBuffer;

	bool m_bStopIndicated;

	int m_iClientChannels;
	int m_iClientRingBufferSize;
	int m_iClientBufferSize;
	int m_iClientRingBufferFreeSamples;
	double m_dClientSampleRate;
};
#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_STREAMING_SERVER