annotate src/Modules/NAP/ModuleHCL.h @ 611:0fbaf443ec82

Carfac C++ revision 3, indluding more style improvements. The output structs are now classes again, and have separate storage methods for each output structure along with flags in the Run and RunSegment methods to allow for only storing NAPs if desired.
author alexbrandmeyer
date Fri, 17 May 2013 19:52:45 +0000
parents c5f5e9569863
children
rev   line source
tomwalters@10 1 // Copyright 2007-2010, Thomas Walters
tomwalters@0 2 //
tomwalters@0 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@0 4 // http://www.acousticscale.org/AIMC
tomwalters@0 5 //
tomwalters@45 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@45 7 // you may not use this file except in compliance with the License.
tomwalters@45 8 // You may obtain a copy of the License at
tomwalters@0 9 //
tomwalters@45 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@0 11 //
tomwalters@45 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@45 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@45 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@45 15 // See the License for the specific language governing permissions and
tomwalters@45 16 // limitations under the License.
tomwalters@0 17
tomwalters@0 18 /*!
tomwalters@0 19 * \file
tomwalters@0 20 * \brief Halfwave rectification, compression and lowpass filtering
tomwalters@0 21 */
tomwalters@0 22
tomwalters@10 23 /* \author Thomas Walters <tom@acousticscale.org>
tomwalters@0 24 * \date created 2007/03/07
tomwalters@23 25 * \version \$Id$
tomwalters@0 26 */
tomwalters@0 27
tomwalters@11 28 #ifndef AIMC_MODULES_NAP_HCL_H_
tomwalters@11 29 #define AIMC_MODULES_NAP_HCL_H_
tomwalters@0 30
tomwalters@0 31 #include <vector>
tomwalters@0 32
tomwalters@0 33 #include "Support/Module.h"
tomwalters@0 34 #include "Support/SignalBank.h"
tomwalters@0 35
tomwalters@0 36 namespace aimc {
tomwalters@0 37 using std::vector;
tomwalters@0 38 class ModuleHCL : public Module {
tomwalters@0 39 public:
tomwalters@8 40 explicit ModuleHCL(Parameters *parameters);
tomwalters@0 41 virtual ~ModuleHCL();
tomwalters@0 42
tomwalters@0 43 virtual void Process(const SignalBank &input);
tomwalters@0 44
tomwalters@0 45 private:
tomwalters@0 46 /*! \brief Prepare the module
tomwalters@0 47 * \param input Input signal bank
tomwalters@0 48 * \param output true on success false on failure
tomwalters@0 49 */
tomwalters@0 50 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@0 51
tomwalters@3 52 virtual void ResetInternal();
tomwalters@3 53
tomwalters@8 54 /*! \brief Do lowpass filtering?
tomwalters@8 55 */
tomwalters@0 56 bool do_lowpass_;
tomwalters@0 57
tomwalters@8 58 /*! \brief Do log compression?
tomwalters@8 59 */
tomwalters@0 60 bool do_log_;
tomwalters@0 61
tomwalters@8 62 /*! \brief Cutoff frequency for lowpass filter
tomwalters@8 63 */
tomwalters@0 64 float lowpass_cutoff_;
tomwalters@0 65
tomwalters@8 66 /*! \brief Order of Lowpass Filter
tomwalters@8 67 */
tomwalters@0 68 int lowpass_order_;
tomwalters@0 69
tomwalters@8 70 /*! \brief Internal record of the number of channels in the input
tomwalters@8 71 */
tomwalters@0 72 int channel_count_;
tomwalters@0 73
tomwalters@8 74 /*! \brief Time constant corresponsing to the lowpass filter
tomwalters@8 75 * cutoff freqency
tomwalters@8 76 */
tomwalters@0 77 float time_constant_;
tomwalters@0 78
tomwalters@8 79 /*! \brief Lowpass filter state variables
tomwalters@8 80 */
tomwalters@0 81 float xn_;
tomwalters@0 82 float yn_;
tomwalters@0 83 vector<vector<float> > yns_;
tomwalters@0 84 };
tomwalters@0 85 } // namespace aimc
tomwalters@0 86
tomwalters@11 87 #endif // AIMC_MODULES_NAP_HCL_H_