lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
PatternStore.h
Go to the documentation of this file.
1
/*
2
* PatternStore.h - model-component of Pattern Editor
3
*
4
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
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_PATTERN_STORE_H
26
#define LMMS_PATTERN_STORE_H
27
28
#include "
TrackContainer.h
"
29
#include "
ComboBoxModel.h
"
30
31
namespace
lmms
32
{
33
34
namespace
gui
35
{
36
class
PatternEditorWindow
;
37
}
38
39
/*
40
* PatternStore is the backend of Pattern Editor:
41
*
42
* +----------------------------------+
43
* | PatternStore (TrackContainer) |
44
* | |
45
* | +------------------------------+ |
46
* | | Track 1 [Clip A] [Clip B] | |
47
* | +------------------------------+ |
48
* | |
49
* | +------------------------------+ |
50
* | | Track 2 [Clip C] [Clip D] | |
51
* | +------------------------------+ |
52
* +----------------------------------+
53
*
54
* There is only one PatternStore which holds all patterns, and it's very similar to the Song Editor.
55
* Think of it as a table - tracks are rows, bars are columns and clips are cells.
56
* With this logic a "pattern" is a column, i.e. all clips on the same bar.
57
* In the Pattern Editor you can select which pattern (column) you want to see, using the combo box at the top.
58
* In the illustration above, Clip A and Clip C start on bar 1, thus they are "Pattern 1".
59
*
60
* Do not confuse tracks and clips in the PatternStore with PatternTracks and PatternClips.
61
* - PatternTracks are used in the Song Editor. Each one reference a "pattern" in the PatternStore.
62
* - PatternClips are stored inside PatternTracks. They are just empty placeholders.
63
*/
64
class
LMMS_EXPORT
PatternStore
:
public
TrackContainer
65
{
66
Q_OBJECT
67
mapPropertyFromModel
(
int
, currentPattern, setCurrentPattern,
m_patternComboBoxModel
);
68
public
:
69
PatternStore
();
70
~PatternStore
()
override
=
default
;
71
72
virtual
bool
play
(
TimePos
start,
const
f_cnt_t
frames,
const
f_cnt_t
frameBase,
int
clipNum = -1);
73
74
void
updateAfterTrackAdd
()
override
;
75
76
inline
QString
nodeName
()
const override
77
{
78
return
"patternstore"
;
79
}
80
81
bar_t
lengthOfPattern(
int
pattern)
const
;
82
inline
bar_t
lengthOfCurrentPattern
()
83
{
84
return
lengthOfPattern
(currentPattern());
85
}
86
int
numOfPatterns()
const
;
87
void
removePattern(
int
pattern);
88
89
void
swapPattern(
int
p1,
int
p2);
90
91
void
updatePatternTrack(
Clip
* clip);
92
void
fixIncorrectPositions();
93
void
createClipsForPattern(
int
pattern);
94
95
AutomatedValueMap
automatedValuesAt(
TimePos
time,
int
clipNum)
const override
;
96
97
public
slots:
98
void
play();
99
void
stop();
100
void
updateComboBox();
101
102
signals:
103
void
trackUpdated
();
104
105
private
:
106
ComboBoxModel
m_patternComboBoxModel
;
107
108
109
// Where the pattern selection combo box is
110
friend
class
gui::PatternEditorWindow
;
111
112
} ;
113
114
115
}
// namespace lmms
116
117
#endif
// LMMS_PATTERN_STORE_H
ComboBoxModel.h
TrackContainer.h
lmms::Clip
Definition
Clip.h:50
lmms::ComboBoxModel
Definition
ComboBoxModel.h:39
lmms::PatternStore::lengthOfPattern
bar_t lengthOfPattern(int pattern) const
Definition
PatternStore.cpp:84
lmms::PatternStore::~PatternStore
~PatternStore() override=default
lmms::PatternStore::play
virtual bool play(TimePos start, const f_cnt_t frames, const f_cnt_t frameBase, int clipNum=-1)
Definition
PatternStore.cpp:47
lmms::PatternStore::PatternStore
PatternStore()
Definition
PatternStore.cpp:37
lmms::PatternStore::updateAfterTrackAdd
void updateAfterTrackAdd() override
Definition
PatternStore.cpp:73
lmms::PatternStore::mapPropertyFromModel
mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel)
lmms::PatternStore::m_patternComboBoxModel
ComboBoxModel m_patternComboBoxModel
Definition
PatternStore.h:106
lmms::PatternStore::trackUpdated
void trackUpdated()
lmms::PatternStore::nodeName
QString nodeName() const override
Definition
PatternStore.h:76
lmms::PatternStore::lengthOfCurrentPattern
bar_t lengthOfCurrentPattern()
Definition
PatternStore.h:82
lmms::TimePos
Definition
TimePos.h:68
lmms::TrackContainer::TrackContainer
TrackContainer()
Definition
TrackContainer.cpp:48
lmms::gui::PatternEditorWindow
Definition
PatternEditor.h:84
lmms::gui
Definition
AudioPortAudio.cpp:209
lmms
Definition
RemotePluginBase.cpp:34
lmms::bar_t
std::int32_t bar_t
Definition
LmmsTypes.h:34
lmms::AutomatedValueMap
QMap< AutomatableModel *, float > AutomatedValueMap
Definition
AutomatableModel.h:516
lmms::f_cnt_t
std::uint64_t f_cnt_t
Definition
LmmsTypes.h:43
Generated on
for lmms by
1.18.0