LMMS
Loading...
Searching...
No Matches
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
31namespace lmms
32{
33
34namespace gui
35{
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 */
64class LMMS_EXPORT PatternStore : public TrackContainer
65{
66 Q_OBJECT
67 mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel);
68public:
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;
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
97public slots:
98 void play();
99 void stop();
100 void updateComboBox();
101
102signals:
104
105private:
107
108
109 // Where the pattern selection combo box is
111
112} ;
113
114
115} // namespace lmms
116
117#endif // LMMS_PATTERN_STORE_H
Definition Clip.h:50
Definition ComboBoxModel.h:39
bar_t lengthOfPattern(int pattern) const
Definition PatternStore.cpp:84
~PatternStore() override=default
virtual bool play(TimePos start, const f_cnt_t frames, const f_cnt_t frameBase, int clipNum=-1)
Definition PatternStore.cpp:47
PatternStore()
Definition PatternStore.cpp:37
void updateAfterTrackAdd() override
Definition PatternStore.cpp:73
mapPropertyFromModel(int, currentPattern, setCurrentPattern, m_patternComboBoxModel)
ComboBoxModel m_patternComboBoxModel
Definition PatternStore.h:106
QString nodeName() const override
Definition PatternStore.h:76
bar_t lengthOfCurrentPattern()
Definition PatternStore.h:82
Definition TimePos.h:68
TrackContainer()
Definition TrackContainer.cpp:48
Definition PatternEditor.h:84
virtual ASIOError stop()=0
virtual ASIOError start()=0
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
std::int32_t bar_t
Definition LmmsTypes.h:34
QMap< AutomatableModel *, float > AutomatedValueMap
Definition AutomatableModel.h:511
std::uint64_t f_cnt_t
Definition LmmsTypes.h:43
int * pattern
Definition match.c:126