afterglow.channels

Functions for modeling DMX channels

all-addresses

(all-addresses fixtures)

Returns all the addresses being used by a list of patched fixtures, including those used by any fixture heads.

build-function

(build-function range-type function-type label & {:keys [start end var-label], :or {start 0, end 255}})

Returns a function spefication that encompasses a range of possible DMX values for a channel. If start and end are not specified, the function uses the full range of the channel.

channel

(channel offset)

Creates a minimal channel specification, containing just the address offset within the fixture’s list of channels. The first channel used by a fixture is, by convention, given offset 1.

You probably want to use fine-channel rather than this function to create even channels which do not have a :fine-offset because of the other helpful features it offers, such as setting up the channel function specification for you.

color

(color offset color & {:keys [hue function-label fine-offset]})

A channel which controls a color component. If :hue is supplied along with a hue value, this channel will participate in color mixing even if color is not one of the standard values :red, :green, :blue, or :white whose hues and contributions to color mixing are automatically understood.

By default, the function created for the channel uses the name of the color keyword as its function label. Since this label is displayed in the web interface as the text label in the cue grid cell for Function Cues created for the function, you may wish to specify a more readable name, which you can do by passing it in with :function-label.

If the fixture uses two-byte values for this color component, pass the offset of the channel containing the most-significant byte in offset, and specify the offset of the channel containing the least-significant byte with :fine-offset.

color-wheel-hue

(color-wheel-hue hue & {:keys [range label], :or {range :fixed}})

Creates a function specification which identifies a color wheel position with a particular hue, so it can participate in Afterglow’s color effects. The hue can be specified as a number, a jolby/colors object, or a string which is passed to the jolby/colors create-color function.

The label to assign the function spec can be passed via the :label optional keyword argument, or it will be inferred from the hue value supplied. The function spec will be considered a fixed range unless you specify :range :variable.

If hue is a sequence, then returns a sequence of the results of calling color-wheel-hue on each of the elements in that sequence, with the same optional arguments.

dimmer

(dimmer offset & {:keys [inverted-from fine-offset]})

A channel which controls a dimmer.

Normal dimmers are dark at zero, and get brighter as the channel value increases, to a maximum brightness at 255. However, some fixtures have inverted dimmers. If that is the case, pass the DMX value at which the inversion takes place with :inverted-from. For example, fixtures which are brightest at zero and darken as the value approaches 255 would be specified as :inverted-from 0, while fixtures which are dark at zero, jump to maximum brightness at 1, then dim as the value grows towards 255 would be specified as :inverted-from 1.

If the fixture uses two-byte values for the dimmer level, pass the offset of the channel containing the most-significant byte in offset, and specify the offset of the channel containing the least-significant byte with :fine-offset.

expand-heads

(expand-heads fixtures)

Given a list of fixtures, expands it to include the heads.

extract-channels

(extract-channels fixtures pred)

Given a fixture list, returns the channels matching the specified predicate.

extract-heads-with-some-matching-channel

(extract-heads-with-some-matching-channel fixtures pred)

Given a fixture list, returns all heads (which may be top-level fixtures too) whose channels contain a match for the specified predicate.

find-rgb-heads

(find-rgb-heads fixtures)(find-rgb-heads fixtures include-color-wheels?)

Returns all heads of the supplied fixtures which are capable of mixing RGB color, in other words they have at least a red, green, and blue color channel. If the second argument is present and true, also returns heads with color wheels.

fine-channel

(fine-channel chan-type offset & {:keys [fine-offset function-type function-name var-label], :or {function-type chan-type}})

Defines a channel of type chan-type which may be paired with a second channel in order to support multi-byte values. When a value is passed in with :fine-offset, the channel specified by offset is understood as containing the most-significant byte of a two-byte value, with the least-significant byte carried in the channel whose offset followed :fine-offset.

Automatically creates a function specification which spans all the legal DMX values for the channel. By default, the function type is taken to be the same as chan-type, but this can be changed by passing in a different keyword with :function-type.

Similarly, the name of the function created is, by default, a capitalized version of the function type (without its leading colon). Since this name is displayed in the web interface as the text label in the cue grid cell for Function Cues created for the function, you may wish to specify a more readable name, which you can do by passing it with :function-name.

Finally, you may specify a label to be used when creating a user interface for adjusting the value associated with this function. Function Cues will use this as the label for the cue-local variable they create, and it will appear in places like the Ableton Push Effect Control interface. You can specify what this variable label should be with :var-label; if you do not, the generic label Level will be used.

focus

(focus offset)(focus offset fine-offset)

A channel which adjusts focus, with an optional second channel for fine control.

frost

(frost offset)(frost offset fine-offset)

A channel which adjusts frost, with an optional second channel for fine control.

functions

(functions chan-type offset & functions)

Defines a channel whose values are divided up into different ranges which perform different functions. After the channel type and DMX offset, pass a list of starting values and function specifications.

The simplest form of specification is a keyword or string identifying the function type; this will be expanded into a variable-range (for keywords) or fixed-range (for strings) function of that type.

For more complex functions, pass in a map containing the :type keyword and any other settings you need to make (e.g. :label, :range, :var-label), and the rest will be filled in for you.

To skip a range, pass nil for its specification.

The ranges need to be in order of increasing starting values, and the ending values for each will be figured out by context, e.g.

(functions :strobe 40
           0 nil
           10 "Strobe Random"
           20 :strobe)

See the Developer Guide for more details and examples.

has-rgb-heads?

(has-rgb-heads? fixture)(has-rgb-heads? fixture include-color-wheels?)

Given a fixture, returns a truthy value if it has any heads capable of mixing RGB color. If the second argument is present and true, having a head with a color wheel is good enough.

iris

(iris offset)(iris offset fine-offset)

A channel which controls an iris, with an optional second channel for fine control.

pan

(pan offset)(pan offset fine-offset)

A channel which pans a moving head, with an optional second channel for fine control.

patch-fixture

(patch-fixture fixture universe start-address id-fn)

Assign a fixture to a DMX universe and starting channel; resolves all of its channel assignments.

tilt

(tilt offset)(tilt offset fine-offset)

A channel which tilts a moving head, with an optional second channel for fine control.

zoom

(zoom offset)(zoom offset fine-offset)

A channel which adjusts zoom, with an optional second channel for fine control.