afterglow.controllers.ableton-push
Allows the Ableton Push to be used as a control surface for Afterglow. Its features are described in the Developer Guide.
add-button-held-feedback-overlay
(add-button-held-feedback-overlay controller button)
Adds a simple overlay which keeps a control button bright as long as the user is holding it down.
add-custom-control-button
(add-custom-control-button controller button press-fn release-fn)
Activates an otherwise-unused button which responds to a control message, causing it to run custom code when pressed and released.
auto-bind
deprecated in 0.2.1
(auto-bind show & {:keys [device-filter refresh-interval display-name], :or {device-filter "User Port", refresh-interval (/ 1000 15), display-name "Ableton Push"}})
Deprecated in favor of the shared controllers/auto-bind implementation.
Watches for an Ableton Push controller to be connected, and as soon as it is, binds it to the specified show using bind-to-show. If that controller ever gets disconnected, it will be re-bound once it reappears. Returns a watcher structure which can be passed to deactivate if you would like to stop it watching for reconnections. The underlying controller mapping, once bound, can be accessed through the watcher’s :controller
key.
If you have more than one Ableton Push that might beconnected, or have renamed how it appears in your list of MIDI devices, you need to supply a value after :device-filter
which identifies the ports to be used to communicate with the Push you want this function to use. The values returned by afterglow.midi/open-inputs-if-needed! and afterglow.midi/open-outputs-if-needed! will be searched, and the first port that matches using filter-devices will be used.
Once bound, the controller will be identified in the user interface (for the purposes of linking it to the web cue grid) as “Ableton Push”. If you would like to use a different name (for example, if you are lucky enough to have more than one Push), you can pass in a custom value after :display-name
.
If you want the user interface to be refreshed at a different rate than the default of fifteen times per second, pass your desired number of milliseconds after :refresh-interval
.
bind-to-show
deprecated in 0.2.1
(bind-to-show show & {:keys [device-filter refresh-interval display-name], :or {device-filter "User Port", refresh-interval (/ 1000 15), display-name "Ableton Push"}})
Deprecated in favor of the shared controllers/bind-to-show implementation.
Establish a connection to the Ableton Push, for managing the given show.
Initializes the display, and starts the UI updater thread. Since SysEx messages are required for updating the display, if you are on a Mac, Afterglow embeds CoreMIDI4J to provide a working implementation.
If you have more than one Ableton Push connected, or have renamed how it appears in your list of MIDI devices, you need to supply a value after :device-filter
which identifies the ports to be used to communicate with the Push you want this function to use. The values returned by afterglow.midi/open-inputs-if-needed! and afterglow.midi/open-outputs-if-needed! will be searched, and the first port that matches with filter-devices will be used.
The controller will be identified in the user interface (for the purposes of linking it to the web cue grid) as “Ableton Push”. If you would like to use a different name (for example, if you are lucky enough to have more than one Push), you can pass in a custom value after :display-name
.
If you want the user interface to be refreshed at a different rate than the default of fifteen times per second, pass your desired number of milliseconds after :refresh-interval
.
button-state
(button-state button state)
(button-state button state color-key)
Calculate the numeric value that corresponds to a particular named state for the specified button, and (if supported and supplied), a named color.
clear-display-line
(clear-display-line controller line)
Clears a line of the text display.
clear-interface
(clear-interface controller)
Clears the text display and all illuminated buttons and pads.
color-button-colors
The control values and modes for a labeled button which changes color. These are added to the monochrome states (except for off) to obtain the color and brightness/behavior.
deactivate
(deactivate controller & {:keys [disconnected], :or {disconnected false}})
Deactivates a controller interface, killing its update thread and removing its MIDI listeners. If :disconnected
is passed with a true
value, it means that the controller has already been removed from the MIDI environment, so no effort will be made to clear its display or take it out of User mode.
In general you will not need to call this function directly; it will be dispatched to via controllers/deactivate when that is called with a controller binding implementation from this namespace. It is also called automatically when one of the controllers being used disappears from the MIDI environment.
in-mode?
(in-mode? controller button)
Check whether the controller is in a particular mode, identified by a control button number or keyword.
light-custom-buttons
(light-custom-buttons controller)
Light any custom buttons that have been configured to make it clear they are active. (If the button already has a lightness value, it was not appropriate for it to have been configured as a custom button, so leave it alone.)
make-gauge
(make-gauge value & {:keys [lowest highest width], :or {lowest 0, highest 100, width 17}})
Create a graphical gauge with an indicator that fills a line. The default range is from zero to a hundred, and the default size is 17 characters, or a full display cell.
make-pan-gauge
(make-pan-gauge value & {:keys [lowest highest width], :or {lowest 0, highest 100, width 17}})
Create a graphical gauge with an indicator that moves along a line. The default range is from zero to a hundred, and the default size is 17 characters, or a full display cell.
monochrome-button-states
The control values and modes for a labeled button which does not change color.
port-filter
Because the Push registers multiple ports with the MIDI environment, we need to be sure to bind only to the User port. This filter is used with filter-devices to screen out any port that does not seem to be the User port. If port names are assigned differently on your operating system, you may need to change this (and please open a Pull Request); this filter seems to work for Mac OS X and Windows.
set-button-state
(set-button-state controller button state)
(set-button-state controller button state color-key)
Set one of the labeled buttons to a particular state, and, if supported, color. If the state is already a number, it is used as-is, otherwise it is calculated using button-state.
set-display-line
(set-display-line controller line bytes)
Sets a line of the text display.
set-pad-color
(set-pad-color controller x y color)
Set the color of one of the 64 touch pads to a specific RGB color.
set-pad-color-approximate
deprecated in 0.1.4
(set-pad-color-approximate controller x y color)
Deprecated in favor of new set-pad-color implementation.
Set the color of one of the 64 touch pads to the closest approximation available for a desired color. This was the first implementation that was discovered, but there is now a much more powerful way to specify an exact color using a SysEx message.
set-pad-velocity
(set-pad-velocity controller x y velocity)
Set the velocity of one of the 64 touch pads.
set-second-pad-color
(set-second-pad-color controller x color)
Set the color of one of the 8 second-row touch pads (right above the 8x8 pad of larger, velocity sensitive, pads) to the closest approximation available for a desired color.
set-top-pad-state
(set-top-pad-state controller x state)
(set-top-pad-state controller x state color-key)
Set one of the top-row pads to a particular state and color. If state is already a number, it is used as-is, otherwise it is calculated using top-pad-state.
show-labels
(show-labels controller)
(show-labels controller state)
(show-labels controller state color)
Illuminates all buttons with text labels, for development assistance.
sign-velocity
(sign-velocity val)
Convert a midi velocity to its signed equivalent, to translate encoder rotations, which are twos-complement seven bit numbers.
special-symbols
The byte values which draw special-purpose characters on the Push display.
top-pad-state
(top-pad-state state)
(top-pad-state state color-key)
Calculate the numeric value that corresponds to a particular named state for the specified top-row pad, and (if supplied), named color.
touch-strip-mode-default
The mode to which we should return the touch strip when we are shutting down.
touch-strip-mode-hue
The mode to which we should set the touch strip when the user is editing a hue.
touch-strip-mode-level
The mode to which we should set the touch strip when the user is editing a pan-style control.
touch-strip-mode-pan
The mode to which we should set the touch strip when the user is editing a level-style control.
velocity-for-color
(velocity-for-color color)
Given a target color, calculate the MIDI note velocity which will achieve the closest approximation available on an Ableton Push pad, using the thoughtful hue palette provided by Ableton:
write-display-text
(write-display-text controller row start text)
Update a batch of characters within the display to be rendered on the next update.