Liking cljdoc? Tell your friends :D

beat-carabiner.core

The main entry point for the beat-carabiner library. Simple scenarios can just call connect followed by set-sync-mode, but you will likely want to explore the rest of the API.

The main entry point for the beat-carabiner library. Simple scenarios
can just call [[connect]] followed by [[set-sync-mode]], but you
will likely want to explore the rest of the API.

active?

(active?)

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

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

add-bad-version-listener

(add-bad-version-listener listener)

Registers a function to be called if we detect a problematic version of Carabiner is running; in that circumstance listener will be called with a single string argument, containing a description of the problem to be presented to the user in some client-specific manner.

The registration can be reversed by calling remove-bad-version-listener.

Registers a function to be called if we detect a problematic version
of Carabiner is running; in that circumstance `listener` will be
called with a single string argument, containing a description of
the problem to be presented to the user in some client-specific
manner.

The registration can be reversed by
calling [[remove-bad-version-listener]].
raw docstring

add-disconnection-listener

(add-disconnection-listener listener)

Registers a function to be called when we close our Carabiner connection, so clients can take whatever action they need. Whenever the connection closes, listener is called with an argument that will be true if the disconnection was unexpected.

The registration can be reversed by calling remove-disconnection-listener.

Registers a function to be called when we close our Carabiner
connection, so clients can take whatever action they need. Whenever
the connection closes, `listener` is called with an argument that
will be `true` if the disconnection was unexpected.

The registration can be reversed by
calling [[remove-disconnection-listener]].
raw docstring

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.

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]].
raw docstring

beat-at-time

(beat-at-time time)
(beat-at-time time beat-number)

Find out what beat falls at the specified time in the Link timeline, assuming 4 beats per bar since we are dealing with Pro DJ Link, and taking into account the configured latency (see set-latency).

When the response comes, if we are configured to be the tempo master, nudge the Link timeline so that it had a beat at the same time. If a beat-number (ranging from 1 to 4) is supplied, move the timeline by more than a beat if necessary in order to get the Link session's bars aligned as well.

Find out what beat falls at the specified time in the Link timeline,
assuming 4 beats per bar since we are dealing with Pro DJ Link, and
taking into account the configured latency (see [[set-latency]]).

When the response comes, if we are configured to be the tempo
master, nudge the Link timeline so that it had a beat at the same
time. If a `beat-number` (ranging from 1 to 4) is supplied, move the
timeline by more than a beat if necessary in order to get the Link
session's bars aligned as well.
raw docstring

beat-finder

Holds the singleton instance of the Beat Link BeatFinder for convenience.

Holds the singleton instance of the Beat
Link [`BeatFinder`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/BeatFinder.html)
for convenience.
raw docstring

bpm-tolerance

The amount by which the Link tempo can differ from our target tempo without triggering an adjustment.

The amount by which the Link tempo can differ from our target tempo
without triggering an adjustment.
raw docstring

carabiner-runner

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

The [`Runner`](https://deepsymmetry.org/lib-carabiner/apidocs/org/deepsymmetry/libcarabiner/Runner.html)
singleton that can manage an embedded Carabiner instance for us.
raw docstring

connect

(connect)
(connect failure-fn)

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.

If failure-fn is supplied, it will be called with an explanatory message (string) if the connection could not be established, so the user can be informed in an appropriate way.

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.

If `failure-fn` is supplied, it will be called with an explanatory
message (string) if the connection could not be established, so the
user can be informed in an appropriate way.
raw docstring

connect-timeout

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

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

device-finder

Holds the singleton instance of the Beat Link DeviceFinder for convenience.

Holds the singleton instance of the Beat
Link [`DeviceFinder`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/DeviceFinder.html)
for convenience.
raw docstring

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.

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.
raw docstring

(link-master master?)

Controls whether the Link session is tempo master for the DJ link devices. Has no effect if we are not in a compatible sync mode (see set-sync-mode).

Controls whether the Link session is tempo master for the DJ link
devices. Has no effect if we are not in a compatible sync
mode (see [[set-sync-mode]]).
raw docstring

lock-tempo

(lock-tempo bpm)

Starts holding the tempo of the Link session to the specified number of beats per minute. Throws IllegalStateException if the current sync mode is :off.

Starts holding the tempo of the Link session to the specified number
of beats per minute. Throws `IllegalStateException` if the current
sync mode is `:off`.
raw docstring

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.

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

remove-bad-version-listener

(remove-bad-version-listener listener)

Removes a function from the set that is called when we detect a bad Carabiner version. If listener had been previously passed to add-bad-version-listener it will no longer be called.

Removes a function from the set that is called when we detect a bad
Carabiner version. If `listener` had been previously passed
to [[add-bad-version-listener]] it will no longer be called.
raw docstring

remove-disconnection-listener

(remove-disconnection-listener listener)

Removes a function from the set that is called when close our Carabiner connection. If listener had been passed to add-disconnection-listener it will no longer called.

Removes a function from the set that is called when close our
Carabiner connection. If `listener` had been passed
to [[add-disconnection-listener]] it will no longer called.
raw docstring

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.

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.
raw docstring

set-carabiner-port

(set-carabiner-port port)

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

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

set-latency

(set-latency latency)

Sets the estimated latency in milliseconds between an actual beat played on a CDJ and when we receive the packet.

Sets the estimated latency in milliseconds between an actual beat
played on a CDJ and when we receive the packet.
raw docstring

(set-link-tempo tempo)

Sets the Link session tempo to the specified number of beats per minute, unless it is already close enough (within 0.005 beats per minute).

Sets the Link session tempo to the specified number of beats per
minute, unless it is already close enough (within 0.005 beats per
minute).
raw docstring

set-sync-bars

(set-sync-bars bars?)

Sets whether we should synchronize the Ableton Link and Pioneer timelines at the level of entire measures, rather than simply individual beats.

Sets whether we should synchronize the Ableton Link and Pioneer
timelines at the level of entire measures, rather than simply
individual beats.
raw docstring

set-sync-mode

(set-sync-mode new-mode)

Validates that the desired mode is compatible with the current state, and if so, updates our state to put us in that mode and performs any necessary synchronization operations. Choices are:

  • :off No synchronization is attempted.

  • :manual External code will be calling lock-tempo and unlock-tmepo to manipulate the Ableton Link session.

  • :passive Ableton Link always follows the Pro DJ Link network, and we do not attempt to control other players on that network.

  • :full Bidirectional, determined by the Master and Sync states of players on the DJ Link network, including Beat Link's VirtualCdj which stands in for the Ableton Link session.

Validates that the desired mode is compatible with the current state,
and if so, updates our state to put us in that mode and performs any
necessary synchronization operations. Choices are:

* `:off` No synchronization is attempted.

* `:manual` External code will be calling `lock-tempo`
  and `unlock-tmepo` to manipulate the Ableton Link session.

* `:passive` Ableton Link always follows the Pro DJ Link
  network, and we do not attempt to control other players on that
  network.

* `:full` Bidirectional, determined by the Master and Sync states
  of players on the DJ Link network, including Beat
  Link's [`VirtualCdj`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/VirtualCdj.html)
  which stands in for the Ableton Link session.
raw docstring

skew-tolerance

The amount by which the start of a beat can be off without triggering an adjustment. This can't be larger than the normal beat packet jitter without causing spurious readjustments.

The amount by which the start of a beat can be off without
triggering an adjustment. This can't be larger than the normal beat
packet jitter without causing spurious readjustments.
raw docstring

start-transport

(start-transport)
(start-transport time)

Tells Carabiner to start the Link session playing, for any participants using Start/Stop Sync. If time is supplied, it specifies when, on the Link microsecond timeline, playback should begin; the default is right now.

Tells Carabiner to start the Link session playing, for any
participants using Start/Stop Sync. If `time` is supplied, it
specifies when, on the Link microsecond timeline, playback should
begin; the default is right now.
raw docstring

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.

:latency, the estimated latency in milliseconds between an actual beat played by a CDJ and when we receive the packet.

:sync-mode, which can be:

  • :off

  • :manual (meaning that external code will be calling lock-tempo and unlock-tempo to manipulate the Ableton Link session)

  • :passive (meaning Link always follows the Pro DJ Link network, and we do not attempt to control other players on that network), or

  • :full (bidirectional, determined by the Master and Sync states of players on the DJ Link network, including Beat Link's VirtualCdj).

:bar determines whether the Link and Pioneer timelines should be synchronized at the level of entire measures (if present and true), or individual beats (if not).

: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.

If we have been told to lock the Link tempo, there will be a :target-bpm key holding that tempo.

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

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

`:latency`, the estimated latency in milliseconds between an
actual beat played by a CDJ and when we receive the packet.

`:sync-mode`, which can be:

* `:off`

* `:manual` (meaning that external code will be
  calling [[lock-tempo]] and [[unlock-tempo]] to manipulate the
  Ableton Link session)

* `:passive` (meaning Link always follows the Pro DJ Link network,
  and we do not attempt to control other players on that network), or

* `:full` (bidirectional, determined by the Master and Sync states
  of players on the DJ Link network, including Beat Link's
  [`VirtualCdj`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/VirtualCdj.html)).

`:bar` determines whether the Link and Pioneer timelines should be
synchronized at the level of entire measures (if present and
`true`), or individual beats (if not).

`: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`.

If we have been told to lock the Link tempo, there will be a
`:target-bpm` key holding that tempo.
raw docstring

stop-transport

(stop-transport)
(stop-transport time)

Tells Carabiner to stop the Link session playing, for any participants using Start/Stop Sync. If time is supplied, it specifies when, on the Link microsecond timeline, playback should end; the default is right now.

Tells Carabiner to stop the Link session playing, for any
participants using Start/Stop Sync. If `time` is supplied, it
specifies when, on the Link microsecond timeline, playback should
end; the default is right now.
raw docstring

sync-enabled?

(sync-enabled?)

Checks whether we have an active connection and are in any sync mode other than :off.

Checks whether we have an active connection and are in any sync mode
other than `:off`.
raw docstring

(sync-link sync?)

Controls whether the Link session is tied to the tempo of the DJ Link devices. Also reflects that in the sync state of the VirtualCdj so it can be seen on the DJ Link network. Finally, if our Sync mode is :passive or :full, unless we are the tempo master, start tying the Ableton Link tempo to the Pioneer DJ Link tempo master.

Has no effect if we are not in a compatible sync mode (see set-sync-mode).

Controls whether the Link session is tied to the tempo of the DJ Link
devices. Also reflects that in the sync state of
the [`VirtualCdj`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/VirtualCdj.html)
so it can be seen on the DJ Link network. Finally, if our Sync mode
is `:passive` or `:full`, unless we are the tempo master, start
tying the Ableton Link tempo to the Pioneer DJ Link tempo master.

Has no effect if we are not in a compatible sync
mode (see [[set-sync-mode]]).
raw docstring

unlock-tempo

(unlock-tempo)

Allow the tempo of the Link session to be controlled by other participants.

Allow the tempo of the Link session to be controlled by other
participants.
raw docstring

valid-tempo?

(valid-tempo? bpm)

Checks whether a tempo request is a reasonable number of beats per minute. Link supports the range 20 to 999 BPM. If you want something outside that range, pick the closest multiple or fraction; for example for 15 BPM, propose 30 BPM.

Checks whether a tempo request is a reasonable number of beats per
minute. Link supports the range 20 to 999 BPM. If you want something
outside that range, pick the closest multiple or fraction; for
example for 15 BPM, propose 30 BPM.
raw docstring

virtual-cdj

Holds the singleton instance of the Beat Link VirtualCDJ for convenience.

Holds the singleton instance of the Beat
Link [`VirtualCDJ`](https://deepsymmetry.org/beatlink/apidocs/org/deepsymmetry/beatlink/VirtualCdj.html)
for convenience.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close