annotate src/Modules/BMM/ModulePZFC.h @ 21:d386805133f1

-Added necessary header files for linux build -Temporarily commented out the test target in order to prevent loads of warnings from SCons.
author tomwalters
date Mon, 22 Feb 2010 18:10:55 +0000
parents d54efba7f09b
children 491b1b1d1dc5
rev   line source
tomwalters@10 1 // Copyright 2008-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@0 6 // This program is free software: you can redistribute it and/or modify
tomwalters@0 7 // it under the terms of the GNU General Public License as published by
tomwalters@0 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@0 9 // (at your option) any later version.
tomwalters@0 10 //
tomwalters@0 11 // This program is distributed in the hope that it will be useful,
tomwalters@0 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@0 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@0 14 // GNU General Public License for more details.
tomwalters@0 15 //
tomwalters@0 16 // You should have received a copy of the GNU General Public License
tomwalters@0 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@0 18
tomwalters@8 19 /*! \file
tomwalters@8 20 * \brief Dick Lyon's Pole-Zero Filter Cascade - implemented in C++ by Tom
tomwalters@8 21 * Walters from the AIM-MAT module based on Dick Lyon's code.
tomwalters@8 22 *
tomwalters@8 23 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@8 24 * \date created 2008/02/05
tomwalters@8 25 * \version \$Id: ModulePZFC.h 2 2010-02-02 12:59:50Z tcw $
tomwalters@8 26 */
tomwalters@8 27
tomwalters@0 28 #ifndef _AIMC_MODULES_BMM_PZFC_H_
tomwalters@0 29 #define _AIMC_MODULES_BMM_PZFC_H_
tomwalters@0 30
tomwalters@0 31 #include <vector>
tomwalters@0 32
tomwalters@0 33 #include "Support/Module.h"
tomwalters@0 34 #include "Support/Parameters.h"
tomwalters@0 35 #include "Support/SignalBank.h"
tomwalters@0 36
tomwalters@0 37 namespace aimc {
tomwalters@0 38 using std::vector;
tomwalters@0 39 class ModulePZFC : public Module {
tomwalters@0 40 public:
tomwalters@8 41 explicit ModulePZFC(Parameters *pParam);
tomwalters@0 42 virtual ~ModulePZFC();
tomwalters@0 43
tomwalters@8 44 /*! \brief Process a buffer
tomwalters@8 45 */
tomwalters@0 46 virtual void Process(const SignalBank &input);
tomwalters@0 47
tomwalters@3 48 private:
tomwalters@8 49 /*! \brief Reset all internal state variables to their initial values
tomwalters@8 50 */
tomwalters@8 51 virtual void ResetInternal();
tomwalters@0 52
tomwalters@8 53 /*! \brief Prepare the module
tomwalters@8 54 * \param input Input SignalBank
tomwalters@8 55 * \param output true on success false on failure
tomwalters@8 56 */
tomwalters@0 57 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@0 58
tomwalters@8 59 /*! \brief Set the filterbank parameters according to a fit matrix from Unoki
tomwalters@8 60 * and Lyon's fitting routine
tomwalters@8 61 */
tomwalters@0 62 bool SetPZBankCoeffsERBFitted();
tomwalters@0 63
tomwalters@8 64 /*! \brief Sets the general filterbank coefficients
tomwalters@8 65 */
tomwalters@0 66 bool SetPZBankCoeffs();
tomwalters@0 67
tomwalters@8 68 /*! \brief Automatic Gain Control
tomwalters@8 69 */
tomwalters@0 70 void AGCDampStep();
tomwalters@0 71
tomwalters@8 72 /*! \brief Detector function - halfwave rectification etc. Used internally,
tomwalters@8 73 * but not applied to the output.
tomwalters@8 74 */
tomwalters@0 75 float DetectFun(float fIN);
tomwalters@0 76
tomwalters@8 77 /*! \brief Minimum
tomwalters@8 78 */
tomwalters@0 79 inline float Minimum(float a, float b);
tomwalters@0 80
tomwalters@0 81 int channel_count_;
tomwalters@0 82 int buffer_length_;
tomwalters@0 83 int agc_stage_count_;
tomwalters@0 84 float sample_rate_;
tomwalters@0 85 float last_input_;
tomwalters@0 86
tomwalters@0 87 // Parameters
tomwalters@0 88 // User-settable scalars
tomwalters@0 89 float pole_damping_;
tomwalters@0 90 float zero_damping_;
tomwalters@0 91 float zero_factor_;
tomwalters@0 92 float step_factor_;
tomwalters@0 93 float bandwidth_over_cf_;
tomwalters@0 94 float min_bandwidth_hz_;
tomwalters@0 95 float agc_factor_;
tomwalters@0 96 float cf_max_;
tomwalters@0 97 float cf_min_;
tomwalters@0 98 float mindamp_;
tomwalters@0 99 float maxdamp_;
tomwalters@0 100 bool do_agc_step_;
tomwalters@0 101
tomwalters@0 102 // Internal Buffers
tomwalters@0 103 // Initialised once
tomwalters@0 104 vector<float> pole_dampings_;
tomwalters@0 105 vector<float> agc_epsilons_;
tomwalters@0 106 vector<float> agc_gains_;
tomwalters@0 107 vector<float> pole_frequencies_;
tomwalters@0 108 vector<float> za0_;
tomwalters@0 109 vector<float> za1_;
tomwalters@0 110 vector<float> za2_;
tomwalters@0 111 vector<float> rmin_;
tomwalters@0 112 vector<float> rmax_;
tomwalters@0 113 vector<float> xmin_;
tomwalters@0 114 vector<float> xmax_;
tomwalters@0 115
tomwalters@0 116 // Modified by algorithm at each time step
tomwalters@0 117 vector<float> detect_;
tomwalters@0 118 vector<vector<float> > agc_state_;
tomwalters@0 119 vector<float> state_1_;
tomwalters@0 120 vector<float> state_2_;
tomwalters@0 121 vector<float> previous_out_;
tomwalters@0 122 vector<float> pole_damps_mod_;
tomwalters@0 123 vector<float> inputs_;
tomwalters@0 124 };
tomwalters@0 125 }
tomwalters@0 126
tomwalters@0 127 #endif // _AIMC_MODULES_BMM_PZFC_H_