-
Notifications
You must be signed in to change notification settings - Fork 10
/
abstract-gui-listener.hh
40 lines (29 loc) · 1.29 KB
/
abstract-gui-listener.hh
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
#pragma once
#include <string>
#include <variant>
#include <vector>
#include <functional>
#include <clap/clap.h>
namespace clap {
using InvocationArgumentType = std::variant<bool, int64_t, double, std::string>;
using InvocationArgumentsType = std::vector<InvocationArgumentType>;
// Listener for events produced by the Gui, to the destination of the plugin.
//
// Beaware that the callbacks happen on the plugin's GUI thread, not the host's main thread.
class AbstractGuiListener {
public:
virtual ~AbstractGuiListener();
virtual void onGuiRunOnMainThread(std::function<void()> callback) = 0;
// timer based polling of new parameter changes, transport value, ...
// the plugin shall transmit them via
virtual void onGuiPoll() = 0;
virtual void onGuiParamBeginAdjust(clap_id paramId) = 0;
virtual void onGuiParamAdjust(clap_id paramId, double value) = 0;
virtual void onGuiParamEndAdjust(clap_id paramId) = 0;
virtual void onGuiSetTransportIsSubscribed(bool isSubscribed) = 0;
virtual void onGuiWindowClosed(bool wasDestroyed) = 0;
virtual void onGuiUndo() = 0;
virtual void onGuiRedo() = 0;
virtual void onGuiInvoke(const std::string &method, const InvocationArgumentsType &args) = 0;
};
} // namespace clap