OpenShot Audio Library | OpenShotAudio: juce_MidiFile.h Source File

OpenShot Audio Library | OpenShotAudio 0.4.0 |

Loading...
Searching...
No Matches
juce_MidiFile.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
23namespace juce
24{
25
26//==============================================================================
41 class JUCE_API MidiFile
42{
43public:
44 //==============================================================================
46 MidiFile();
47
49 MidiFile (const MidiFile&);
50
52 MidiFile& operator= (const MidiFile&);
53
55 MidiFile (MidiFile&&);
56
58 MidiFile& operator= (MidiFile&&);
59
60 //==============================================================================
64 int getNumTracks() const noexcept;
65
70 const MidiMessageSequence* getTrack (int index) const noexcept;
71
76 void addTrack (const MidiMessageSequence& trackSequence);
77
81 void clear();
82
95 short getTimeFormat() const noexcept;
96
106 void setTicksPerQuarterNote (int ticksPerQuarterNote) noexcept;
107
120 void setSmpteTimeFormat (int framesPerSecond,
121 int subframeResolution) noexcept;
122
123 //==============================================================================
128 void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
129
134 void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
135
139 void findAllKeySigEvents (MidiMessageSequence& keySigEvents) const;
140
144 double getLastTimestamp() const;
145
146 //==============================================================================
165 bool readFrom (InputStream& sourceStream,
166 bool createMatchingNoteOffs = true,
167 int* midiFileType = nullptr);
168
178 bool writeTo (OutputStream& destStream, int midiFileType = 1) const;
179
185 void convertTimestampTicksToSeconds();
186
187private:
188 //==============================================================================
189 OwnedArray<MidiMessageSequence> tracks;
190 short timeFormat;
191
192 void readNextTrack (const uint8*, int, bool);
193 bool writeTrack (OutputStream&, const MidiMessageSequence&) const;
194
195 JUCE_LEAK_DETECTOR (MidiFile)
196};
197
198} // namespace juce
juce::InputStream
Definition juce_InputStream.h:37
juce::MidiFile::convertTimestampTicksToSeconds
void convertTimestampTicksToSeconds()
Definition juce_MidiFile.cpp:430
juce::MidiFile::addTrack
void addTrack(const MidiMessageSequence &trackSequence)
Definition juce_MidiFile.cpp:298
juce::MidiFile::setTicksPerQuarterNote
void setTicksPerQuarterNote(int ticksPerQuarterNote) noexcept
Definition juce_MidiFile.cpp:309
juce::MidiFile::getNumTracks
int getNumTracks() const noexcept
Definition juce_MidiFile.cpp:288
juce::MidiFile::getTimeFormat
short getTimeFormat() const noexcept
Definition juce_MidiFile.cpp:304
juce::MidiFile::setSmpteTimeFormat
void setSmpteTimeFormat(int framesPerSecond, int subframeResolution) noexcept
Definition juce_MidiFile.cpp:314
juce::MidiFile::getLastTimestamp
double getLastTimestamp() const
Definition juce_MidiFile.cpp:335
juce::MidiFile::readFrom
bool readFrom(InputStream &sourceStream, bool createMatchingNoteOffs=true, int *midiFileType=nullptr)
Definition juce_MidiFile.cpp:346
juce::MidiFile::MidiFile
MidiFile()
Definition juce_MidiFile.cpp:254
juce::MidiFile::findAllTimeSigEvents
void findAllTimeSigEvents(MidiMessageSequence &timeSigEvents) const
Definition juce_MidiFile.cpp:325
juce::MidiFile::findAllKeySigEvents
void findAllKeySigEvents(MidiMessageSequence &keySigEvents) const
Definition juce_MidiFile.cpp:330
juce::MidiFile::findAllTempoEvents
void findAllTempoEvents(MidiMessageSequence &tempoChangeEvents) const
Definition juce_MidiFile.cpp:320
juce::MidiFile::clear
void clear()
Definition juce_MidiFile.cpp:282
juce::MidiFile::getTrack
const MidiMessageSequence * getTrack(int index) const noexcept
Definition juce_MidiFile.cpp:293
juce::MidiFile::writeTo
bool writeTo(OutputStream &destStream, int midiFileType=1) const
Definition juce_MidiFile.cpp:450
juce::MidiMessageSequence
Definition juce_MidiMessageSequence.h:38
juce::OutputStream
Definition juce_OutputStream.h:38
juce::OwnedArray
Definition juce_OwnedArray.h:50