Loading...
Searching...
No Matches
juce_MidiFile.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API MidiFile
{
public:
//==============================================================================
MidiFile();
MidiFile (const MidiFile&);
MidiFile& operator= (const MidiFile&);
MidiFile (MidiFile&&);
MidiFile& operator= (MidiFile&&);
//==============================================================================
int getNumTracks() const noexcept;
const MidiMessageSequence* getTrack (int index) const noexcept;
void addTrack (const MidiMessageSequence& trackSequence);
void clear();
short getTimeFormat() const noexcept;
void setTicksPerQuarterNote (int ticksPerQuarterNote) noexcept;
void setSmpteTimeFormat (int framesPerSecond,
int subframeResolution) noexcept;
//==============================================================================
void findAllTempoEvents (MidiMessageSequence& tempoChangeEvents) const;
void findAllTimeSigEvents (MidiMessageSequence& timeSigEvents) const;
void findAllKeySigEvents (MidiMessageSequence& keySigEvents) const;
double getLastTimestamp() const;
//==============================================================================
bool readFrom (InputStream& sourceStream,
bool createMatchingNoteOffs = true,
int* midiFileType = nullptr);
bool writeTo (OutputStream& destStream, int midiFileType = 1) const;
void convertTimestampTicksToSeconds();
private:
//==============================================================================
OwnedArray<MidiMessageSequence> tracks;
short timeFormat;
void readNextTrack (const uint8*, int, bool);
bool writeTrack (OutputStream&, const MidiMessageSequence&) const;
JUCE_LEAK_DETECTOR (MidiFile)
};
} // 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