LMMS
Loading...
Searching...
No Matches
TempoSyncKnobModel.h
Go to the documentation of this file.
1/*
2 * TempoSyncKnobModel.h - adds bpm to ms conversion for knob class
3 *
4 * Copyright (c) 2005-2008 Danny McRae <khjklujn/at/yahoo.com>
5 * Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_TEMPO_SYNC_KNOB_MODEL_H
27#define LMMS_TEMPO_SYNC_KNOB_MODEL_H
28
29#include "MeterModel.h"
30
31class QAction;
32
33namespace lmms
34{
35
36namespace gui
37{
38
39class TempoSyncKnob;
40
41} // namespace gui
42
43
44class LMMS_EXPORT TempoSyncKnobModel : public FloatModel
45{
46 Q_OBJECT
48public:
49 enum class SyncMode
50 {
52 DoubleWholeNote,
53 WholeNote,
54 HalfNote,
55 QuarterNote,
56 EighthNote,
57 SixteenthNote,
58 ThirtysecondNote,
59 Custom
60 } ;
61
62 TempoSyncKnobModel( const float _val, const float _min,
63 const float _max, const float _step,
64 const float _scale, Model * _parent,
65 const QString & _display_name = QString() );
66 ~TempoSyncKnobModel() override = default;
67
68 void saveSettings( QDomDocument & _doc, QDomElement & _this, const QString& name ) override;
69 void loadSettings( const QDomElement & _this, const QString& name ) override;
70
72 {
73 return m_tempoSyncMode;
74 }
75
76 void setSyncMode( SyncMode _new_mode );
77
78 float scale() const
79 {
80 return m_scale;
81 }
82
83 void setScale( float _new_scale );
84
86 MeterModel const & getCustomMeterModel() const { return m_custom; }
87
88signals:
90 void scaleChanged( float _new_scale );
91
92
93public slots:
94 inline void disableSync()
95 {
97 }
98 void setTempoSync( SyncMode _note_type );
99 void setTempoSync( QAction * _item );
100
101
102protected slots:
103 void calculateTempoSyncTime( lmms::bpm_t _bpm );
104 void updateCustom();
105
106
107private:
110 float m_scale;
111
113
114
115 friend class gui::TempoSyncKnob;
116
117} ;
118
119} // namespace lmms
120
121#endif // LMMS_TEMPO_SYNC_KNOB_MODEL_H
#define MODEL_IS_VISITABLE
Definition AutomatableModel.h:68
FloatModel(float val=0, float min=0, float max=0, float step=0, Model *parent=nullptr, const QString &displayName=QString(), bool defaultConstructed=false)
Definition AutomatableModel.h:467
Definition MeterModel.h:35
Definition Model.h:37
Definition TempoSyncKnobModel.h:45
MeterModel const & getCustomMeterModel() const
Definition TempoSyncKnobModel.h:86
MeterModel & getCustomMeterModel()
Definition TempoSyncKnobModel.h:85
float m_scale
Definition TempoSyncKnobModel.h:110
SyncMode
Definition TempoSyncKnobModel.h:50
@ None
Definition TempoSyncKnobModel.h:51
MeterModel m_custom
Definition TempoSyncKnobModel.h:112
SyncMode syncMode() const
Definition TempoSyncKnobModel.h:71
TempoSyncKnobModel(const float _val, const float _min, const float _max, const float _step, const float _scale, Model *_parent, const QString &_display_name=QString())
Definition TempoSyncKnobModel.cpp:38
SyncMode m_tempoSyncMode
Definition TempoSyncKnobModel.h:108
SyncMode m_tempoLastSyncMode
Definition TempoSyncKnobModel.h:109
float scale() const
Definition TempoSyncKnobModel.h:78
void saveSettings(QDomDocument &_doc, QDomElement &_this, const QString &name) override
Saves settings (value, automation links and controller connections) of AutomatableModel into specifie...
Definition TempoSyncKnobModel.cpp:129
void syncModeChanged(lmms::TempoSyncKnobModel::SyncMode _new_mode)
void setTempoSync(SyncMode _note_type)
Definition TempoSyncKnobModel.cpp:64
void disableSync()
Definition TempoSyncKnobModel.h:94
void loadSettings(const QDomElement &_this, const QString &name) override
Loads settings (value, automation links and controller connections) of AutomatableModel from specifie...
Definition TempoSyncKnobModel.cpp:140
~TempoSyncKnobModel() override=default
void scaleChanged(float _new_scale)
Definition TempoSyncKnob.h:41
static const char * name
Definition pugl.h:1582
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
std::uint16_t bpm_t
Definition LmmsTypes.h:45
static ZCONST char Far None[]
Definition unzip.c:380