diff --git a/src/main.c b/src/main.c
index 6d0d9d8..308b4a9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,6 +16,64 @@ http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr
http://calf.sourceforge.net/plugins/BassEnhancer
*/
+LilvInstance *instance_two(LilvWorld *world, double sample_rate, float *input_left, float *input_right, float *output_left, float *output_right) {
+ const LilvPlugin* plugin = easy_load_plugin(world, "http://calf.sourceforge.net/plugins/BassEnhancer");
+ if (plugin == NULL) {
+ fprintf(stderr, "Plugin not found: BassEnhancer (from calf.sourceforge.net)\n");
+ return NULL;
+ }
+
+
+ LilvInstance *instance = lilv_plugin_instantiate(plugin, sample_rate, NULL);
+ if (instance == NULL) {
+ fprintf(stderr, "Failed to initialize instance two\n");
+ return NULL;
+ }
+
+ lilv_instance_connect_port(instance, 0, input_left); // Input L
+ lilv_instance_connect_port(instance, 1, input_right); // Input R
+ lilv_instance_connect_port(instance, 2, output_left); // Output L
+ lilv_instance_connect_port(instance, 3, output_right); // Output R
+
+ lilv_instance_activate(instance);
+
+ return instance;
+}
+
+LilvInstance *instance_three(LilvWorld *world, double sample_rate, float *input_left, float *input_right, float *output_left, float *output_right) {
+ 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 NULL;
+ }
+
+ float *knob_enabled = malloc(sizeof(float));
+ *knob_enabled = 1.0f;
+ float *knob_mode = malloc(sizeof(float));
+ *knob_mode = 2.0f;
+ float *knob_time = malloc(sizeof(float));
+ *knob_time = 100.0f; // ms
+
+ LilvInstance *instance = lilv_plugin_instantiate(plugin, sample_rate, NULL);
+ if (instance == NULL) {
+ fprintf(stderr, "Failed to initialize instance three\n");
+ return NULL;
+ }
+
+ lilv_instance_connect_port(instance, 4, knob_enabled);
+ lilv_instance_connect_port(instance, 16, knob_mode);
+ lilv_instance_connect_port(instance, 22, knob_time);
+
+ lilv_instance_connect_port(instance, 0, input_left); // Input L
+ lilv_instance_connect_port(instance, 1, input_right); // Input R
+ lilv_instance_connect_port(instance, 2, output_left); // Output L
+ lilv_instance_connect_port(instance, 3, output_right); // Output R
+
+ lilv_instance_activate(instance);
+
+ return instance;
+}
+
int main(int argc, char *argv[]) {
if (argc < 2) {
printf("Usage: %s [output]\n", argv[0]);
@@ -58,48 +116,18 @@ int main(int argc, char *argv[]) {
float output_left[BUFFER_SIZE];
float output_right[BUFFER_SIZE];
- const int instancesCount = 10;
+ const int instancesCount = 2;
LilvInstance **instances = malloc(instancesCount * sizeof(LilvInstance*));
if (instances == NULL) {
fprintf(stderr, "mallocing instances failed: %s\n", strerror(errno));
return 1;
}
- 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;
- }
+ //
- float *knob_enabled = malloc(instancesCount * sizeof(float));
- for (int i=0; i