comparison trunk/carfac/carfac_output.h @ 678:7f424c1a8b78

Fifth revision of Alex Brandmeyer's C++ implementation of CARFAC. Moved output structure to deque<vector<FloatArray>, moved coefficient Design methods to CARFAC object, moved tests into carfac_test.cc. Verified binaural output against Matlab using two tests. Added CARFAC_Compare_CPP_Test_Data to plot NAP output of C++ version against Matlab version. Verified build and test success on OS X using SCons with g++ 4.7 (std=c++11).
author alexbrandmeyer
date Mon, 27 May 2013 16:36:54 +0000
parents 933cf18d9a59
children 594b410c2aed
comparison
equal deleted inserted replaced
677:c313d4ffd534 678:7f424c1a8b78
35 // (n_ch) and timepoints (n_tp) are known. 35 // (n_ch) and timepoints (n_tp) are known.
36 36
37 #ifndef CARFAC_Open_Source_C__Library_carfac_output_h 37 #ifndef CARFAC_Open_Source_C__Library_carfac_output_h
38 #define CARFAC_Open_Source_C__Library_carfac_output_h 38 #define CARFAC_Open_Source_C__Library_carfac_output_h
39 39
40 #include "ear_output.h" 40 #include <deque>
41 #include "ear.h"
41 42
42 class CARFACOutput { 43 class CARFACOutput {
43 public: 44 public:
44 void InitOutput(const int n_ears, const int n_ch, 45 void Init(const int n_ears, const bool store_nap, const bool store_nap_decim,
45 const int32_t n_timepoints); 46 const bool store_bm, const bool store_ohc, const bool store_agc);
46 void StoreNAPOutput(const int32_t timepoint, const int ear, 47 void StoreOutput(std::vector<Ear>* ears);
47 const FloatArray& nap); 48 FPType nap(const int ear, const int32_t timepoint, const int channel) {
48 void StoreBMOutput(const int32_t timepoint, const int ear, 49 return nap_[timepoint][ear](channel); }
49 const FloatArray& bm); 50 FPType bm(const int ear, const int32_t timepoint, const int channel) {
50 void StoreOHCOutput(const int32_t timepoint, const int ear, 51 return bm_[timepoint][ear](channel); }
51 const FloatArray& ohc); 52 std::deque<std::vector<FloatArray>> nap_;
52 void StoreAGCOutput(const int32_t timepoint, const int ear, 53 std::deque<std::vector<FloatArray>> nap_decim_;
53 const FloatArray& agc); 54 std::deque<std::vector<FloatArray>> bm_;
54 55 std::deque<std::vector<FloatArray>> ohc_;
56 std::deque<std::vector<FloatArray>> agc_;
57
55 private: 58 private:
56 int n_ears_; 59 int n_ears_;
57 std::vector<EarOutput> ears_; 60 bool store_nap_;
61 bool store_nap_decim_;
62 bool store_bm_;
63 bool store_ohc_;
64 bool store_agc_;
58 }; 65 };
59 66
60 #endif 67 #endif