6.0.0-rc4Source

QtFM::MidiFile Class

The MidiFile class reads the notes of a Standard MIDI File. More…

Header#include <QtFM>
CMaketarget_link_libraries(app PRIVATE Nt::FM)
ModuleNt FM C++ Classes

List of all members, including inherited members

Public Functions

MidiFile()
boolisValid() const
QList<Note>notes() const
QList<Control>controls() const
doubleduration() const
intformat() const
inttrackCount() const

Static Public Members

MidiFilefromData(const QByteArray &data, QString *error = nullptr)

Detailed Description

fromData() reads formats 0, 1 and 2, with musical or SMPTE timing, and gives each note its time and length in seconds according to the file's tempo changes. The sustain pedal lengthens notes; each note starts with the channel's program, volume and expression (in its gain), pan and pitch bend, and controls() lists the changes of those that MidiPlayer applies to notes already sounding. MidiPlayer plays the notes on an Engine.

Differences from Qt

Aftertouch, system exclusive messages and the controllers other than volume, expression, pan, sustain, the pitch-bend range and the resets are ignored.

Member Function Documentation

QtFM::MidiFile::MidiFile()

Constructs an empty, invalid file.

QList<Control> QtFM::MidiFile::controls() const

Returns the changes of the channels' level, pan and pitch bend, in time order. MidiPlayer applies them to the notes that sound when they happen.

double QtFM::MidiFile::duration() const

Returns the length of the music in seconds: the end of its last note.

int QtFM::MidiFile::format() const

Returns the format of the file: 0 for one track, 1 for parallel tracks, 2 for sequential ones; -1 for an invalid file.

[static] MidiFile QtFM::MidiFile::fromData(const QByteArray &data, QString *error = nullptr)

Returns the file in data, or an invalid file, with the reason in error.

bool QtFM::MidiFile::isValid() const

Returns true if the file was read.

QList<Note> QtFM::MidiFile::notes() const

Returns the notes, in the order they start.

int QtFM::MidiFile::trackCount() const

Returns the number of tracks.