afterglow.carabiner

Provides synchronization with Ableton Link on the local network, using the lib-carabiner library.

active?

(active?)

Checks whether there is currently an active connection to a Carabiner daemon.

add-status-listener

(add-status-listener listener)

Registers a function to be called with the updated client state whenever we have processed a status update from Carabiner. When that happens, listener will be called with a single argument containing the same map that would be returned by calling state at that moment. This registration can be reversed by calling remove-status-listener.

carabiner-runner

The Runner singleton that can manage an embedded Carabiner instance for us.

connect

(connect)

Try to establish a connection to Carabiner. First checks if there is already an independently managed instance of Carabiner running on the configured port (see set-carabiner-port), and if so, simply uses that. Otherwise, checks whether we are on a platform where we can install and run our own temporary copy of Carabiner. If so, tries to do that and connect to it.

Returns truthy if the initial open succeeded. Sets up a background thread to reject the connection if we have not received an initial status report from the Carabiner daemon within a second of opening it.

connect-timeout

How long the connection attempt to the Carabiner daemon can take before we give up on being able to reach it.

disconnect

(disconnect)

Closes any active Carabiner connection. The run loop will notice that its run ID is no longer current, and gracefully terminate, closing its socket without processing any more responses. Also shuts down the embedded Carabiner process if we started it.

read-timeout

How long reads from the Carabiner daemon should block so we can periodically check if we have been instructed to close the connection.

remove-status-listener

(remove-status-listener listener)

Removes a function from the set that is called whenever we have processed a status update from Carabiner. If listener had been passed to add-status-listener, it will no longer be called.

set-carabiner-port

(set-carabiner-port port)

Sets the port to be uesd to connect to Carabiner. Can only be called when not connected.

state

(state)

Returns the current state of the Carabiner connection as a map whose keys include:

:port, the port on which the Carabiner daemon is listening.

:running will have a non-nil value if we are connected to Carabiner. Once we are connected to Carabiner, the current Link session tempo will be available under the key :link-bpm and the number of Link peers under :link-peers.