lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
MidiClip.h
Go to the documentation of this file.
1
/*
2
* MidiClip.h - declaration of class MidiClip, which contains all information
3
* about a clip
4
*
5
* Copyright (c) 2004-2014 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_MIDI_CLIP_H
27
#define LMMS_MIDI_CLIP_H
28
29
#include "
Clip.h
"
30
#include "
Note.h
"
31
32
33
namespace
lmms
34
{
35
36
37
class
InstrumentTrack
;
38
39
namespace
gui
40
{
41
class
MidiClipView
;
42
}
43
44
45
class
LMMS_EXPORT
MidiClip
:
public
Clip
46
{
47
Q_OBJECT
48
public
:
49
enum class
Type
50
{
51
BeatClip,
52
MelodyClip
53
} ;
54
55
MidiClip
(
InstrumentTrack
* instrumentTrack );
56
~MidiClip
()
override
;
57
58
void
init();
59
60
void
updateLength()
override
;
61
62
// note management
63
Note
* addNote(
const
Note
& _new_note,
const
bool
_quant_pos =
true
);
64
65
NoteVector::const_iterator removeNote(NoteVector::const_iterator it);
66
NoteVector::const_iterator removeNote(
Note
* note);
67
68
Note
* noteAtStep(
int
_step );
69
70
void
rearrangeAllNotes();
71
void
clearNotes();
72
73
inline
const
NoteVector
&
notes
()
const
74
{
75
return
m_notes
;
76
}
77
78
Note
* addStepNote(
int
step );
79
void
setStep(
int
step,
bool
enabled );
80
82
void
reverseNotes(
const
NoteVector
& notes);
83
84
// Split the list of notes on the given position
85
void
splitNotes(
const
NoteVector
& notes,
TimePos
pos);
86
87
// Split the list of notes along a line
88
void
splitNotesAlongLine(
const
NoteVector
notes,
TimePos
pos1,
int
key1,
TimePos
pos2,
int
key2,
bool
deleteShortEnds);
89
90
// clip-type stuff
91
inline
Type
type
()
const
92
{
93
return
m_clipType
;
94
}
95
96
97
// next/previous track based on position in the containing track
98
MidiClip
* previousMidiClip()
const
;
99
MidiClip
* nextMidiClip()
const
;
100
101
// settings-management
102
void
exportToXML(QDomDocument& doc, QDomElement& midiClipElement,
bool
onlySelectedNotes =
false
);
103
void
saveSettings( QDomDocument & _doc, QDomElement & _parent )
override
;
104
void
loadSettings(
const
QDomElement & _this )
override
;
105
inline
QString
nodeName
()
const override
106
{
107
return
"midiclip"
;
108
}
109
110
inline
InstrumentTrack
*
instrumentTrack
()
const
111
{
112
return
m_instrumentTrack
;
113
}
114
115
bool
empty();
116
117
118
gui::ClipView
* createView(
gui::TrackView
* _tv )
override
;
119
120
MidiClip
*
clone
()
override
121
{
122
return
new
MidiClip
(*
this
);
123
}
124
125
126
using
Model::dataChanged
;
127
128
public
slots:
129
void
addSteps();
130
void
cloneSteps();
131
void
removeSteps();
132
void
clear();
133
134
protected
:
135
MidiClip
(
const
MidiClip
& other );
136
void
updatePatternTrack();
137
138
protected
slots:
139
void
changeTimeSignature();
140
141
142
private
:
143
TimePos
beatClipLength()
const
;
144
145
void
setType( Type _new_clip_type );
146
void
checkType();
147
148
void
resizeToFirstTrack();
149
150
InstrumentTrack
*
m_instrumentTrack
;
151
152
Type
m_clipType
;
153
154
// data-stuff
155
NoteVector
m_notes
;
156
int
m_steps
;
157
158
MidiClip
*
adjacentMidiClipByOffset
(
int
offset)
const
;
159
160
friend
class
gui::MidiClipView
;
161
162
163
signals:
164
void
destroyedMidiClip
(
lmms::MidiClip
* );
165
} ;
166
167
168
}
// namespace lmms
169
170
#endif
// LMMS_MIDI_CLIP_H
Clip.h
Note.h
lmms::Clip::Clip
Clip(Track *track)
Creates a new clip for the given track track.
Definition
Clip.cpp:41
lmms::InstrumentTrack
Definition
InstrumentTrack.h:62
lmms::MidiClip
Definition
MidiClip.h:46
lmms::MidiClip::m_notes
NoteVector m_notes
Definition
MidiClip.h:155
lmms::MidiClip::MidiClip
MidiClip(InstrumentTrack *instrumentTrack)
Definition
MidiClip.cpp:42
lmms::MidiClip::clone
MidiClip * clone() override
Creates a copy of this clip.
Definition
MidiClip.h:120
lmms::MidiClip::type
Type type() const
Definition
MidiClip.h:91
lmms::MidiClip::m_steps
int m_steps
Definition
MidiClip.h:156
lmms::MidiClip::instrumentTrack
InstrumentTrack * instrumentTrack() const
Definition
MidiClip.h:110
lmms::MidiClip::adjacentMidiClipByOffset
MidiClip * adjacentMidiClipByOffset(int offset) const
Definition
MidiClip.cpp:552
lmms::MidiClip::m_instrumentTrack
InstrumentTrack * m_instrumentTrack
Definition
MidiClip.h:150
lmms::MidiClip::m_clipType
Type m_clipType
Definition
MidiClip.h:152
lmms::MidiClip::Type
Type
Definition
MidiClip.h:50
lmms::MidiClip::nodeName
QString nodeName() const override
Definition
MidiClip.h:105
lmms::MidiClip::destroyedMidiClip
void destroyedMidiClip(lmms::MidiClip *)
lmms::MidiClip::notes
const NoteVector & notes() const
Definition
MidiClip.h:73
lmms::Model::dataChanged
void dataChanged()
lmms::Note
Definition
Note.h:101
lmms::TimePos
Definition
TimePos.h:68
lmms::gui::ClipView
Definition
ClipView.h:52
lmms::gui::MidiClipView
Definition
MidiClipView.h:42
lmms::gui::TrackView
Definition
TrackView.h:60
lmms::gui
Definition
AudioPortAudio.cpp:209
lmms
Definition
RemotePluginBase.cpp:34
lmms::NoteVector
std::vector< Note * > NoteVector
Definition
Note.h:282
Generated on
for lmms by
1.18.0