Skip to content

Instantly share code, notes, and snippets.

@badescunicu
Created July 13, 2014 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badescunicu/44bff3b9e24fd905806c to your computer and use it in GitHub Desktop.
Save badescunicu/44bff3b9e24fd905806c to your computer and use it in GitHub Desktop.
#include <lilv-0/lilv/lilv.h>
#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
#include "lv2/lv2plug.in/ns/ext/port-groups/port-groups.h"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include <iostream>
using namespace std;
int main() {
LilvNode* gControlPortClass;
LilvWorld* gWorld = lilv_world_new();
gControlPortClass = lilv_new_uri(gWorld, LV2_CORE__ControlPort);
lilv_world_load_all(gWorld);
const LilvPlugins *plugs = lilv_world_get_all_plugins(gWorld);
LILV_FOREACH(plugins, i, plugs)
{
const LilvPlugin *plug = lilv_plugins_get(plugs, i);
LilvNode* name = lilv_plugin_get_name(plug);
cout << lilv_node_as_string(name) << endl;
int numPorts = lilv_plugin_get_num_ports(plug);
for (int i = 0; i < numPorts; i++)
{
const LilvPort *port = lilv_plugin_get_port_by_index(plug, i);
if (lilv_port_is_a(plug, port, gControlPortClass)) {
// Get the port name
LilvNode *tmpName = lilv_port_get_name(plug, port);
cout << "Port name: " << lilv_node_as_string(tmpName) << endl;
lilv_node_free(tmpName);
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment