ITANetAudioProtocol.h 2.26 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_PROTOCOL
#define INCLUDE_WATCHER_ITA_NET_AUDIO_PROTOCOL

#include <ITADataSourcesDefinitions.h>

// ITA includes
#include <ITAException.h>
#include <ITASampleBuffer.h>
#include <ITASampleFrame.h>

// Vista includes
#include <VistaBase/VistaBaseTypes.h>
#include <VistaInterProcComm/Connections/VistaByteBufferSerializer.h>
#include <VistaInterProcComm/Connections/VistaByteBufferDeSerializer.h>

// STL includes
#include <string>
#include <vector>

// Forward declarations
class VistaConnectionIP;
40
class CITANetAudioStreamingServer;
41
class CITANetAudioStream;
42 43 44 45 46

//! Network audio protocol
/**
  * Declaration of message types
  */
47
class ITA_DATA_SOURCES_API CITANetAudioProtocol
48
{
49
public:
50 51 52 53 54 55 56
	static const int NET_AUDIO_VERSION = 1;

	static const int NP_INVALID = -1;
	static const int NP_GET_VERSION_INFO = 1;

	static const int NP_CLIENT_OPEN = 100;
	static const int NP_CLIENT_CLOSE = 101;
57
	static const int NP_CLIENT_WAITING_FOR_SAMPLES = 102;
58 59

	static const int NP_SERVER_CLOSE = 200;
60 61 62
	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;
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
63
	static const int NP_SERVER_WAITING_FOR_TRIGGER = 221;
64
	static const int NP_SERVER_SEND_SAMPLES = 222;
65 66 67

	CITANetAudioProtocol();
	virtual ~CITANetAudioProtocol();
68 69 70 71 72 73 74 75 76 77 78 79 80

	struct StreamingParameters
	{
		int iChannels;
		double dSampleRate;
		int iBlockSize;

		inline StreamingParameters()
		{
			iChannels = 0;
			dSampleRate = 0.0f;
			iBlockSize = 0;
		};
Dipl.-Ing. Jonas Stienen's avatar
Running  
Dipl.-Ing. Jonas Stienen committed
81 82 83 84 85 86

		inline bool operator==( const StreamingParameters& rhs )
		{
			if( ( iChannels == rhs.iChannels ) && ( dSampleRate == rhs.dSampleRate ) && ( iBlockSize == rhs.iBlockSize ) )
				return true;
		}
87
	};
88 89 90
};

#endif // INCLUDE_WATCHER_ITA_NET_AUDIO_PROTOCOL