Skip to content

Add ability to give a name to jack client #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion src/mod-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/mod-host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/effectlib_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down