aboutsummaryrefslogtreecommitdiff
path: root/midifmt-plugin/midifmtplugin.hpp
blob: 047eda2ccb016715a97fd025bac35486939af8d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef MIDIFMTPLUGIN_HPP
#define MIDIFMTPLUGIN_HPP

#include <cstdio>
#include "qmpcorepublic.hpp"

class CMidiStreamReader: public qmpFileReader
{
private:
    CMidiFile *ret;
    FILE *f;
    int eventdiscarded, fmt;
    uint32_t readDWLE();
    bool RIFFHeaderReader();
    bool midsBodyReader();
public:
    CMidiStreamReader();
    ~CMidiStreamReader();
    CMidiFile *readFile(const char *fn);
    void discardCurrentEvent();
    void commitEventChange(SEvent d);
};

class qmpMidiFmtPlugin: public qmpPluginIntf
{
private:
    CMidiStreamReader *mdsreader;
public:
    static qmpPluginAPI *api;
    qmpMidiFmtPlugin(qmpPluginAPI *_api);
    ~qmpMidiFmtPlugin();
    void init();
    void deinit();
    const char *pluginGetName();
    const char *pluginGetVersion();
};

extern "C" {
    EXPORTSYM qmpPluginIntf *qmpPluginGetInterface(qmpPluginAPI *api)
    {
        return new qmpMidiFmtPlugin(api);
    }
    EXPORTSYM const char *qmpPluginGetAPIRev()
    {
        return QMP_PLUGIN_API_REV;
    }
}

#endif // MIDIFMTPLUGIN_HPP