lv2 / lilv

LV2 host library
ISC License
37 stars 20 forks source link

simple lv2 code #48

Closed ghost closed 2 years ago

ghost commented 2 years ago

Alot of people find it difficult because it is using macro. It is simple as pie.

include "lilv/lilvmm.hpp"

include

using namespace std;

int main() { Lilv::World world;
LilvIter * iter; world.load_all(); Lilv::Plugins plugins = world.get_all_plugins(); cout << "Num Plugins = " << plugins.size() << endl; iter = plugins.begin(); Lilv::Plugin plugin = plugins.get(iter); Lilv::Node name = plugin.get_name(); cout << "Plugin: " << name.as_string() << endl; }

Here is a tiny swig you can use it in Python, Lua, C#, etc

%module lilv %{

include "lilv.h"

include "lilvmm.hpp"

%} %ignore lilv_plugin_get_num_ports_of_class_va; %include "lilv.h" %include "lilvpp.hpp"

Note you have to preprocess lilvmm.hpp with gcc first like this: gcc -E lilvmm.hpp > lilpp.hpp so swig knows what the macros are