Aufgrund einer Wartung wird GitLab am 18.01. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.01. between 8:00 and 9:00 am.

ITANCTCStreamFilter.h 2.83 KB
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1
/*
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 * ----------------------------------------------------------------
 *
 *		ITA core libs
 *		(c) Copyright Institute of Technical Acoustics (ITA)
 *		RWTH Aachen University, Germany, 2015-2017
 *
 * ----------------------------------------------------------------
 *				    ____  __________  _______
 *				   //  / //__   ___/ //  _   |
 *				  //  /    //  /    //  /_|  |
 *				 //  /    //  /    //  ___   |
 *				//__/    //__/    //__/   |__|
 *
 * ----------------------------------------------------------------
 *
 */
Jonas Stienen's avatar
Jonas Stienen committed
18
19
20
21
22
23
24
25
26
27
28

#ifndef INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER
#define INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER

#include <ITACTCDefinitions.h>

#include <vector>

#include <ITADataSourceRealization.h>

// Forward declarations
29
30
31
32
class ITAUPConvolution;
class ITAUPFilter;
class ITAUPFilterPool;
class ITAUPTrigger;
Jonas Stienen's avatar
Jonas Stienen committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class ITADatasource;
class ITAHDFTSpectra;

//! ITACircularNCTCStreamFilter realizes the CTC filtering
/**
  * Filtering for N physical output channels / loudspeaker
  */
class ITA_CTC_API ITANCTCStreamFilter : public ITADatasourceRealizationEventHandler
{
public:

	struct Config 
	{
		int N;						//!< Number of channels
		double dSampleRate;			//!< Audio processing sample rate
		int iBlockLength;			//!< Audio processing block length
		int iFilterLength;			//!< Length of filter
50
		int iFilterExchangeMode;	//!< Exchange mode \see ITAUPConvolution
Jonas Stienen's avatar
Jonas Stienen committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
		int iFilterCrossfadeLength;	//!< Filter exchange crossfade length

	};
	const ITANCTCStreamFilter::Config oConfig;	//!< Static configuration

	//! Constructor
	ITANCTCStreamFilter( const ITANCTCStreamFilter::Config& );

	//! Destructor
	~ITANCTCStreamFilter();

	//! Set input data source
	void SetInputDatasource( ITADatasource* pdsInput );

	//! Get output data source
	ITADatasource* GetOutputDatasource() const;

	//! Exchange filters
	void ExchangeFilters( const std::vector< ITAHDFTSpectra* >& vpCTCFilter );

	//! Set gains of loudspeaker two-channel connvolvers (N-sized vector of floats)
	void SetGains( const std::vector< float >& vfGains, bool bSetImmediately=false );
	
	//! Implementation for processing new input data
	void HandleProcessStream( ITADatasourceRealization* pSender, const ITAStreamInfo* pStreamInfo );

	//! Implementation for incrementing pointer on input data
	void HandlePostIncrementBlockPointer( ITADatasourceRealization* pSender );

private:

	ITADatasource* m_pdsInput;                      //!< Input data source
	ITADatasourceRealization* m_pdsOutput;          //!< Output data source

85
86
	ITAUPFilterPool* m_pFilterPool;                 //!< Filter Pool containing dropped, current and queued filters
	ITAUPTrigger* m_pFilterExchangeTrigger;         //!< Trigger for filter exchange
Jonas Stienen's avatar
Jonas Stienen committed
87

88
	std::vector< ITAUPConvolution* > m_vpConvolvers;	//!< 2*N individual block convolver for each CTC filter, even number = left binaural signal
Jonas Stienen's avatar
Jonas Stienen committed
89
90
91
};

#endif // INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER