Last active
April 11, 2024 14:04
-
-
Save SpotlightKid/420b975c296b08bfc5ecdcbe82cedba7 to your computer and use it in GitHub Desktop.
Check whether JACK transport is rolling and toggle state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# See https://github.com/SpotlightKid/jack-matchmaker/blob/master/jackmatchmaker/jacklib.py | |
import jacklib | |
result = jacklib.jack_status_t() | |
client = jacklib.client_open("transport-query", jacklib.JackNoStartServer, result) | |
if result: | |
sys.exit("Error connecting to JACK server.") | |
transport_state = jacklib.transport_query(client, None) | |
if transport_state == jacklib.JackTransportStopped: | |
print("JACK transport stopped, starting it now.") | |
jacklib.transport_start(client) | |
elif transport_state == jacklib.JackTransportRolling: | |
print("JACK transport rolling, stopping it now.") | |
jacklib.transport_stop(client) | |
elif transport_state == jacklib.JackTransportStarting: | |
print("JACK transport starting, nothing to do.") | |
else: | |
print("Unknown JACK transport state.") | |
jacklib.client_close(client) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/jackaudio/pyjacklib/blob/master/examples/jack-transport-query.py
Now maintained there in the future.