upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -57,9 +57,16 @@ namespace MidiBufferHelpers
|
||||
}
|
||||
else if (byte == 0xff)
|
||||
{
|
||||
int n;
|
||||
const int bytesLeft = MidiMessage::readVariableLengthVal (data + 1, n);
|
||||
size = jmin (maxBytes, n + 2 + bytesLeft);
|
||||
if (maxBytes == 1)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int n;
|
||||
const int bytesLeft = MidiMessage::readVariableLengthVal (data + 1, n);
|
||||
size = jmin (maxBytes, n + 2 + bytesLeft);
|
||||
}
|
||||
}
|
||||
else if (byte >= 0x80)
|
||||
{
|
||||
|
@ -169,14 +169,14 @@ MidiFile& MidiFile::operator= (const MidiFile& other)
|
||||
}
|
||||
|
||||
MidiFile::MidiFile (MidiFile&& other)
|
||||
: tracks (static_cast<OwnedArray<MidiMessageSequence>&&> (other.tracks)),
|
||||
: tracks (std::move (other.tracks)),
|
||||
timeFormat (other.timeFormat)
|
||||
{
|
||||
}
|
||||
|
||||
MidiFile& MidiFile::operator= (MidiFile&& other)
|
||||
{
|
||||
tracks = static_cast<OwnedArray<MidiMessageSequence>&&> (other.tracks);
|
||||
tracks = std::move (other.tracks);
|
||||
timeFormat = other.timeFormat;
|
||||
return *this;
|
||||
}
|
||||
@ -245,7 +245,7 @@ double MidiFile::getLastTimestamp() const
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
bool MidiFile::readFrom (InputStream& sourceStream)
|
||||
bool MidiFile::readFrom (InputStream& sourceStream, bool createMatchingNoteOffs)
|
||||
{
|
||||
clear();
|
||||
MemoryBlock data;
|
||||
@ -276,7 +276,7 @@ bool MidiFile::readFrom (InputStream& sourceStream)
|
||||
break;
|
||||
|
||||
if (chunkType == (int) ByteOrder::bigEndianInt ("MTrk"))
|
||||
readNextTrack (d, chunkSize);
|
||||
readNextTrack (d, chunkSize, createMatchingNoteOffs);
|
||||
|
||||
size -= (size_t) chunkSize + 8;
|
||||
d += chunkSize;
|
||||
@ -290,7 +290,7 @@ bool MidiFile::readFrom (InputStream& sourceStream)
|
||||
return false;
|
||||
}
|
||||
|
||||
void MidiFile::readNextTrack (const uint8* data, int size)
|
||||
void MidiFile::readNextTrack (const uint8* data, int size, bool createMatchingNoteOffs)
|
||||
{
|
||||
double time = 0;
|
||||
uint8 lastStatusByte = 0;
|
||||
@ -337,7 +337,9 @@ void MidiFile::readNextTrack (const uint8* data, int size)
|
||||
});
|
||||
|
||||
addTrack (result);
|
||||
tracks.getLast()->updateMatchedPairs();
|
||||
|
||||
if (createMatchingNoteOffs)
|
||||
tracks.getLast()->updateMatchedPairs();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@ -361,7 +363,7 @@ void MidiFile::convertTimestampTicksToSeconds()
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
bool MidiFile::writeTo (OutputStream& out, int midiFileType)
|
||||
bool MidiFile::writeTo (OutputStream& out, int midiFileType) const
|
||||
{
|
||||
jassert (midiFileType >= 0 && midiFileType <= 2);
|
||||
|
||||
@ -379,7 +381,7 @@ bool MidiFile::writeTo (OutputStream& out, int midiFileType)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MidiFile::writeTrack (OutputStream& mainOut, const MidiMessageSequence& ms)
|
||||
bool MidiFile::writeTrack (OutputStream& mainOut, const MidiMessageSequence& ms) const
|
||||
{
|
||||
MemoryOutputStream out;
|
||||
|
||||
|
@ -156,16 +156,25 @@ public:
|
||||
terms of midi ticks. To convert them to seconds, use the convertTimestampTicksToSeconds()
|
||||
method.
|
||||
|
||||
@param sourceStream the source stream
|
||||
@param createMatchingNoteOffs if true, any missing note-offs for previous note-ons will
|
||||
be automatically added at the end of the file by calling
|
||||
MidiMessageSequence::updateMatchedPairs on each track.
|
||||
|
||||
@returns true if the stream was read successfully
|
||||
*/
|
||||
bool readFrom (InputStream& sourceStream);
|
||||
bool readFrom (InputStream& sourceStream, bool createMatchingNoteOffs = true);
|
||||
|
||||
/** Writes the midi tracks as a standard midi file.
|
||||
The midiFileType value is written as the file's format type, which can be 0, 1
|
||||
or 2 - see the midi file spec for more info about that.
|
||||
|
||||
@param destStream the destination stream
|
||||
@param midiFileType the type of midi file
|
||||
|
||||
@returns true if the operation succeeded.
|
||||
*/
|
||||
bool writeTo (OutputStream& destStream, int midiFileType = 1);
|
||||
bool writeTo (OutputStream& destStream, int midiFileType = 1) const;
|
||||
|
||||
/** Converts the timestamp of all the midi events from midi ticks to seconds.
|
||||
|
||||
@ -174,14 +183,13 @@ public:
|
||||
*/
|
||||
void convertTimestampTicksToSeconds();
|
||||
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
OwnedArray<MidiMessageSequence> tracks;
|
||||
short timeFormat;
|
||||
|
||||
void readNextTrack (const uint8*, int size);
|
||||
bool writeTrack (OutputStream&, const MidiMessageSequence&);
|
||||
void readNextTrack (const uint8*, int, bool);
|
||||
bool writeTrack (OutputStream&, const MidiMessageSequence&) const;
|
||||
|
||||
JUCE_LEAK_DETECTOR (MidiFile)
|
||||
};
|
||||
|
@ -38,8 +38,8 @@ class JUCE_API MidiKeyboardStateListener
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
MidiKeyboardStateListener() noexcept {}
|
||||
virtual ~MidiKeyboardStateListener() {}
|
||||
MidiKeyboardStateListener() = default;
|
||||
virtual ~MidiKeyboardStateListener() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** Called when one of the MidiKeyboardState's keys is pressed.
|
||||
|
@ -224,9 +224,16 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const
|
||||
}
|
||||
else if (byte == 0xff)
|
||||
{
|
||||
int n;
|
||||
const int bytesLeft = readVariableLengthVal (src + 1, n);
|
||||
size = jmin (sz + 1, n + 2 + bytesLeft);
|
||||
if (sz == 1)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int n;
|
||||
const int bytesLeft = readVariableLengthVal (src + 1, n);
|
||||
size = jmin (sz + 1, n + 2 + bytesLeft);
|
||||
}
|
||||
|
||||
auto dest = allocateSpace (size);
|
||||
*dest = (uint8) byte;
|
||||
|
@ -83,19 +83,19 @@ public:
|
||||
complete message, and will return the number of bytes it used. This lets
|
||||
you read a sequence of midi messages from a file or stream.
|
||||
|
||||
@param data the data to read from
|
||||
@param maxBytesToUse the maximum number of bytes it's allowed to read
|
||||
@param numBytesUsed returns the number of bytes that were actually needed
|
||||
@param lastStatusByte in a sequence of midi messages, the initial byte
|
||||
can be dropped from a message if it's the same as the
|
||||
first byte of the previous message, so this lets you
|
||||
supply the byte to use if the first byte of the message
|
||||
has in fact been dropped.
|
||||
@param timeStamp the time to give the midi message - this value doesn't
|
||||
use any particular units, so will be application-specific
|
||||
@param data the data to read from
|
||||
@param maxBytesToUse the maximum number of bytes it's allowed to read
|
||||
@param numBytesUsed returns the number of bytes that were actually needed
|
||||
@param lastStatusByte in a sequence of midi messages, the initial byte
|
||||
can be dropped from a message if it's the same as the
|
||||
first byte of the previous message, so this lets you
|
||||
supply the byte to use if the first byte of the message
|
||||
has in fact been dropped.
|
||||
@param timeStamp the time to give the midi message - this value doesn't
|
||||
use any particular units, so will be application-specific
|
||||
@param sysexHasEmbeddedLength when reading sysexes, this flag indicates whether
|
||||
to expect the data to begin with a variable-length field
|
||||
indicating its size
|
||||
to expect the data to begin with a variable-length
|
||||
field indicating its size
|
||||
*/
|
||||
MidiMessage (const void* data, int maxBytesToUse,
|
||||
int& numBytesUsed, uint8 lastStatusByte,
|
||||
|
@ -24,7 +24,7 @@ namespace juce
|
||||
{
|
||||
|
||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm) : message (mm) {}
|
||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (MidiMessage&& mm) : message (static_cast<MidiMessage&&> (mm)) {}
|
||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (MidiMessage&& mm) : message (std::move (mm)) {}
|
||||
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() {}
|
||||
|
||||
//==============================================================================
|
||||
@ -53,13 +53,13 @@ MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence&
|
||||
}
|
||||
|
||||
MidiMessageSequence::MidiMessageSequence (MidiMessageSequence&& other) noexcept
|
||||
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list))
|
||||
: list (std::move (other.list))
|
||||
{
|
||||
}
|
||||
|
||||
MidiMessageSequence& MidiMessageSequence::operator= (MidiMessageSequence&& other) noexcept
|
||||
{
|
||||
list = static_cast<OwnedArray<MidiEventHolder>&&> (other.list);
|
||||
list = std::move (other.list);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (const MidiM
|
||||
|
||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (MidiMessage&& newMessage, double timeAdjustment)
|
||||
{
|
||||
return addEvent (new MidiEventHolder (static_cast<MidiMessage&&> (newMessage)), timeAdjustment);
|
||||
return addEvent (new MidiEventHolder (std::move (newMessage)), timeAdjustment);
|
||||
}
|
||||
|
||||
void MidiMessageSequence::deleteEvent (int index, bool deleteMatchingNoteUp)
|
||||
|
Reference in New Issue
Block a user