WIP
This commit is contained in:
commit
cc6a979294
5 changed files with 104 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
build/
|
||||||
|
.vscode/
|
49
Makefile
Normal file
49
Makefile
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# Compiler to use
|
||||||
|
CC ?= gcc
|
||||||
|
|
||||||
|
CFLAGS = -Wall -Wextra -std=gnu17 -I include $(shell pkg-config --cflags lilv-0)
|
||||||
|
LDFLAGS = -llilv-0
|
||||||
|
|
||||||
|
# Directory for build outputs
|
||||||
|
BUILD_DIR := build
|
||||||
|
|
||||||
|
# Name of the output program
|
||||||
|
PROGRAM_NAME ?= easyexport
|
||||||
|
|
||||||
|
# Find all .c files in the source directory
|
||||||
|
SRCS := $(wildcard src/*.c)
|
||||||
|
|
||||||
|
# Generate corresponding .o file names in the build/obj directory
|
||||||
|
OBJS := $(patsubst src/%.c,$(BUILD_DIR)/obj/%.o,$(SRCS))
|
||||||
|
|
||||||
|
# Name of the final executable
|
||||||
|
TARGET := $(BUILD_DIR)/$(PROGRAM_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
# Default target: build the executable
|
||||||
|
all: CFLAGS += -O3
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
# Debug target
|
||||||
|
debug: CFLAGS += -O0 -g
|
||||||
|
debug: $(TARGET)
|
||||||
|
|
||||||
|
# Declare 'all' and 'clean' as phony targets (not files)
|
||||||
|
.PHONY: all debug clean
|
||||||
|
|
||||||
|
# Rule to link object files into the final executable
|
||||||
|
$(TARGET): $(OBJS) | $(BUILD_DIR)
|
||||||
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
||||||
|
du -b $(TARGET) # Size of the executable in bytes
|
||||||
|
|
||||||
|
# Rule to compile source files into object files
|
||||||
|
$(BUILD_DIR)/obj/%.o: src/%.c | $(BUILD_DIR)/obj
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
# Create build directories if they don't exist
|
||||||
|
$(BUILD_DIR) $(BUILD_DIR)/obj:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
# Clean target: remove the build directory
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILD_DIR)
|
7
include/easy.h
Normal file
7
include/easy.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef EASY_H
|
||||||
|
#define EASY_H
|
||||||
|
|
||||||
|
#include <lilv/lilv.h>
|
||||||
|
const LilvPlugin* easy_load_plugin(LilvWorld* world, const char* uri);
|
||||||
|
|
||||||
|
#endif
|
17
src/easy.c
Normal file
17
src/easy.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <easy.h>
|
||||||
|
|
||||||
|
const LilvPlugin* easy_load_plugin(LilvWorld* world, const char* uri) {
|
||||||
|
const LilvPlugins* plugin_list = lilv_world_get_all_plugins(world);
|
||||||
|
|
||||||
|
LilvNode* plugin_uri = lilv_new_uri(world, uri);
|
||||||
|
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugin_list, plugin_uri);
|
||||||
|
lilv_node_free(plugin_uri);
|
||||||
|
|
||||||
|
if (plugin != NULL) {
|
||||||
|
LilvNode *plugin_name = lilv_plugin_get_name(plugin);
|
||||||
|
printf("Loaded plugin \"%s\"\n", lilv_node_as_string(plugin_name));
|
||||||
|
lilv_node_free(plugin_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugin;
|
||||||
|
}
|
29
src/main.c
Normal file
29
src/main.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#include <lilv/lilv.h>
|
||||||
|
#include <easy.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo
|
||||||
|
http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr
|
||||||
|
http://calf.sourceforge.net/plugins/BassEnhancer
|
||||||
|
*/
|
||||||
|
|
||||||
|
const LilvPlugin* easy_load_plugin(LilvWorld* world, const char* uri);
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
LilvWorld* world = lilv_world_new();
|
||||||
|
lilv_world_load_all(world);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
const LilvPlugin* plugin = easy_load_plugin(world, "http://lsp-plug.in/plugins/lv2/comp_delay_x2_stereo");
|
||||||
|
if (plugin == NULL) {
|
||||||
|
fprintf(stderr, "Plugin not found: comp_delay_x2_stereo (from lsp-plug.in)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue