Skip to content

Commit c5982a3

Browse files
committed
Clearer option handling in jack_client_open()
1 parent cf7d71c commit c5982a3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

‎jack.py‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,20 @@ def __init__(self, name, use_exact_name=False, no_start_server=False,
358358
359359
"""
360360
status = _ffi.new("jack_status_t*")
361-
args = [name.encode(), _lib.JackNullOption, status]
361+
options = _lib.JackNullOption
362+
optargs = []
362363
if use_exact_name:
363-
args[1] |= _lib.JackUseExactName
364+
options |= _lib.JackUseExactName
364365
if no_start_server:
365-
args[1] |= _lib.JackNoStartServer
366+
options |= _lib.JackNoStartServer
366367
if servername:
367-
args[1] |= _lib.JackServerName
368-
args.append(_ffi.new("char[]", servername.encode()))
368+
options |= _lib.JackServerName
369+
optargs.append(_ffi.new("char[]", servername.encode()))
369370
if session_id:
370-
args[1] |= _lib.JackSessionID
371-
args.append(_ffi.new("char[]", session_id.encode()))
372-
self._ptr = _lib.jack_client_open(*args)
371+
options |= _lib.JackSessionID
372+
optargs.append(_ffi.new("char[]", session_id.encode()))
373+
self._ptr = _lib.jack_client_open(name.encode(), options, status,
374+
*optargs)
373375
self._status = Status(status[0])
374376
if not self._ptr:
375377
raise JackError(str(self.status))

0 commit comments

Comments
 (0)