OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_MidiMessageSequence.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23 namespace juce
24{
25
26//==============================================================================
37 class JUCE_API MidiMessageSequence
38{
39 public:
40 //==============================================================================
42 MidiMessageSequence();
43
45 MidiMessageSequence (const MidiMessageSequence&);
46
48 MidiMessageSequence& operator= (const MidiMessageSequence&);
49
51 MidiMessageSequence (MidiMessageSequence&&) noexcept;
52
54 MidiMessageSequence& operator= (MidiMessageSequence&&) noexcept;
55
57 ~MidiMessageSequence();
58
59 //==============================================================================
67 class MidiEventHolder
68 {
69 public:
70 //==============================================================================
72 ~MidiEventHolder();
73
75 MidiMessage message;
76
85 MidiEventHolder* noteOffObject = nullptr;
86
87 private:
88 //==============================================================================
89 friend class MidiMessageSequence;
90 MidiEventHolder (const MidiMessage&);
91 MidiEventHolder (MidiMessage&&);
92 JUCE_LEAK_DETECTOR (MidiEventHolder)
93 };
94
95 //==============================================================================
97 void clear();
98
100 int getNumEvents() const noexcept;
101
103 MidiEventHolder* getEventPointer (int index) const noexcept;
104
106 MidiEventHolder** begin() noexcept;
107
109 MidiEventHolder* const* begin() const noexcept;
110
112 MidiEventHolder** end() noexcept;
113
115 MidiEventHolder* const* end() const noexcept;
116
121 double getTimeOfMatchingKeyUp (int index) const noexcept;
122
127 int getIndexOfMatchingKeyUp (int index) const noexcept;
128
130 int getIndexOf (const MidiEventHolder* event) const noexcept;
131
136 int getNextIndexAtTime (double timeStamp) const noexcept;
137
138 //==============================================================================
142 double getStartTime() const noexcept;
143
147 double getEndTime() const noexcept;
148
152 double getEventTime (int index) const noexcept;
153
154 //==============================================================================
167 MidiEventHolder* addEvent (const MidiMessage& newMessage, double timeAdjustment = 0);
168
181 MidiEventHolder* addEvent (MidiMessage&& newMessage, double timeAdjustment = 0);
182
191 void deleteEvent (int index, bool deleteMatchingNoteUp);
192
206 void addSequence (const MidiMessageSequence& other,
207 double timeAdjustmentDelta,
208 double firstAllowableDestTime,
209 double endOfAllowableDestTimes);
210
218 void addSequence (const MidiMessageSequence& other,
219 double timeAdjustmentDelta);
220
221 //==============================================================================
228 void updateMatchedPairs() noexcept;
229
234 void sort() noexcept;
235
236 //==============================================================================
245 void extractMidiChannelMessages (int channelNumberToExtract,
246 MidiMessageSequence& destSequence,
247 bool alsoIncludeMetaEvents) const;
248
254 void extractSysExMessages (MidiMessageSequence& destSequence) const;
255
259 void deleteMidiChannelMessages (int channelNumberToRemove);
260
262 void deleteSysExMessages();
263
267 void addTimeToMessages (double deltaTime) noexcept;
268
269 //==============================================================================
289 void createControllerUpdatesForTime (int channelNumber, double time,
290 Array<MidiMessage>& resultMessages);
291
292 //==============================================================================
294 void swapWith (MidiMessageSequence&) noexcept;
295
296private:
297 //==============================================================================
298 friend class MidiFile;
299 OwnedArray<MidiEventHolder> list;
300
301 MidiEventHolder* addEvent (MidiEventHolder*, double);
302
303 JUCE_LEAK_DETECTOR (MidiMessageSequence)
304};
305
306} // namespace juce
juce::Array
Definition: juce_Array.h:56
juce::MidiFile
Definition: juce_MidiFile.h:42
juce::MidiMessageSequence::MidiEventHolder
Definition: juce_MidiMessageSequence.h:68
juce::MidiMessageSequence::MidiEventHolder::message
MidiMessage message
Definition: juce_MidiMessageSequence.h:75
juce::MidiMessageSequence
Definition: juce_MidiMessageSequence.h:38
juce::MidiMessage
Definition: juce_MidiMessage.h:35
juce::OwnedArray
Definition: juce_OwnedArray.h:51