diff --git a/src/effects.c b/src/effects.c index 9cea214..748fcda 100644 --- a/src/effects.c +++ b/src/effects.c @@ -2448,7 +2448,7 @@ int effects_finish(int close_client) return SUCCESS; } -int effects_add(const char *uid, int instance) +int effects_add(const char *uid, int instance, const char *jack_client_name) { unsigned int i, ports_count; char effect_name[32], port_name[MAX_CHAR_BUF_SIZE+1]; @@ -2526,7 +2526,14 @@ int effects_add(const char *uid, int instance) lilv_license_interface = NULL; /* Create a client to Jack */ - snprintf(effect_name, 31, "effect_%i", instance); + if (jack_client_name) + { + strncpy(effect_name, jack_client_name, 31); + } + else + { + snprintf(effect_name, 31, "effect_%i", instance); + } jack_client = jack_client_open(effect_name, JackNoStartServer, &jack_status); if (!jack_client) diff --git a/src/effects.h b/src/effects.h index c2f8509..a0cb994 100644 --- a/src/effects.h +++ b/src/effects.h @@ -121,7 +121,7 @@ typedef struct { int effects_init(void* client); int effects_finish(int close_client); -int effects_add(const char *uid, int instance); +int effects_add(const char *uid, int instance, const char *jack_client_name); int effects_remove(int effect_id); int effects_preset_load(int effect_id, const char *uri); int effects_preset_save(int effect_id, const char *dir, const char *file_name, const char *label); diff --git a/src/mod-host.c b/src/mod-host.c index 9c81395..d9d64d8 100644 --- a/src/mod-host.c +++ b/src/mod-host.c @@ -127,7 +127,12 @@ static pthread_t intclient_socket_thread; static void effects_add_cb(proto_t *proto) { int resp; - resp = effects_add(proto->list[1], atoi(proto->list[2])); + char *jack_client_name = NULL; + if (proto->list_count == 4) + { + jack_client_name = proto->list[3]; + } + resp = effects_add(proto->list[1], atoi(proto->list[2]), jack_client_name); char buffer[128]; sprintf(buffer, "resp %i", resp); diff --git a/src/mod-host.h b/src/mod-host.h index 52b35a5..8336953 100644 --- a/src/mod-host.h +++ b/src/mod-host.h @@ -51,7 +51,7 @@ #define SOCKET_MSG_BUFFER_SIZE 1024 /* Protocol commands definition */ -#define EFFECT_ADD "add %s %i" +#define EFFECT_ADD "add %s %i ..." #define EFFECT_REMOVE "remove %i" #define EFFECT_PRESET_LOAD "preset_load %i %s" #define EFFECT_PRESET_SAVE "preset_save %i %s %s %s" diff --git a/tests/effectlib_test.c b/tests/effectlib_test.c index ce136f1..a7a9b3a 100644 --- a/tests/effectlib_test.c +++ b/tests/effectlib_test.c @@ -14,7 +14,7 @@ int main (void) if (effects_init(NULL) == 0) { action = "add: http://lv2plug.in/plugins/eg-amp"; - ret = effects_add("http://lv2plug.in/plugins/eg-amp", 0); + ret = effects_add("http://lv2plug.in/plugins/eg-amp", 0, NULL); printf("%s, ret: %i\n", action, ret); if (ret != 0)