alexbrandmeyer@609
|
1 //
|
alexbrandmeyer@609
|
2 // carfac_output.cc
|
alexbrandmeyer@609
|
3 // CARFAC Open Source C++ Library
|
alexbrandmeyer@609
|
4 //
|
alexbrandmeyer@609
|
5 // Created by Alex Brandmeyer on 5/10/13.
|
alexbrandmeyer@609
|
6 //
|
alexbrandmeyer@609
|
7 // This C++ file is part of an implementation of Lyon's cochlear model:
|
alexbrandmeyer@609
|
8 // "Cascade of Asymmetric Resonators with Fast-Acting Compression"
|
alexbrandmeyer@609
|
9 // to supplement Lyon's upcoming book "Human and Machine Hearing"
|
alexbrandmeyer@609
|
10 //
|
alexbrandmeyer@609
|
11 // Licensed under the Apache License, Version 2.0 (the "License");
|
alexbrandmeyer@609
|
12 // you may not use this file except in compliance with the License.
|
alexbrandmeyer@609
|
13 // You may obtain a copy of the License at
|
alexbrandmeyer@609
|
14 //
|
alexbrandmeyer@609
|
15 // http://www.apache.org/licenses/LICENSE-2.0
|
alexbrandmeyer@609
|
16 //
|
alexbrandmeyer@609
|
17 // Unless required by applicable law or agreed to in writing, software
|
alexbrandmeyer@609
|
18 // distributed under the License is distributed on an "AS IS" BASIS,
|
alexbrandmeyer@609
|
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
alexbrandmeyer@609
|
20 // See the License for the specific language governing permissions and
|
alexbrandmeyer@609
|
21 // limitations under the License.
|
alexbrandmeyer@609
|
22
|
alexbrandmeyer@609
|
23 #include "carfac_output.h"
|
ronw@647
|
24 #include "ear.h"
|
alexbrandmeyer@637
|
25
|
alexbrandmeyer@636
|
26 using std::vector;
|
alexbrandmeyer@609
|
27
|
ronw@646
|
28 CARFACOutput::CARFACOutput(const bool store_nap, const bool store_bm,
|
ronw@646
|
29 const bool store_ohc, const bool store_agc) {
|
alexbrandmeyer@636
|
30 store_nap_ = store_nap;
|
alexbrandmeyer@636
|
31 store_bm_ = store_bm;
|
alexbrandmeyer@636
|
32 store_ohc_ = store_ohc;
|
alexbrandmeyer@636
|
33 store_agc_ = store_agc;
|
alexbrandmeyer@609
|
34 }
|
alexbrandmeyer@609
|
35
|
ronw@645
|
36 void CARFACOutput::AppendOutput(const vector<Ear*>& ears) {
|
alexbrandmeyer@636
|
37 if (store_nap_) {
|
alexbrandmeyer@643
|
38 nap_.push_back(vector<ArrayX>());
|
ronw@648
|
39 for (Ear* ear : ears) {
|
ronw@645
|
40 nap_.back().push_back(ear->ihc_out());
|
alexbrandmeyer@636
|
41 }
|
alexbrandmeyer@636
|
42 }
|
alexbrandmeyer@636
|
43 if (store_ohc_) {
|
alexbrandmeyer@643
|
44 ohc_.push_back(vector<ArrayX>());
|
ronw@648
|
45 for (Ear* ear : ears) {
|
ronw@645
|
46 ohc_.back().push_back(ear->za_memory());
|
alexbrandmeyer@636
|
47 }
|
alexbrandmeyer@636
|
48 }
|
alexbrandmeyer@636
|
49 if (store_agc_) {
|
alexbrandmeyer@643
|
50 agc_.push_back(vector<ArrayX>());
|
ronw@648
|
51 for (Ear* ear : ears) {
|
ronw@645
|
52 agc_.back().push_back(ear->zb_memory());
|
alexbrandmeyer@636
|
53 }
|
alexbrandmeyer@636
|
54 }
|
alexbrandmeyer@636
|
55 if (store_bm_) {
|
alexbrandmeyer@643
|
56 bm_.push_back(vector<ArrayX>());
|
ronw@648
|
57 for (Ear* ear : ears) {
|
ronw@645
|
58 bm_.back().push_back(ear->zy_memory());
|
alexbrandmeyer@636
|
59 }
|
alexbrandmeyer@636
|
60 }
|
ronw@645
|
61 }
|