AntiMicroX
Loading...
Searching...
No Matches
pt1filter.h
Go to the documentation of this file.
1/* antimicrox Gamepad to KB+M event mapper
2 * Copyright (C) 2022 Max Maisel <max.maisel@posteo.de>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
26{
27 public:
28 PT1Filter(double tau = 1, double rate = 1);
29
30 double process(double value);
35 inline double getValue() const { return m_value; }
36 void reset();
37
38 static const double FALLBACK_RATE;
39
40 private:
41 double m_dt_tau;
42 double m_value;
43};
Definition joydpadxml.h:27
Implementation of a first order lag or PT1 filter. Can be used for example to smooth noisy values a b...
Definition pt1filter.h:26
double m_dt_tau
Definition pt1filter.h:41
double process(double value)
Processes a new sample.
Definition pt1filter.cpp:36
double getValue() const
Get the current filter output value.
Definition pt1filter.h:35
void reset()
Resets the filter state to default.
Definition pt1filter.cpp:45
double m_value
Definition pt1filter.h:42
static const double FALLBACK_RATE
Definition pt1filter.h:38