alexbrandmeyer@620
|
1 //
|
alexbrandmeyer@620
|
2 // carfac_output.h
|
alexbrandmeyer@620
|
3 // CARFAC Open Source C++ Library
|
alexbrandmeyer@620
|
4 //
|
alexbrandmeyer@620
|
5 // Created by Alex Brandmeyer on 5/10/13.
|
alexbrandmeyer@620
|
6 //
|
alexbrandmeyer@620
|
7 // This C++ file is part of an implementation of Lyon's cochlear model:
|
alexbrandmeyer@620
|
8 // "Cascade of Asymmetric Resonators with Fast-Acting Compression"
|
alexbrandmeyer@620
|
9 // to supplement Lyon's upcoming book "Human and Machine Hearing"
|
alexbrandmeyer@620
|
10 //
|
alexbrandmeyer@620
|
11 // Licensed under the Apache License, Version 2.0 (the "License");
|
alexbrandmeyer@620
|
12 // you may not use this file except in compliance with the License.
|
alexbrandmeyer@620
|
13 // You may obtain a copy of the License at
|
alexbrandmeyer@620
|
14 //
|
alexbrandmeyer@620
|
15 // http://www.apache.org/licenses/LICENSE-2.0
|
alexbrandmeyer@620
|
16 //
|
alexbrandmeyer@620
|
17 // Unless required by applicable law or agreed to in writing, software
|
alexbrandmeyer@620
|
18 // distributed under the License is distributed on an "AS IS" BASIS,
|
alexbrandmeyer@620
|
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
alexbrandmeyer@620
|
20 // See the License for the specific language governing permissions and
|
alexbrandmeyer@620
|
21 // limitations under the License.
|
alexbrandmeyer@620
|
22 //
|
alexbrandmeyer@620
|
23 // *****************************************************************************
|
alexbrandmeyer@620
|
24 // Class: CARFACOutput
|
alexbrandmeyer@620
|
25 // *****************************************************************************
|
alexbrandmeyer@620
|
26 // The CARFACOutput object stores an array of EarOuput objects. It is meant as a
|
alexbrandmeyer@620
|
27 // container for the output generated by the CARFAC object's 'Run' and
|
alexbrandmeyer@620
|
28 // 'RunSegment' methods. Depending on the number of audio channels in the input
|
alexbrandmeyer@620
|
29 // data, the CARFACOutput will have 1 or more EarOutput obects, each of which
|
alexbrandmeyer@620
|
30 // contains a set of two dimensional float arrays (FloatArray2d) representing
|
alexbrandmeyer@620
|
31 // the neural activation patterns (NAPs) generated by the CARFAC model.
|
alexbrandmeyer@620
|
32 //
|
alexbrandmeyer@620
|
33 // The 'InitOutput' method is used to initialize the arrays in each of the
|
alexbrandmeyer@620
|
34 // EarOutput sub-objects once the target data dimensions ears (n_ears), channels
|
alexbrandmeyer@620
|
35 // (n_ch) and timepoints (n_tp) are known.
|
alexbrandmeyer@620
|
36
|
alexbrandmeyer@620
|
37 #ifndef CARFAC_Open_Source_C__Library_carfac_output_h
|
alexbrandmeyer@620
|
38 #define CARFAC_Open_Source_C__Library_carfac_output_h
|
alexbrandmeyer@620
|
39
|
alexbrandmeyer@678
|
40 #include <deque>
|
alexbrandmeyer@678
|
41 #include "ear.h"
|
alexbrandmeyer@620
|
42
|
alexbrandmeyer@622
|
43 class CARFACOutput {
|
alexbrandmeyer@622
|
44 public:
|
alexbrandmeyer@678
|
45 void Init(const int n_ears, const bool store_nap, const bool store_nap_decim,
|
alexbrandmeyer@678
|
46 const bool store_bm, const bool store_ohc, const bool store_agc);
|
alexbrandmeyer@679
|
47 void StoreOutput(const std::vector<Ear>& ears);
|
alexbrandmeyer@679
|
48 // Here we define several acessors for the data members.
|
ronw@681
|
49 const std::deque<std::vector<FloatArray>>& nap() { return nap_; }
|
alexbrandmeyer@679
|
50 const std::deque<std::vector<FloatArray>>& bm() { return bm_; }
|
ronw@681
|
51 const std::deque<std::vector<FloatArray>>& nap_decim() { return nap_decim_; }
|
alexbrandmeyer@679
|
52 const std::deque<std::vector<FloatArray>>& ohc() { return ohc_; }
|
ronw@681
|
53 const std::deque<std::vector<FloatArray>>& agc() { return agc_; }
|
alexbrandmeyer@679
|
54
|
alexbrandmeyer@622
|
55 private:
|
alexbrandmeyer@620
|
56 int n_ears_;
|
alexbrandmeyer@678
|
57 bool store_nap_;
|
alexbrandmeyer@678
|
58 bool store_nap_decim_;
|
alexbrandmeyer@678
|
59 bool store_bm_;
|
alexbrandmeyer@678
|
60 bool store_ohc_;
|
alexbrandmeyer@678
|
61 bool store_agc_;
|
alexbrandmeyer@679
|
62 std::deque<std::vector<FloatArray>> nap_;
|
alexbrandmeyer@679
|
63 std::deque<std::vector<FloatArray>> nap_decim_;
|
alexbrandmeyer@679
|
64 std::deque<std::vector<FloatArray>> bm_;
|
alexbrandmeyer@679
|
65 std::deque<std::vector<FloatArray>> ohc_;
|
alexbrandmeyer@679
|
66 std::deque<std::vector<FloatArray>> agc_;
|
alexbrandmeyer@620
|
67 };
|
alexbrandmeyer@620
|
68
|
ronw@681
|
69 #endif
|