OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_MidiMessageSequence.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
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
56 //==============================================================================
64 class MidiEventHolder
65 {
66 public:
67 //==============================================================================
69 MidiMessage message;
70
79 MidiEventHolder* noteOffObject = nullptr;
80
81 private:
82 //==============================================================================
83 friend class MidiMessageSequence;
84 MidiEventHolder (const MidiMessage&);
85 MidiEventHolder (MidiMessage&&);
86 JUCE_LEAK_DETECTOR (MidiEventHolder)
87 };
88
89 //==============================================================================
91 void clear();
92
94 int getNumEvents() const noexcept;
95
97 MidiEventHolder* getEventPointer (int index) const noexcept;
98
100 MidiEventHolder** begin() noexcept;
101
103 MidiEventHolder* const* begin() const noexcept;
104
106 MidiEventHolder** end() noexcept;
107
109 MidiEventHolder* const* end() const noexcept;
110
115 double getTimeOfMatchingKeyUp (int index) const noexcept;
116
121 int getIndexOfMatchingKeyUp (int index) const noexcept;
122
124 int getIndexOf (const MidiEventHolder* event) const noexcept;
125
130 int getNextIndexAtTime (double timeStamp) const noexcept;
131
132 //==============================================================================
136 double getStartTime() const noexcept;
137
141 double getEndTime() const noexcept;
142
146 double getEventTime (int index) const noexcept;
147
148 //==============================================================================
161 MidiEventHolder* addEvent (const MidiMessage& newMessage, double timeAdjustment = 0);
162
175 MidiEventHolder* addEvent (MidiMessage&& newMessage, double timeAdjustment = 0);
176
185 void deleteEvent (int index, bool deleteMatchingNoteUp);
186
200 void addSequence (const MidiMessageSequence& other,
201 double timeAdjustmentDelta,
202 double firstAllowableDestTime,
203 double endOfAllowableDestTimes);
204
212 void addSequence (const MidiMessageSequence& other,
213 double timeAdjustmentDelta);
214
215 //==============================================================================
222 void updateMatchedPairs() noexcept;
223
228 void sort() noexcept;
229
230 //==============================================================================
239 void extractMidiChannelMessages (int channelNumberToExtract,
240 MidiMessageSequence& destSequence,
241 bool alsoIncludeMetaEvents) const;
242
248 void extractSysExMessages (MidiMessageSequence& destSequence) const;
249
253 void deleteMidiChannelMessages (int channelNumberToRemove);
254
256 void deleteSysExMessages();
257
261 void addTimeToMessages (double deltaTime) noexcept;
262
263 //==============================================================================
298 void createControllerUpdatesForTime (int channelNumber, double time,
299 Array<MidiMessage>& resultMessages);
300
301 //==============================================================================
303 void swapWith (MidiMessageSequence&) noexcept;
304
305private:
306 //==============================================================================
307 friend class MidiFile;
308 OwnedArray<MidiEventHolder> list;
309
310 MidiEventHolder* addEvent (MidiEventHolder*, double);
311
312 JUCE_LEAK_DETECTOR (MidiMessageSequence)
313};
314
315} // namespace juce
juce::Array
Definition juce_Array.h:56
juce::MidiFile
Definition juce_MidiFile.h:42
juce::MidiMessageSequence::MidiEventHolder
Definition juce_MidiMessageSequence.h:65
juce::MidiMessageSequence::MidiEventHolder::message
MidiMessage message
Definition juce_MidiMessageSequence.h:69
juce::MidiMessageSequence
Definition juce_MidiMessageSequence.h:38
juce::MidiMessage
Definition juce_MidiMessage.h:35
juce::OwnedArray
Definition juce_OwnedArray.h:50