LMMS
Loading...
Searching...
No Matches
LOMM.h
Go to the documentation of this file.
1/*
2 * LOMM.h
3 *
4 * Copyright (c) 2023 Lost Robot <r94231/at/gmail/dot/com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25
26#ifndef LMMS_LOMM_H
27#define LMMS_LOMM_H
28
29#include "LOMMControls.h"
30#include "Effect.h"
31
32#include "BasicFilters.h"
33
34namespace lmms
35{
36
37constexpr inline float LOMM_MIN_FLOOR = 0.00012589f;// -72 dBFS
38constexpr inline float LOMM_MAX_LOOKAHEAD = 20.f;
39constexpr inline float LOMM_AUTO_TIME_ADJUST = 5.f;
40
41class LOMMEffect : public Effect
42{
43 Q_OBJECT
44public:
45 LOMMEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
46 ~LOMMEffect() override = default;
47
48 ProcessStatus processImpl(SampleFrame* buf, const f_cnt_t frames) override;
49
51 {
52 return &m_lommControls;
53 }
54
55 inline float msToCoeff(float ms)
56 {
57 return (ms == 0) ? 0 : std::exp(m_coeffPrecalc / ms);
58 }
59
60private slots:
61 void changeSampleRate();
62
63private:
65
67
70
73
75
78
79 std::array<std::array<float, 2>, 3> m_yL;
80 std::array<std::array<float, 2>, 3> m_rms;
81 std::array<std::array<float, 2>, 3> m_gainResult;
82
83 std::array<std::array<float, 2>, 3> m_displayIn;
84 std::array<std::array<float, 2>, 3> m_displayOut;
85
86 std::array<float, 2> m_crestPeakVal;
87 std::array<float, 2> m_crestRmsVal;
88 std::array<float, 2> m_crestFactorVal;
89 float m_crestTimeConst = 0.0f;
90
91 std::array<std::array<float, 2>, 3> m_prevOut;
92
93 std::array<std::array<std::vector<float>, 2>, 3> m_inLookBuf;
94 std::array<std::array<std::vector<float>, 2>, 3> m_scLookBuf;
95
96 int m_lookWrite = 0;
98
99 friend class LOMMControls;
101};
102
103
104} // namespace lmms
105
106#endif // LMMS_LOMM_H
Definition BasicFilters.h:224
Definition EffectControls.h:44
Effect(const Plugin::Descriptor *_desc, Model *_parent, const Descriptor::SubPluginFeatures::Key *_key)
Definition Effect.cpp:41
ProcessStatus
Definition Effect.h:147
float m_coeffPrecalc
Definition LOMM.h:77
std::array< std::array< float, 2 >, 3 > m_rms
Definition LOMM.h:80
void changeSampleRate()
Definition LOMM.cpp:74
BasicFilters< 2 > m_ap
Definition LOMM.h:74
LOMMEffect(Model *parent, const Descriptor::SubPluginFeatures::Key *key)
Definition LOMM.cpp:51
EffectControls * controls() override
Definition LOMM.h:50
StereoLinkwitzRiley m_lp2
Definition LOMM.h:69
std::array< std::array< float, 2 >, 3 > m_displayIn
Definition LOMM.h:83
float m_crestTimeConst
Definition LOMM.h:89
int m_lookWrite
Definition LOMM.h:96
StereoLinkwitzRiley m_lp1
Definition LOMM.h:68
std::array< std::array< float, 2 >, 3 > m_prevOut
Definition LOMM.h:91
~LOMMEffect() override=default
int m_lookBufLength
Definition LOMM.h:97
std::array< std::array< float, 2 >, 3 > m_displayOut
Definition LOMM.h:84
float m_sampleRate
Definition LOMM.h:66
std::array< std::array< float, 2 >, 3 > m_yL
Definition LOMM.h:79
friend class LOMMControls
Definition LOMM.h:99
std::array< std::array< std::vector< float >, 2 >, 3 > m_inLookBuf
Definition LOMM.h:93
std::array< float, 2 > m_crestFactorVal
Definition LOMM.h:88
std::array< float, 2 > m_crestPeakVal
Definition LOMM.h:86
LOMMControls m_lommControls
Definition LOMM.h:64
std::array< std::array< std::vector< float >, 2 >, 3 > m_scLookBuf
Definition LOMM.h:94
std::array< float, 2 > m_crestRmsVal
Definition LOMM.h:87
bool m_needsUpdate
Definition LOMM.h:76
ProcessStatus processImpl(SampleFrame *buf, const f_cnt_t frames) override
Definition LOMM.cpp:105
StereoLinkwitzRiley m_hp2
Definition LOMM.h:72
float msToCoeff(float ms)
Definition LOMM.h:55
std::array< std::array< float, 2 >, 3 > m_gainResult
Definition LOMM.h:81
StereoLinkwitzRiley m_hp1
Definition LOMM.h:71
Definition Model.h:37
const Descriptor::SubPluginFeatures::Key & key() const
Definition Plugin.h:266
Definition SampleFrame.h:41
Definition LOMMControlDialog.h:54
static uintptr_t parent
Definition pugl.h:1644
Definition AudioAlsa.cpp:35
constexpr float LOMM_MAX_LOOKAHEAD
Definition LOMM.h:38
constexpr float LOMM_MIN_FLOOR
Definition LOMM.h:37
std::uint64_t f_cnt_t
Definition LmmsTypes.h:43
LinkwitzRiley< 2 > StereoLinkwitzRiley
Definition BasicFilters.h:140
constexpr float LOMM_AUTO_TIME_ADJUST
Definition LOMM.h:39