-
Notifications
You must be signed in to change notification settings - Fork 5
/
anira-clap-demo-pluginentry.cpp
54 lines (46 loc) · 1.69 KB
/
anira-clap-demo-pluginentry.cpp
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
#include "anira-clap-demo.h"
#include <iostream>
#include <cmath>
#include <cstring>
namespace clap_plugin_example::pluginentry
{
uint32_t clap_get_plugin_count(const clap_plugin_factory *f) { return 1; }
const clap_plugin_descriptor *clap_get_plugin_descriptor(const clap_plugin_factory *f, uint32_t w)
{
return &AniraClapPluginExample::m_desc;
}
static const clap_plugin *clap_create_plugin(const clap_plugin_factory *f, const clap_host *host,
const char *plugin_id)
{
if (strcmp(plugin_id, AniraClapPluginExample::m_desc.id))
{
std::cout << "Warning: CLAP asked for plugin_id '" << plugin_id
<< "' and clap-saw-demo ID is '" << AniraClapPluginExample::m_desc.id << "'" << std::endl;
return nullptr;
}
auto p = new AniraClapPluginExample(host);
return p->clapPlugin();
}
const CLAP_EXPORT struct clap_plugin_factory clap_saw_demo_factory = {
clap_plugin_example::pluginentry::clap_get_plugin_count,
clap_plugin_example::pluginentry::clap_get_plugin_descriptor,
clap_plugin_example::pluginentry::clap_create_plugin,
};
static const void *get_factory(const char *factory_id)
{
return (!strcmp(factory_id, CLAP_PLUGIN_FACTORY_ID)) ? &clap_saw_demo_factory : nullptr;
}
bool clap_init(const char *p) { return true; }
void clap_deinit() {}
} // namespace clap_plugin_example::pluginentry
extern "C"
{
// clang-format off
const CLAP_EXPORT struct clap_plugin_entry clap_entry = {
CLAP_VERSION,
clap_plugin_example::pluginentry::clap_init,
clap_plugin_example::pluginentry::clap_deinit,
clap_plugin_example::pluginentry::get_factory
};
// clang-format on
}