OpenShot Audio Library | OpenShotAudio: juce_MidiFile.h Source File

OpenShot Audio Library | OpenShotAudio 0.3.1

Loading...
Searching...
No Matches
juce_MidiFile.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
23namespace juce
24{
25
26//==============================================================================
41 class JUCE_API MidiFile
42{
43public:
44 //==============================================================================
46 MidiFile();
47
49 ~MidiFile();
50
52 MidiFile (const MidiFile&);
53
55 MidiFile& operator= (const MidiFile&);
56
58 MidiFile (MidiFile&&);
59
61 MidiFile& operator= (MidiFile&&);
62
63 //==============================================================================
67 int getNumTracks() const noexcept;
68
73 const MidiMessageSequence* getTrack (int index) const noexcept;
74
79 void addTrack (const MidiMessageSequence& trackSequence);
80
84 void clear();
85
98 short getTimeFormat() const noexcept;
99
109 void setTicksPerQuarterNote (int ticksPerQuarterNote) noexcept;
110
123 void setSmpteTimeFormat (int framesPerSecond,
124 int subframeResolution) noexcept;
125
126 //==============================================================================
131 void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
132
137 void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
138
142 void findAllKeySigEvents (MidiMessageSequence& keySigEvents) const;
143
147 double getLastTimestamp() const;
148
149 //==============================================================================
166 bool readFrom (InputStream& sourceStream, bool createMatchingNoteOffs = true);
167
177 bool writeTo (OutputStream& destStream, int midiFileType = 1) const;
178
184 void convertTimestampTicksToSeconds();
185
186private:
187 //==============================================================================
188 OwnedArray<MidiMessageSequence> tracks;
189 short timeFormat;
190
191 void readNextTrack (const uint8*, int, bool);
192 bool writeTrack (OutputStream&, const MidiMessageSequence&) const;
193
194 JUCE_LEAK_DETECTOR (MidiFile)
195};
196
197} // namespace juce
juce::InputStream
Definition: juce_InputStream.h:37
juce::MidiFile
Definition: juce_MidiFile.h:42
juce::MidiMessageSequence
Definition: juce_MidiMessageSequence.h:38
juce::OutputStream
Definition: juce_OutputStream.h:38
juce::OwnedArray
Definition: juce_OwnedArray.h:51