Browse Source

Client construct: added option to specify name of server to connect with

Fabian Peter Hammerle 9 years ago
parent
commit
67844bbb98
2 changed files with 11 additions and 4 deletions
  1. 1 1
      README.md
  2. 10 3
      jack.c

+ 1 - 1
README.md

@@ -11,4 +11,4 @@ JACK development files:
 Installation
 ------------
 
-    pip install --user jacker jacker
+    pip install --user jacker

+ 10 - 3
jack.c

@@ -186,13 +186,20 @@ static PyObject* client___new__(PyTypeObject* type, PyObject* args, PyObject* kw
     Client* self = (Client*)type->tp_alloc(type, 0);
 
     if(self) {
-        const char* name;
-        if(!PyArg_ParseTuple(args, "s", &name)) {
+        char* client_name;
+        char* server_name = NULL;
+        static char* kwlist[] = {"client_name", "server_name", NULL};
+        if(!PyArg_ParseTupleAndKeywords(args, kwargs, "s|s", kwlist, &client_name, &server_name)) {
             return NULL;
         }
 
+        jack_options_t open_options = JackNullOption;
+        if(server_name) {
+            open_options |= JackServerName;
+        }
+
         jack_status_t status;
-        self->client = jack_client_open(name, JackNullOption, &status);
+        self->client = jack_client_open(client_name, open_options, &status, server_name);
         if(!self->client) {
             if(status & JackFailure) {
                 PyErr_SetString(failure, "Overall operation failed.");