drumstick  2.7.0
rmid.h
Go to the documentation of this file.
1 /*
2  Standard RIFF MIDI Component
3  Copyright (C) 2006-2022, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 3 of the License, or
8  (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef RMIDI_H
20 #define RMIDI_H
21 
22 #include <QObject>
23 #include <QByteArray>
24 #include <QString>
25 #include <QDataStream>
26 #include "macros.h"
27 
33 namespace drumstick { namespace File {
34 
46 class DRUMSTICK_EXPORT Rmidi : public QObject
47 {
48  Q_OBJECT
49 
50 public:
51  explicit Rmidi(QObject * parent = nullptr);
52  virtual ~Rmidi();
53 
54  void readFromFile(QString fileName);
55  void readFromStream(QDataStream* ds);
56 
57 signals:
82  void signalRiffInfo(const QString& infoType, const QByteArray& info);
83 
93  void signalRiffData(const QString& dataType, const QByteArray& data);
94 
95 private:
96  void read();
97  void processINFO(int size);
98  void processList(int size);
99  void processRMID(int size);
100  void processData(const QString& dataType, int size);
101  void skip(quint32 cktype, int size);
102  quint32 readExpectedChunk(quint32 cktype);
103  quint32 readChunk(quint32& cktype);
104  quint32 readChunkID();
105  QByteArray readByteArray(int size);
106  QString toString(quint32 ckid);
107 
108 private:
109  QDataStream *m_stream;
110  QString m_fileName;
111 };
112 
115 }} // namespace drumstick::File
116 
117 #endif // RMIDI_H
The QObject class is the base class of all Qt objects.
Drumstick visibility macros.
RIFF MIDI file format (input only)
Definition: rmid.h:46
Drumstick common.
Definition: alsaclient.cpp:68