drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
rmid.h
Go to the documentation of this file.
1/*
2 Standard RIFF MIDI Component
3 Copyright (C) 2006-2023, 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#if defined(DRUMSTICK_STATIC)
34#define DRUMSTICK_FILE_EXPORT
35#else
36#if defined(drumstick_file_EXPORTS)
37#define DRUMSTICK_FILE_EXPORT Q_DECL_EXPORT
38#else
39#define DRUMSTICK_FILE_EXPORT Q_DECL_IMPORT
40#endif
41#endif
42
43namespace drumstick { namespace File {
44
56class DRUMSTICK_FILE_EXPORT Rmidi : public QObject
57{
58 Q_OBJECT
59
60public:
61 explicit Rmidi(QObject * parent = nullptr);
62 virtual ~Rmidi();
63
64 void readFromFile(QString fileName);
65 void readFromStream(QDataStream* ds);
66
67Q_SIGNALS:
92 void signalRiffInfo(const QString& infoType, const QByteArray& info);
93
103 void signalRiffData(const QString& dataType, const QByteArray& data);
104
105private:
106 void read();
107 void processINFO(int size);
108 void processList(int size);
109 void processRMID(int size);
110 void processRIFF(int size);
111 void processData(const QString& dataType, int size);
112 void skip(quint32 cktype, int size);
113 quint32 readExpectedChunk(quint32 cktype);
114 quint32 readChunk(quint32& cktype);
115 quint32 readChunkID();
116 QByteArray readByteArray(int size);
117 QString toString(quint32 ckid);
118
119private:
120 QDataStream *m_stream;
121 QString m_fileName;
122};
123
126}} // namespace drumstick::File
127
128#endif // RMIDI_H
The QObject class is the base class of all Qt objects.
RIFF MIDI file format (input only)
Definition: rmid.h:57
void signalRiffData(const QString &dataType, const QByteArray &data)
signalRiffData is emitted for each RMID data element
void signalRiffInfo(const QString &infoType, const QByteArray &info)
signalRMidInfo is emitted for each RIFF INFO element
Drumstick common.
Definition: alsaclient.cpp:68