mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-09 04:30:09 +00:00
Added an option to MidiFile to set the format type.
This commit is contained in:
parent
93bc4b97be
commit
87348c4467
2 changed files with 7 additions and 3 deletions
|
|
@ -350,11 +350,13 @@ void MidiFile::convertTimestampTicksToSeconds()
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
bool MidiFile::writeTo (OutputStream& out)
|
||||
bool MidiFile::writeTo (OutputStream& out, int midiFileType)
|
||||
{
|
||||
jassert (midiFileType >= 0 && midiFileType <= 2);
|
||||
|
||||
out.writeIntBigEndian ((int) ByteOrder::bigEndianInt ("MThd"));
|
||||
out.writeIntBigEndian (6);
|
||||
out.writeShortBigEndian (1); // type
|
||||
out.writeShortBigEndian ((short) midiFileType);
|
||||
out.writeShortBigEndian ((short) tracks.size());
|
||||
out.writeShortBigEndian (timeFormat);
|
||||
|
||||
|
|
|
|||
|
|
@ -151,9 +151,11 @@ public:
|
|||
bool readFrom (InputStream& sourceStream);
|
||||
|
||||
/** 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.
|
||||
@returns true if the operation succeeded.
|
||||
*/
|
||||
bool writeTo (OutputStream& destStream);
|
||||
bool writeTo (OutputStream& destStream, int midiFileType = 1);
|
||||
|
||||
/** Converts the timestamp of all the midi events from midi ticks to seconds.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue