aboutsummaryrefslogtreecommitdiff
path: root/visualization/renderer/qmpvisrendercore.hpp
blob: ba978f4ddc1f211ebb230a01963f4228ba07df46 (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
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef QMPVISRENDERCORE_HPP
#define QMPVISRENDERCORE_HPP

#include <cstddef>

#include <QObject>
#include <QVariant>
#include <QMap>
#include "qmpcorepublic.hpp"

class qmpPluginAPIStub;
class CMidiPlayer;
class qmpSettingsRO;
class QCommandLineParser;

class QProcess;

class qmpVisRenderCore: public QObject
{
    Q_OBJECT
public:
    qmpVisRenderCore(QCommandLineParser *_clp);
    bool loadVisualizationLibrary();
    void unloadVisualizationLibrary();
    void loadSettings();
    void setMIDIFile(const char *url);
    void startRender();

    qmpSettingsRO *settings()
    {
        return msettings;
    }

signals:
    void frameRendered(void *px, size_t sz, uint32_t current_tick, uint32_t total_ticks);

private:
    qmpPluginIntf *vp;
    qmpFuncBaseIntf *vf;
    callback_t startcb;
    callback_t resetcb;
    void *mp;
    qmpPluginAPIStub *api;
    CMidiPlayer *player;
    qmpSettingsRO *msettings;
    QProcess *rxproc;
    QMap<QChar, QVariant> subst;
    QCommandLineParser *clp;
    QStringList process_arguments(QString a, QMap<QChar, QVariant> subst);
    int frameno;
    bool oneshot;
    QMetaObject::Connection frameconn;
    typedef qmpPluginIntf *(*GetInterface_func)(qmpPluginAPI *);
    typedef void(*SwitchMode_func)(void(*frameCallback)(void *, size_t, uint32_t, uint32_t), bool hidewindow);

    friend class qmpPluginAPIStub;
    static void framefunc(void *px, size_t sz, uint32_t curf, uint32_t totf);
    static qmpVisRenderCore *inst;
};

#endif // QMPVISRENDERCORE_HPP