afterglow.effects.channel

Effects pipeline functions for working with individual DMX channels.

apply-channel-value

(apply-channel-value buffers channel value)

A function which sets the DMX buffer value(s) for a channel, supporting fine channels as well (in which there is a high and low byte), using any fractional part of the value to determine the fine channel value if one is present.

Also supports inverted channels (as needed for some fixtures which have inverted dimmers). Such channels are specified by containing an :inverted-from key which specifies the DMX value at which inversion occurs. If the entire DMX range is inverted, in other words 0 represents the highest value and 255 the lowest, :inverted-from will be present with the value 0. For dimmers which are still black at zero, but which leap to full brightness at 1 then dim as the value grows towards 255, :inverted-from will be present with the value 1. Non-inverted channels will lack the key entirely.

build-channel-assigner

(build-channel-assigner channel f)

Returns an assigner which applies the specified assignment function to the supplied channel.

build-fixed-channel-effect

(build-fixed-channel-effect name level channels & {:keys [htp?]})

Returns an effect which simply assigns a fixed value to all the supplied channels. If htp? is true, applies highest-takes-precedence (i.e. compares the value to the previous assignment for the channel, and lets the highest value remain).

build-head-function-assigner

(build-head-function-assigner function head assign-f)

Returns a function assigner which applies the specified assignment function to the channels of the provided head or fixture which implement the specified named function. The head or fixture must (directly) have a channel implementing the named function.

build-head-function-assigners

(build-head-function-assigners function heads assign-f)

Returns a list of function assigners type which apply an assignment function to the channel of all the supplied heads or fixtures which implement the specified named function. Each head or fixture must (directly) have a channel implementing the named function.

build-head-parameter-function-assigner

(build-head-parameter-function-assigner function head param show snapshot)

Returns an function assigner which applies a parameter to the channel of the supplied head or fixture which implements the specified named function. If the parameter is not frame-dynamic, it gets resolved when creating this assigner. Otherwise, resolution is deferred to frame rendering time. The head or fixture must (directly) have a channel implementing the named function.

build-head-parameter-function-assigners

(build-head-parameter-function-assigners function heads param show)

Returns a list of assigners which apply a parameter to the channel(s) of the supplied heads or fixtures which implement the specified named function. Each head or fixture must (directly) have a channel implementing the named function.

build-raw-channel-assigners

(build-raw-channel-assigners channels f)

Returns a list of assigners which apply a channel assignment function to all the supplied channels.

channel-effect

(channel-effect effect-name level channels & {:keys [htp?]})

Returns an effect which assigns a dynamic value to all the supplied channels. If level is a keyword, it will be looked up as a show variable. Ifhtp?` is true, applies highest-takes-precedence (i.e. compares the value to the previous assignment for the channel, and lets the highest value remain).

find-heads-with-function

(find-heads-with-function function fixtures)

Returns all heads of the supplied fixtures which have a channel that implements the specified function.

function-effect

(function-effect effect-name function level fixtures & {:keys [htp?]})

Returns an effect which assigns a dynamic value to all channels of the supplied fixtures or heads which have a range that implements the specified function. (Functions are a way for fixtures to use the same DMX channel to do multiple things, allocating ranges of values to get more dense use from a smaller number of channel allocations.) The function argument is the keyword by which the function information will be found for the supplied fixtures. The actual value sent for the channel associated with function for each fixture will be calculated by treating level as a percentage of the way between the lowest and highest DMX values assigned to that named function for the fixture. The name displayed for the effect in user interfaces is determined by effect-name.

If :htp? is passed with a true value, applies highest-takes-precedence (i.e. compares the value to the previous assignment for the channels implementing the function, and lets the highest value remain).

If you have multiple effects trying to control different functions which use the same channel, you are unlikely to get the results you want. Hopefully the fixture designers chose how to share channels wisely, avoiding this pitfall.

function-percentage-to-dmx

(function-percentage-to-dmx percent function-spec)

Given a percentage value and a named function specfication which identifies a range of DMX channel values, scales the percentage into that range. If the function spec has a value scaler function attached to it (via the key :scale-fn), call that with the value to get the percentage before scaling it to the DMX range.

function-value-scaler

(function-value-scaler range-min range-max value)

Converts a named function value from an arbitrary range to a percentage along that range. Designed to be partially applied in a fixture definition, so function-percentage-to-dmx can pass the value being resolved as the last parameter.

raw-channel-effect

(raw-channel-effect effect-name f channels)

Returns an effect which simply calls a function to obtain the current level for all the supplied channels, runs forever, and ends immediately when requested.