alexbrandmeyer@620: // alexbrandmeyer@620: // carfac_output.h alexbrandmeyer@620: // CARFAC Open Source C++ Library alexbrandmeyer@620: // alexbrandmeyer@620: // Created by Alex Brandmeyer on 5/10/13. alexbrandmeyer@620: // alexbrandmeyer@620: // This C++ file is part of an implementation of Lyon's cochlear model: alexbrandmeyer@620: // "Cascade of Asymmetric Resonators with Fast-Acting Compression" alexbrandmeyer@620: // to supplement Lyon's upcoming book "Human and Machine Hearing" alexbrandmeyer@620: // alexbrandmeyer@620: // Licensed under the Apache License, Version 2.0 (the "License"); alexbrandmeyer@620: // you may not use this file except in compliance with the License. alexbrandmeyer@620: // You may obtain a copy of the License at alexbrandmeyer@620: // alexbrandmeyer@620: // http://www.apache.org/licenses/LICENSE-2.0 alexbrandmeyer@620: // alexbrandmeyer@620: // Unless required by applicable law or agreed to in writing, software alexbrandmeyer@620: // distributed under the License is distributed on an "AS IS" BASIS, alexbrandmeyer@620: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. alexbrandmeyer@620: // See the License for the specific language governing permissions and alexbrandmeyer@620: // limitations under the License. alexbrandmeyer@620: // alexbrandmeyer@620: // ***************************************************************************** alexbrandmeyer@620: // Class: CARFACOutput alexbrandmeyer@620: // ***************************************************************************** alexbrandmeyer@620: // The CARFACOutput object stores an array of EarOuput objects. It is meant as a alexbrandmeyer@620: // container for the output generated by the CARFAC object's 'Run' and alexbrandmeyer@620: // 'RunSegment' methods. Depending on the number of audio channels in the input alexbrandmeyer@620: // data, the CARFACOutput will have 1 or more EarOutput obects, each of which alexbrandmeyer@620: // contains a set of two dimensional float arrays (FloatArray2d) representing alexbrandmeyer@620: // the neural activation patterns (NAPs) generated by the CARFAC model. alexbrandmeyer@620: // alexbrandmeyer@620: // The 'InitOutput' method is used to initialize the arrays in each of the alexbrandmeyer@620: // EarOutput sub-objects once the target data dimensions ears (n_ears), channels alexbrandmeyer@620: // (n_ch) and timepoints (n_tp) are known. alexbrandmeyer@620: alexbrandmeyer@682: #ifndef CARFAC_CARFAC_OUTPUT_H alexbrandmeyer@682: #define CARFAC_CARFAC_OUTPUT_H alexbrandmeyer@620: alexbrandmeyer@678: #include alexbrandmeyer@682: #include alexbrandmeyer@682: #include "carfac_common.h" alexbrandmeyer@678: #include "ear.h" alexbrandmeyer@620: alexbrandmeyer@622: class CARFACOutput { alexbrandmeyer@622: public: alexbrandmeyer@678: void Init(const int n_ears, const bool store_nap, const bool store_nap_decim, alexbrandmeyer@678: const bool store_bm, const bool store_ohc, const bool store_agc); alexbrandmeyer@679: void StoreOutput(const std::vector& ears); alexbrandmeyer@679: // Here we define several acessors for the data members. ronw@681: const std::deque>& nap() { return nap_; } alexbrandmeyer@679: const std::deque>& bm() { return bm_; } ronw@681: const std::deque>& nap_decim() { return nap_decim_; } alexbrandmeyer@679: const std::deque>& ohc() { return ohc_; } ronw@681: const std::deque>& agc() { return agc_; } alexbrandmeyer@679: alexbrandmeyer@622: private: alexbrandmeyer@620: int n_ears_; alexbrandmeyer@678: bool store_nap_; alexbrandmeyer@678: bool store_nap_decim_; alexbrandmeyer@678: bool store_bm_; alexbrandmeyer@678: bool store_ohc_; alexbrandmeyer@678: bool store_agc_; alexbrandmeyer@679: std::deque> nap_; alexbrandmeyer@679: std::deque> nap_decim_; alexbrandmeyer@679: std::deque> bm_; alexbrandmeyer@679: std::deque> ohc_; alexbrandmeyer@679: std::deque> agc_; alexbrandmeyer@620: }; alexbrandmeyer@620: alexbrandmeyer@682: #endif // CARFAC_CARFAC_OUTPUT_H