Just Intonation  Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
20 //=============================================================================
21 // Midi file parser
22 //=============================================================================
27 #include <QByteArray>
29 #include "midiplayereventlist.h"
31 class MidiPlayer;
45 class MidiPlayerParser : public QObject
46 {
48 public:
50  MidiPlayerEventList *eventlist, int verbosity=0);
51  bool parse (QByteArray &data);
53 private:
54  int findNextChunk (QByteArray &data, QString tag);
55  quint32 parseInt32 (QByteArray &data);
56  quint16 parseInt16 (QByteArray &data);
57  quint32 parseVariableLengthNumber(QByteArray &data);
58  bool parseTrack (QByteArray &data, int length, quint8 track);
59  bool parseEvent (QByteArray &data, quint8 track, quint32 delta, double cumulativeDelta);
60  bool parseMetaEvent (QByteArray &data, quint8 track, double cumulativeDelta);
61  void reportError (QString msg) const;
65  int mCursor;
66  bool SMPTE;
68  int mVerbosity;
69 };
quint32 parseInt32(QByteArray &data)
Parse a 32-bit (4-byte) integer and advance the cursor.
bool parseEvent(QByteArray &data, quint8 track, quint32 delta, double cumulativeDelta)
Parse a single event In the Midi specifications three types of events are defined, namely, ordinary Midi events, sysex events, and meta events. This function detects the event type and takes action accordingly.
bool parseTrack(QByteArray &data, int length, quint8 track)
Parse an entire track.
Midi Player.
Definition: midiplayer.h:84
bool SMPTE
Flag indicating the time format.
int mCursor
Cursor from where the events are being played.
int mVerbosity
Level of verbosity of qDebug() messages.
MidiPlayerParser(MidiPlayer *player, MidiPlayerEventList *eventlist, int verbosity=0)
quint8 mLastMidiCommand
Variable storing the last Midi command.
Midi file parser.
void reportError(QString msg) const
Report an error back to MidiPlayer.
bool parse(QByteArray &data)
Parse a Midi file and store it in the EventList.
Class managing the EventList in the MidiPlayer.
quint32 parseVariableLengthNumber(QByteArray &data)
Parse a variable-length integer.
int findNextChunk(QByteArray &data, QString tag)
Find the next chunk tag.
MidiPlayer * pMidiPlayer
Pointer back to the MidiPlayer.
MidiPlayerEventList * pEventList
Pointer to event list held by MidiPlayer.
bool parseMetaEvent(QByteArray &data, quint8 track, double cumulativeDelta)
Parse a meta event and display info in qDebug.
quint16 parseInt16(QByteArray &data)
Parse a 16bit (2-byte) integer and advance the cursor.