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

#ifndef INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER
#define INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER

#include <ITACTCDefinitions.h>

#include <vector>

#include <ITADataSourceRealization.h>
27
#include <ITAHDFTSpectra.h>
Jonas Stienen's avatar
Jonas Stienen committed
28
29

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

//! 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
		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
69
	void ExchangeFilters( const std::vector< ITABase::CHDFTSpectra* >& vpCTCFilter );
Jonas Stienen's avatar
Jonas Stienen committed
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

	//! 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
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
91
#endif // INCLUDE_WATCHER_ITA_N_CTC_STREAMING_FILTER