Class: Vizcore::DSL::MidiMapExecutor::ActionContext Private
- Inherits:
-
Object
- Object
- Vizcore::DSL::MidiMapExecutor::ActionContext
- Defined in:
- lib/vizcore/dsl/midi_map_executor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Runtime DSL context used while executing one ‘midi_map` action block.
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
private
Collected runtime actions emitted by DSL calls.
- #unknown_scene_names ⇒ Object readonly private
Instance Method Summary collapse
- #blackout(value = nil, fade: nil, release: nil, color: nil) ⇒ void private
- #freeze(value = nil, fade: nil, release: nil) ⇒ void private
-
#initialize(scenes:, globals:) ⇒ ActionContext
constructor
private
A new instance of ActionContext.
- #live_control(control, value = nil, fade: nil, release: nil, color: nil) ⇒ void private
-
#next_scene(effect: nil) ⇒ void
private
Advance to the next scene in runtime scene order.
-
#previous_scene(effect: nil) ⇒ void
private
Move to the previous scene in runtime scene order.
- #set(key, value) ⇒ void private
- #switch_scene(name, effect: nil) ⇒ void private
Constructor Details
#initialize(scenes:, globals:) ⇒ ActionContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ActionContext.
212 213 214 215 216 217 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 212 def initialize(scenes:, globals:) @scenes = scenes @globals = globals @actions = [] @unknown_scene_names = [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Collected runtime actions emitted by DSL calls.
207 208 209 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 207 def actions @actions end |
#unknown_scene_names ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
208 209 210 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 208 def unknown_scene_names @unknown_scene_names end |
Instance Method Details
#blackout(value = nil, fade: nil, release: nil, color: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
292 293 294 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 292 def blackout(value = nil, fade: nil, release: nil, color: nil) live_control(:blackout, value, fade: fade, release: release, color: color) end |
#freeze(value = nil, fade: nil, release: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
298 299 300 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 298 def freeze(value = nil, fade: nil, release: nil) live_control(:freeze, value, fade: fade, release: release) end |
#live_control(control, value = nil, fade: nil, release: nil, color: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 274 def live_control(control, value = nil, fade: nil, release: nil, color: nil) state = normalize_live_control_state(value) state[:fade] = normalize_control_transition(fade) state[:release] = normalize_control_transition(release) state[:color] = normalize_control_color(color) state.delete(:fade) if state[:fade].nil? state.delete(:release) if state[:release].nil? state.delete(:color) if state[:color].nil? @actions << { type: :live_control, control: control.to_s, **state } end |
#next_scene(effect: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Advance to the next scene in runtime scene order.
244 245 246 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 244 def next_scene(effect: nil) @actions << { type: :next_scene, effect: deep_dup(effect) } end |
#previous_scene(effect: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Move to the previous scene in runtime scene order.
252 253 254 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 252 def previous_scene(effect: nil) @actions << { type: :previous_scene, effect: deep_dup(effect) } end |
#set(key, value) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
259 260 261 262 263 264 265 266 267 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 259 def set(key, value) symbol_key = key.to_sym @globals[symbol_key] = value @actions << { type: :set_global, key: symbol_key, value: value } end |
#switch_scene(name, effect: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/vizcore/dsl/midi_map_executor.rb', line 222 def switch_scene(name, effect: nil) scene = @scenes[name.to_sym] unless scene unknown = name.to_s @unknown_scene_names << unknown unless @unknown_scene_names.include?(unknown) return end @actions << { type: :switch_scene, scene: { name: scene[:name], layers: scene[:layers].map { |layer| deep_dup(layer) } }, effect: deep_dup(effect) } end |