ITANetAudioServer.h 1.79 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * ----------------------------------------------------------------
 *
 *		ITA core libs
 *		(c) Copyright Institute of Technical Acoustics (ITA)
 *		RWTH Aachen University, Germany, 2015-2016
 *
 * ----------------------------------------------------------------
 *				    ____  __________  _______
 *				   //  / //__   ___/ //  _   |
 *				  //  /    //  /    //  /_|  |
 *				 //  /    //  /    //  ___   |
 *				//__/    //__/    //__/   |__|
 *
 * ----------------------------------------------------------------
 *
 */

19
20
#ifndef INCLUDE_WATCHER_ITA_NET_AUDIO_SERVER
#define INCLUDE_WATCHER_ITA_NET_AUDIO_SERVER
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

#include <ITADataSourcesDefinitions.h>

#include <ITASampleFrame.h>

#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>

#include <string>
#include <vector>

class VistaTCPSocket;
class CITANetAudioStreamingServer;
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.
  */
class CITANetAudioServer : public VistaThreadLoop
{
public:
	CITANetAudioServer( CITANetAudioStreamingServer* pParent );
	virtual ~CITANetAudioServer();

	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;

	CITANetAudioStreamingServer* m_pParent;

	ITASampleFrame m_sfReceivingBuffer;

	bool m_bStopIndicated;

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