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@318
|
6 // Licensed under the Apache License, Version 2.0 (the "License");
|
tomwalters@318
|
7 // you may not use this file except in compliance with the License.
|
tomwalters@318
|
8 // You may obtain a copy of the License at
|
tomwalters@305
|
9 //
|
tomwalters@318
|
10 // http://www.apache.org/licenses/LICENSE-2.0
|
tomwalters@305
|
11 //
|
tomwalters@318
|
12 // Unless required by applicable law or agreed to in writing, software
|
tomwalters@318
|
13 // distributed under the License is distributed on an "AS IS" BASIS,
|
tomwalters@318
|
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
tomwalters@318
|
15 // See the License for the specific language governing permissions and
|
tomwalters@318
|
16 // limitations under the License.
|
tomwalters@305
|
17
|
tomwalters@305
|
18 /*!
|
tomwalters@305
|
19 * \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@305
|
20 * \date created 2010/02/23
|
tomwalters@305
|
21 * \version \$Id$
|
tomwalters@305
|
22 */
|
tomwalters@305
|
23
|
tomwalters@305
|
24 #ifndef AIMC_MODULES_STROBES_LOCAL_MAX_H_
|
tomwalters@305
|
25 #define AIMC_MODULES_STROBES_LOCAL_MAX_H_
|
tomwalters@305
|
26
|
tomwalters@305
|
27 #include <vector>
|
tomwalters@305
|
28 #include "Support/Module.h"
|
tomwalters@305
|
29
|
tomwalters@305
|
30 namespace aimc {
|
tomwalters@305
|
31 using std::vector;
|
tomwalters@305
|
32 class ModuleLocalMax : public Module {
|
tomwalters@305
|
33 public:
|
tomwalters@305
|
34 explicit ModuleLocalMax(Parameters *pParam);
|
tomwalters@305
|
35 virtual ~ModuleLocalMax();
|
tomwalters@305
|
36
|
tomwalters@305
|
37 /*! \brief Process a buffer
|
tomwalters@305
|
38 */
|
tomwalters@305
|
39 virtual void Process(const SignalBank &input);
|
tomwalters@305
|
40
|
tomwalters@305
|
41 private:
|
tomwalters@305
|
42 /*! \brief Reset the internal state of the module
|
tomwalters@305
|
43 */
|
tomwalters@305
|
44 virtual void ResetInternal();
|
tomwalters@305
|
45
|
tomwalters@305
|
46 /*! \brief Prepare the module
|
tomwalters@305
|
47 * \param input Input signal
|
tomwalters@305
|
48 * \param output true on success false on failure
|
tomwalters@305
|
49 */
|
tomwalters@305
|
50 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@305
|
51
|
tomwalters@305
|
52 float sample_rate_;
|
tomwalters@305
|
53 int buffer_length_;
|
tomwalters@305
|
54 int channel_count_;
|
tomwalters@305
|
55
|
tomwalters@305
|
56 float decay_time_ms_;
|
tomwalters@305
|
57 float timeout_ms_;
|
tomwalters@305
|
58 int strobe_timeout_samples_;
|
tomwalters@305
|
59 int strobe_decay_samples_;
|
tomwalters@305
|
60
|
tomwalters@305
|
61 vector<float> threshold_;
|
tomwalters@305
|
62 vector<float> decay_constant_;
|
tomwalters@305
|
63
|
tomwalters@305
|
64 vector<float> prev_sample_;
|
tomwalters@305
|
65 vector<float> curr_sample_;
|
tomwalters@305
|
66 vector<float> next_sample_;
|
tomwalters@305
|
67 };
|
tomwalters@305
|
68 } // namespace aimc
|
tomwalters@305
|
69
|
tomwalters@305
|
70 #endif // AIMC_MODULES_STROBES_LOCAL_MAX_H_
|