Replace pyjack by custom jacklib.py (using ctypes)
[klaudia.git] / src / jacklib.py
blob997c7966c88dc96dfed5f4af5aafac01b1b3ff0e
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
5 # Imports
6 from ctypes import cdll, c_char_p
9 # Load Jack shared library
10 jacklib = cdll.LoadLibrary("libjack.so.0")
13 # Functions
14 def get_version_string():
15 jacklib.jack_get_version_string.restype = c_char_p
16 return str(jacklib.jack_get_version_string())
19 def client_open(client_name, options, status):
20 return jacklib.jack_client_open(client_name, options, status)
22 def client_close(client):
23 return int(jacklib.jack_client_close(client))
25 def client_name_size():
26 return int(jacklib.jack_client_name_size())
28 def client_name(client):
29 jacklib.jack_get_client_name.restype = c_char_p
30 return str(jacklib.jack_get_client_name(client))
33 def activate(client):
34 return int(jacklib.jack_activate(client))
36 def deactivate(client):
37 return int(jacklib.jack_deactivate(client))
39 def get_client_pid(client):
40 return int(jacklib.jack_get_client_pid(client))
43 def is_realtime():
44 return bool(jacklib.jack_is_realtime())
46 def set_freewheel(client, onoff):
47 return int(jacklib.jack_set_freewheel(onoff))
49 def set_buffer_size(client, nframes):
50 return int(jacklib.jack_set_buffer_size(nframes))
53 def get_sample_rate(client):
54 return int(jacklib.jack_get_sample_rate(client))
56 def get_buffer_size(client):
57 return int(jacklib.jack_get_buffer_size(client))
59 def get_cpu_load(client):
60 return float(jacklib.jack_get_cpu_load(client))
63 def port_name(port):
64 jacklib.jack_port_name.restype = c_char_p
65 return str(jacklib.jack_port_name(port))
67 def port_short_name(port):
68 jacklib.jack_port_short_name.restype = c_char_p
69 return str(jacklib.jack_port_short_name(port))
71 def port_flags(port):
72 return int(jacklib.jack_port_flags(port))
74 def port_type(port):
75 jacklib.jack_port_type.restype = c_char_p
76 return str(jacklib.jack_port_type(port))
78 def port_type_id(port):
79 return jacklib.jack_port_type_id(port)
81 def port_is_mine(client, port):
82 return int(jacklib.jack_port_is_mine(client, port))
84 def port_connected(port):
85 return int(jacklib.jack_port_connected(port))
87 def port_connected_to(port, port_name):
88 return int(jacklib.jack_port_connected_to(port, port_name))
90 def port_get_connections(port):
91 return jacklib.jack_port_get_connections(client, port)
93 def port_get_all_connections(client, port):
94 return jacklib.jack_port_get_all_connections(client, port)