lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
plugins
TapTempo
TapTempo.h
Go to the documentation of this file.
1
/*
2
* TapTempo.h - Plugin to count beats per minute
3
*
4
* Copyright (c) 2026 saker <sakertooth@gmail.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
#ifndef LMMS_TAP_TEMPO_H
26
#define LMMS_TAP_TEMPO_H
27
28
#include <array>
29
#include <chrono>
30
31
#include "
TapTempoView.h
"
32
#include "
ToolPlugin.h
"
33
34
namespace
lmms
{
35
36
class
TapTempo
:
public
ToolPlugin
37
{
38
Q_OBJECT
39
public
:
40
TapTempo
();
41
void
tap
(
bool
play);
42
void
sync
();
43
void
reset
();
44
double
bpm
()
const
;
45
46
QString
nodeName
()
const override
;
47
void
saveSettings
(QDomDocument&, QDomElement&)
override
{}
48
void
loadSettings
(
const
QDomElement&)
override
{}
49
50
gui::PluginView
*
instantiateView
(QWidget*)
override
{
return
new
gui::TapTempoView
(
this
); }
51
52
private
:
53
static
constexpr
auto
MaxIntervals
= 3;
54
using
clock
= std::chrono::steady_clock;
55
std::chrono::time_point<clock>
m_lastTap
;
56
std::array<std::chrono::milliseconds, MaxIntervals>
m_intervals
;
57
int
m_beat
= 0;
58
int
m_taps
= 0;
59
double
m_bpm
= 0;
60
};
61
}
// namespace lmms
62
63
#endif
// LMMS_TAP_TEMPO_H
TapTempoView.h
ToolPlugin.h
lmms::TapTempo::m_beat
int m_beat
Definition
TapTempo.h:57
lmms::TapTempo::TapTempo
TapTempo()
Definition
TapTempo.cpp:47
lmms::TapTempo::MaxIntervals
static constexpr auto MaxIntervals
Definition
TapTempo.h:53
lmms::TapTempo::saveSettings
void saveSettings(QDomDocument &, QDomElement &) override
Definition
TapTempo.h:47
lmms::TapTempo::instantiateView
gui::PluginView * instantiateView(QWidget *) override
Create a view for the model.
Definition
TapTempo.h:50
lmms::TapTempo::m_lastTap
std::chrono::time_point< clock > m_lastTap
Definition
TapTempo.h:55
lmms::TapTempo::loadSettings
void loadSettings(const QDomElement &) override
Definition
TapTempo.h:48
lmms::TapTempo::m_bpm
double m_bpm
Definition
TapTempo.h:59
lmms::TapTempo::tap
void tap(bool play)
Definition
TapTempo.cpp:53
lmms::TapTempo::bpm
double bpm() const
Definition
TapTempo.cpp:124
lmms::TapTempo::clock
std::chrono::steady_clock clock
Definition
TapTempo.h:54
lmms::TapTempo::nodeName
QString nodeName() const override
Definition
TapTempo.cpp:119
lmms::TapTempo::m_intervals
std::array< std::chrono::milliseconds, MaxIntervals > m_intervals
Definition
TapTempo.h:56
lmms::TapTempo::reset
void reset()
Definition
TapTempo.cpp:111
lmms::TapTempo::sync
void sync()
Definition
TapTempo.cpp:106
lmms::TapTempo::m_taps
int m_taps
Definition
TapTempo.h:58
lmms::ToolPlugin::ToolPlugin
ToolPlugin(const Descriptor *_descriptor, Model *_parent)
Definition
ToolPlugin.cpp:33
lmms::gui::PluginView
Definition
PluginView.h:36
lmms::gui::TapTempoView
Definition
TapTempoView.h:41
lmms
Definition
RemotePluginBase.cpp:34
Generated on
for lmms by
1.18.0