Activity:
Filter:
Influx/Classes (extension) | Influx

Activity
ExtensionExtension

model activity level and its subjective decay over time.

Description

Activity models the decay of perceived activity level over time. Can be used to track how active some playing interface is being used, and slowly winding down a process if it gets no playing attention.

Class Methods

.new

Arguments:

decaytime

time after which level will have decayed by -60dB.

dt

delta time at which model calculation steps happen

Instance Methods

.skip

a skipjack running the calculation

.floor

a minimum value below which energy is set to 0.

.decaytime

get and set decaytime, i.e. time after which level has decayed by -60dB.

.dt

get and set delta time at which model calculation steps happen.

.level

the current activity level

.play

.stop

play or stop skipjack that runs calculation.

.add

add a value to current level. When current level is > 1, added level will be scaled down by 1/level.

Arguments:

val

the value to add

.action

an action to perform after each calculation step. can be used for debugging, or informing related processes about level updates.

.decay

next model step: calculate new level based on dt and decaytime.