Mercurial > hg > aimc
comparison carfac/ear_output.cc @ 609:aefe2ca0674f
First version of a C++ implementation by Alex Brandmeyer
author | alexbrandmeyer |
---|---|
date | Mon, 13 May 2013 22:51:15 +0000 |
parents | |
children | 01986636257a |
comparison
equal
deleted
inserted
replaced
608:fc353426eaad | 609:aefe2ca0674f |
---|---|
1 // | |
2 // ear_output.cc | |
3 // CARFAC Open Source C++ Library | |
4 // | |
5 // Created by Alex Brandmeyer on 5/10/13. | |
6 // | |
7 // This C++ file is part of an implementation of Lyon's cochlear model: | |
8 // "Cascade of Asymmetric Resonators with Fast-Acting Compression" | |
9 // to supplement Lyon's upcoming book "Human and Machine Hearing" | |
10 // | |
11 // Licensed under the Apache License, Version 2.0 (the "License"); | |
12 // you may not use this file except in compliance with the License. | |
13 // You may obtain a copy of the License at | |
14 // | |
15 // http://www.apache.org/licenses/LICENSE-2.0 | |
16 // | |
17 // Unless required by applicable law or agreed to in writing, software | |
18 // distributed under the License is distributed on an "AS IS" BASIS, | |
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
20 // See the License for the specific language governing permissions and | |
21 // limitations under the License. | |
22 | |
23 #include "ear_output.h" | |
24 | |
25 void EarOutput::InitOutput(int n_ch, long n_tp){ | |
26 n_ch_ = n_ch; | |
27 n_timepoints_ = n_tp; | |
28 nap_.resize(n_ch_,n_timepoints_); | |
29 bm_.resize(n_ch_,n_timepoints_); | |
30 ohc_.resize(n_ch_,n_timepoints_); | |
31 agc_.resize(n_ch_,n_timepoints_); | |
32 } | |
33 | |
34 void EarOutput::MergeOutput(EarOutput ear_output, long start, long length){ | |
35 nap_.block(0, start, n_ch_, length) = ear_output.nap_.block(0, 0, n_ch_, | |
36 length); | |
37 bm_.block(0, start, n_ch_, length) = ear_output.bm_.block(0, 0, n_ch_, | |
38 length); | |
39 ohc_.block(0, start, n_ch_, length) = ear_output.ohc_.block(0, 0, n_ch_, | |
40 length); | |
41 agc_.block(0, start, n_ch_, length) = ear_output.agc_.block(0, 0, n_ch_, | |
42 length); | |
43 } |