openshot-audio  0.1.4
juce_MidiBuffer.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_MIDIBUFFER_H_INCLUDED
26 #define JUCE_MIDIBUFFER_H_INCLUDED
27 
28 
29 //==============================================================================
44 {
45 public:
46  //==============================================================================
49 
51  explicit MidiBuffer (const MidiMessage& message) noexcept;
52 
55 
57  MidiBuffer& operator= (const MidiBuffer&) noexcept;
58 
60  ~MidiBuffer();
61 
62  //==============================================================================
64  void clear() noexcept;
65 
71  void clear (int start, int numSamples);
72 
76  bool isEmpty() const noexcept;
77 
84  int getNumEvents() const noexcept;
85 
97  void addEvent (const MidiMessage& midiMessage, int sampleNumber);
98 
115  void addEvent (const void* rawMidiData,
116  int maxBytesOfMidiData,
117  int sampleNumber);
118 
133  void addEvents (const MidiBuffer& otherBuffer,
134  int startSample,
135  int numSamples,
136  int sampleDeltaToAdd);
137 
141  int getFirstEventTime() const noexcept;
142 
146  int getLastEventTime() const noexcept;
147 
148  //==============================================================================
154  void swapWith (MidiBuffer&) noexcept;
155 
160  void ensureSize (size_t minimumNumBytes);
161 
162  //==============================================================================
172  {
173  public:
174  //==============================================================================
176  Iterator (const MidiBuffer&) noexcept;
177 
179  ~Iterator() noexcept;
180 
181  //==============================================================================
185  void setNextSamplePosition (int samplePosition) noexcept;
186 
196  bool getNextEvent (MidiMessage& result,
197  int& samplePosition) noexcept;
198 
212  bool getNextEvent (const uint8* &midiData,
213  int& numBytesOfMidiData,
214  int& samplePosition) noexcept;
215 
216  private:
217  //==============================================================================
218  const MidiBuffer& buffer;
219  const uint8* data;
220 
222  };
223 
229 
230 private:
232 };
233 
234 
235 #endif // JUCE_MIDIBUFFER_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Array< uint8 > data
Definition: juce_MidiBuffer.h:228
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define JUCE_DECLARE_NON_COPYABLE(className)
Definition: juce_PlatformDefs.h:191
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_MidiBuffer.h:43
unsigned char uint8
Definition: juce_MathsFunctions.h:43
Definition: juce_MidiMessage.h:35
Definition: juce_MidiBuffer.h:171