LMMS
Loading...
Searching...
No Matches
Analyzer.h
Go to the documentation of this file.
1/* Analyzer.h - declaration of Analyzer class.
2 *
3 * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/com>
4 *
5 * Based partially on Eq plugin code,
6 * Copyright (c) 2014-2017, David French <dave/dot/french3/at/googlemail/dot/com>
7 *
8 * This file is part of LMMS - https://lmms.io
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this program (see COPYING); if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301 USA.
24 *
25 */
26
27#ifndef ANALYZER_H
28#define ANALYZER_H
29
30
31#include "DataprocLauncher.h"
32#include "Effect.h"
33#include "LocklessRingBuffer.h"
34#include "SaControls.h"
35#include "SaProcessor.h"
36
37namespace lmms
38{
39
40
42class Analyzer : public Effect
43{
44public:
45 Analyzer(Model *parent, const Descriptor::SubPluginFeatures::Key *key);
46 ~Analyzer() override;
47
48 ProcessStatus processImpl(SampleFrame* buf, const f_cnt_t frames) override;
49
50 EffectControls *controls() override {return &m_controls;}
51
53
54private:
57
58 // Maximum LMMS buffer size (hard coded, the actual constant is hard to get)
59 const unsigned int m_maxBufferSize = 4096;
60
61 // QThread::create() workaround
62 // Replace DataprocLauncher by QThread and replace initializer in constructor
63 // with the following commented line when LMMS CI starts using Qt > 5.9
64 //m_processorThread = QThread::create([=]{m_processor.analyze(m_inputBuffer);});
66
68
69 #ifdef SA_DEBUG
70 int m_last_dump_time;
71 int m_dump_count;
72 float m_sum_execution;
73 float m_max_execution;
74 #endif
75};
76
77
78} // namespace lmms
79
80#endif // ANALYZER_H
81
SaProcessor m_processor
Definition Analyzer.h:55
EffectControls * controls() override
Definition Analyzer.h:50
const unsigned int m_maxBufferSize
Definition Analyzer.h:59
Analyzer(Model *parent, const Descriptor::SubPluginFeatures::Key *key)
Definition Analyzer.cpp:59
DataprocLauncher m_processorThread
Definition Analyzer.h:65
SaProcessor * getProcessor()
Definition Analyzer.h:52
LocklessRingBuffer< SampleFrame > m_inputBuffer
Definition Analyzer.h:67
SaControls m_controls
Definition Analyzer.h:56
~Analyzer() override
Definition Analyzer.cpp:72
ProcessStatus processImpl(SampleFrame *buf, const f_cnt_t frames) override
Definition Analyzer.cpp:80
Definition DataprocLauncher.h:38
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
A convenience layer for a realtime-safe and thread-safe multi-reader ringbuffer.
Definition LocklessRingBuffer.h:41
Definition Model.h:37
const Descriptor::SubPluginFeatures::Key & key() const
Definition Plugin.h:266
Definition SaControls.h:48
Receives audio data, runs FFT analysis and stores the result.
Definition SaProcessor.h:50
Definition SampleFrame.h:41
static uintptr_t parent
Definition pugl.h:1644
Definition AudioAlsa.cpp:35
std::uint64_t f_cnt_t
Definition LmmsTypes.h:43