tomwalters@305
|
1 // Copyright 2010, Thomas Walters
|
tomwalters@305
|
2 //
|
tomwalters@305
|
3 // AIM-C: A C++ implementation of the Auditory Image Model
|
tomwalters@305
|
4 // http://www.acousticscale.org/AIMC
|
tomwalters@305
|
5 //
|
tomwalters@305
|
6 // This program is free software: you can redistribute it and/or modify
|
tomwalters@305
|
7 // it under the terms of the GNU General Public License as published by
|
tomwalters@305
|
8 // the Free Software Foundation, either version 3 of the License, or
|
tomwalters@305
|
9 // (at your option) any later version.
|
tomwalters@305
|
10 //
|
tomwalters@305
|
11 // This program is distributed in the hope that it will be useful,
|
tomwalters@305
|
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
tomwalters@305
|
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
tomwalters@305
|
14 // GNU General Public License for more details.
|
tomwalters@305
|
15 //
|
tomwalters@305
|
16 // You should have received a copy of the GNU General Public License
|
tomwalters@305
|
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
tomwalters@305
|
18
|
tomwalters@305
|
19 /*!
|
tomwalters@305
|
20 * \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@305
|
21 * \date created 2010/02/23
|
tomwalters@305
|
22 * \version \$Id$
|
tomwalters@305
|
23 */
|
tomwalters@305
|
24
|
tomwalters@305
|
25 #ifndef AIMC_MODULES_STROBES_LOCAL_MAX_H_
|
tomwalters@305
|
26 #define AIMC_MODULES_STROBES_LOCAL_MAX_H_
|
tomwalters@305
|
27
|
tomwalters@305
|
28 #include <vector>
|
tomwalters@305
|
29 #include "Support/Module.h"
|
tomwalters@305
|
30
|
tomwalters@305
|
31 namespace aimc {
|
tomwalters@305
|
32 using std::vector;
|
tomwalters@305
|
33 class ModuleLocalMax : public Module {
|
tomwalters@305
|
34 public:
|
tomwalters@305
|
35 explicit ModuleLocalMax(Parameters *pParam);
|
tomwalters@305
|
36 virtual ~ModuleLocalMax();
|
tomwalters@305
|
37
|
tomwalters@305
|
38 /*! \brief Process a buffer
|
tomwalters@305
|
39 */
|
tomwalters@305
|
40 virtual void Process(const SignalBank &input);
|
tomwalters@305
|
41
|
tomwalters@305
|
42 private:
|
tomwalters@305
|
43 /*! \brief Reset the internal state of the module
|
tomwalters@305
|
44 */
|
tomwalters@305
|
45 virtual void ResetInternal();
|
tomwalters@305
|
46
|
tomwalters@305
|
47 /*! \brief Prepare the module
|
tomwalters@305
|
48 * \param input Input signal
|
tomwalters@305
|
49 * \param output true on success false on failure
|
tomwalters@305
|
50 */
|
tomwalters@305
|
51 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@305
|
52
|
tomwalters@305
|
53 float sample_rate_;
|
tomwalters@305
|
54 int buffer_length_;
|
tomwalters@305
|
55 int channel_count_;
|
tomwalters@305
|
56
|
tomwalters@305
|
57 float decay_time_ms_;
|
tomwalters@305
|
58 float timeout_ms_;
|
tomwalters@305
|
59 int strobe_timeout_samples_;
|
tomwalters@305
|
60 int strobe_decay_samples_;
|
tomwalters@305
|
61
|
tomwalters@305
|
62 vector<float> threshold_;
|
tomwalters@305
|
63 vector<float> decay_constant_;
|
tomwalters@305
|
64
|
tomwalters@305
|
65 vector<float> prev_sample_;
|
tomwalters@305
|
66 vector<float> curr_sample_;
|
tomwalters@305
|
67 vector<float> next_sample_;
|
tomwalters@305
|
68 };
|
tomwalters@305
|
69 } // namespace aimc
|
tomwalters@305
|
70
|
tomwalters@305
|
71 #endif // AIMC_MODULES_STROBES_LOCAL_MAX_H_
|