diff --git a/src/effects.c b/src/effects.c index ff483be..1287833 100644 --- a/src/effects.c +++ b/src/effects.c @@ -4407,7 +4407,7 @@ int effects_finish(int close_client) return SUCCESS; } -int effects_add(const char *uri, int instance) +int effects_add(const char *uri, int instance, const char *jack_client_name) { unsigned int ports_count; char effect_name[32], port_name[MAX_CHAR_BUF_SIZE+1]; @@ -4454,7 +4454,14 @@ int effects_add(const char *uri, int instance) lilv_instance = 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 bcfb8dc..c2337d2 100644 --- a/src/effects.h +++ b/src/effects.h @@ -134,7 +134,7 @@ typedef struct { int effects_init(void* client); int effects_finish(int close_client); -int effects_add(const char *uri, int instance); +int effects_add(const char *uri, 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 fb8cc16..15ff268 100644 --- a/src/mod-host.c +++ b/src/mod-host.c @@ -130,7 +130,13 @@ 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); + protocol_response_int(resp, proto); } diff --git a/src/mod-host.h b/src/mod-host.h index 8f25139..08c1dae 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)