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.89 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
18
19
20
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* ----------------------------------------------------------------
*
*		ITA core libs
*		(c) Copyright Institute of Technical Acoustics (ITA)
*		RWTH Aachen University, Germany, 2015-2016
*
* ----------------------------------------------------------------
*				    ____  __________  _______
*				   //  / //__   ___/ //  _   |
*				  //  /    //  /    //  /_|  |
*				 //  /    //  /    //  ___   |
*				//__/    //__/    //__/   |__|
*
* ----------------------------------------------------------------
*
*/
// $Id: ITACircularNCTCStreamingFilter.h 2395 2012-04-20 06:58:52Z stienen $

#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
class DSMBCConvolver;
class DSMBCFilter;
class DSMBCFilterPool;
class DSMBCTrigger;
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
		int iFilterExchangeMode;	//!< Exchange mode \see DSMBCConvolver
		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

	DSMBCFilterPool* m_pFilterPool;                 //!< Filter Pool containing dropped, current and queued filters
	DSMBCTrigger* m_pFilterExchangeTrigger;         //!< Trigger for filter exchange

	std::vector< DSMBCConvolver* > m_vpConvolvers;	//!< 2*N individual block convolver for each CTC filter, even number = left binaural signal
};

#endif // INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER