first commit
This commit is contained in:
commit
a3b75b1773
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# About
|
||||
|
||||
This project aims to provide basic lua bindings to [liblilv](https://github.com/lv2/lilv).
|
||||
|
||||
## done
|
||||
|
||||
- lv2ls
|
||||
|
||||
## todo
|
||||
|
||||
- lv2ls --name
|
||||
- lv2info
|
||||
- everything else
|
||||
40
lilv.lua
Normal file
40
lilv.lua
Normal file
@ -0,0 +1,40 @@
|
||||
local ffi = require "ffi"
|
||||
local lv2 = ffi.load("liblilv-0.so.0")
|
||||
|
||||
|
||||
ffi.cdef [[
|
||||
typedef struct LilvPluginImpl LilvPlugin; /**< LV2 Plugin. */
|
||||
typedef struct LilvPluginClassImpl LilvPluginClass; /**< Plugin Class. */
|
||||
typedef struct LilvPortImpl LilvPort; /**< Port. */
|
||||
typedef struct LilvScalePointImpl LilvScalePoint; /**< Scale Point. */
|
||||
typedef struct LilvUIImpl LilvUI; /**< Plugin UI. */
|
||||
typedef struct LilvNodeImpl LilvNode; /**< Typed Value. */
|
||||
typedef struct LilvWorldImpl LilvWorld; /**< Lilv World. */
|
||||
typedef struct LilvInstanceImpl LilvInstance; /**< Plugin instance. */
|
||||
typedef struct LilvStateImpl LilvState; /**< Plugin state. */
|
||||
|
||||
typedef void LilvIter; /**< Collection iterator */
|
||||
typedef void LilvPluginClasses; /**< A set of #LilvPluginClass. */
|
||||
typedef void LilvPlugins; /**< A set of #LilvPlugin. */
|
||||
typedef void LilvScalePoints; /**< A set of #LilvScalePoint. */
|
||||
typedef void LilvUIs; /**< A set of #LilvUI. */
|
||||
typedef void LilvNodes; /**< A set of #LilvNode. */
|
||||
|
||||
LilvWorld* lilv_world_new();
|
||||
void lilv_world_load_all(LilvWorld*);
|
||||
LilvPlugins* lilv_world_get_all_plugins(LilvWorld*);
|
||||
|
||||
unsigned lilv_plugins_size(const LilvPlugins*);
|
||||
LilvIter* lilv_plugins_begin(const LilvPlugins*);
|
||||
const LilvPlugin* lilv_plugins_get(const LilvPlugins*, LilvIter*);
|
||||
LilvIter* lilv_plugins_next(const LilvPlugins*, LilvIter*);
|
||||
bool lilv_plugins_is_end(const LilvPlugins*, LilvIter*);
|
||||
|
||||
const LilvNode* lilv_plugin_get_uri(const LilvPlugin*);
|
||||
const LilvNode* lilv_plugin_get_bundle_uri(const LilvPlugin*);
|
||||
const LilvNode* lilv_plugin_get_library_uri(const LilvPlugin*);
|
||||
|
||||
const char* lilv_node_as_uri(const LilvNode*);
|
||||
]]
|
||||
|
||||
return lv2
|
||||
7
lv2info.lua
Normal file
7
lv2info.lua
Normal file
@ -0,0 +1,7 @@
|
||||
local ffi = require "ffi"
|
||||
local lv2 = require('lilv')
|
||||
|
||||
|
||||
local world = lv2.lilv_world_new()
|
||||
lv2.lilv_world_load_all(world)
|
||||
local plugins = lv2.lilv_world_get_all_plugins(world)
|
||||
30
lv2ls.lua
Normal file
30
lv2ls.lua
Normal file
@ -0,0 +1,30 @@
|
||||
local ffi = require "ffi"
|
||||
local lv2 = require('lilv')
|
||||
|
||||
|
||||
local world = lv2.lilv_world_new()
|
||||
lv2.lilv_world_load_all(world)
|
||||
local plugins = lv2.lilv_world_get_all_plugins(world)
|
||||
|
||||
|
||||
local function list_plugins(plugin_list, show_names)
|
||||
local iter = lv2.lilv_plugins_begin(plugin_list)
|
||||
|
||||
while not lv2.lilv_plugins_is_end(plugin_list, iter) do
|
||||
local plugin = lv2.lilv_plugins_get(plugin_list, iter)
|
||||
|
||||
if show_names then
|
||||
print('thing')
|
||||
else
|
||||
local plugin_get_uri = lv2.lilv_plugin_get_uri(plugin)
|
||||
local node_as_uri = lv2.lilv_node_as_uri(plugin_get_uri)
|
||||
local uri = ffi.string(node_as_uri)
|
||||
|
||||
print(uri)
|
||||
end
|
||||
|
||||
iter = lv2.lilv_plugins_next(plugin_list, iter)
|
||||
end
|
||||
end
|
||||
|
||||
list_plugins(plugins, false)
|
||||
Loading…
Reference in New Issue
Block a user