Module: Vizcore

Defined in:
lib/vizcore.rb,
lib/vizcore/cli.rb,
lib/vizcore/dsl.rb,
lib/vizcore/audio.rb,
lib/vizcore/shape.rb,
lib/vizcore/config.rb,
lib/vizcore/errors.rb,
lib/vizcore/server.rb,
lib/vizcore/version.rb,
lib/vizcore/analysis.rb,
lib/vizcore/renderer.rb,
lib/vizcore/deep_copy.rb,
lib/vizcore/cli/doctor.rb,
lib/vizcore/dsl/engine.rb,
lib/vizcore/scene_trust.rb,
lib/vizcore/layer_catalog.rb,
lib/vizcore/server/runner.rb,
lib/vizcore/cli/layer_docs.rb,
lib/vizcore/control_preset.rb,
lib/vizcore/audio/mic_input.rb,
lib/vizcore/server/rack_app.rb,
lib/vizcore/audio/base_input.rb,
lib/vizcore/audio/file_input.rb,
lib/vizcore/audio/midi_input.rb,
lib/vizcore/dsl/file_watcher.rb,
lib/vizcore/project_manifest.rb,
lib/vizcore/sync/osc_message.rb,
lib/vizcore/analysis/fftw_ffi.rb,
lib/vizcore/analysis/pipeline.rb,
lib/vizcore/analysis/smoother.rb,
lib/vizcore/audio/calibration.rb,
lib/vizcore/audio/ring_buffer.rb,
lib/vizcore/cli/dsl_reference.rb,
lib/vizcore/dsl/color_helpers.rb,
lib/vizcore/dsl/layer_builder.rb,
lib/vizcore/dsl/scene_builder.rb,
lib/vizcore/dsl/style_builder.rb,
lib/vizcore/renderer/snapshot.rb,
lib/vizcore/sync/osc_receiver.rb,
lib/vizcore/analysis/tap_tempo.rb,
lib/vizcore/cli/plugin_checker.rb,
lib/vizcore/dsl/layout_helpers.rb,
lib/vizcore/server/gallery_app.rb,
lib/vizcore/audio/fixture_input.rb,
lib/vizcore/audio/input_manager.rb,
lib/vizcore/audio/portaudio_ffi.rb,
lib/vizcore/cli/scene_inspector.rb,
lib/vizcore/cli/scene_validator.rb,
lib/vizcore/cli/shader_template.rb,
lib/vizcore/plugin_asset_policy.rb,
lib/vizcore/renderer/png_writer.rb,
lib/vizcore/server/gallery_page.rb,
lib/vizcore/dsl/mapping_resolver.rb,
lib/vizcore/dsl/reaction_builder.rb,
lib/vizcore/dsl/timeline_builder.rb,
lib/vizcore/cli/scene_diagnostics.rb,
lib/vizcore/dsl/midi_map_executor.rb,
lib/vizcore/server/gallery_runner.rb,
lib/vizcore/analysis/band_splitter.rb,
lib/vizcore/analysis/beat_detector.rb,
lib/vizcore/analysis/bpm_estimator.rb,
lib/vizcore/analysis/fft_processor.rb,
lib/vizcore/audio/dummy_sine_input.rb,
lib/vizcore/analysis/feature_replay.rb,
lib/vizcore/cli/shader_uniform_docs.rb,
lib/vizcore/dsl/layer_group_builder.rb,
lib/vizcore/renderer/frame_scheduler.rb,
lib/vizcore/renderer/render_sequence.rb,
lib/vizcore/server/frame_broadcaster.rb,
lib/vizcore/server/websocket_handler.rb,
lib/vizcore/analysis/feature_recorder.rb,
lib/vizcore/dsl/transition_controller.rb,
lib/vizcore/renderer/scene_serializer.rb,
lib/vizcore/dsl/mapping_preset_builder.rb,
lib/vizcore/dsl/shader_source_resolver.rb,
lib/vizcore/renderer/snapshot_renderer.rb,
lib/vizcore/renderer/scene_frame_source.rb,
lib/vizcore/analysis/adaptive_normalizer.rb,
lib/vizcore/dsl/mapping_transform_builder.rb,
lib/vizcore/server/scene_dependency_watcher.rb

Overview

Main namespace for the Vizcore runtime and DSL entrypoints.

Defined Under Namespace

Modules: Analysis, Audio, CLISupport, DSL, DeepCopy, ErrorFormatting, LayerCatalog, Renderer, SceneTrust, Server, Shape, Sync Classes: AudioSourceError, CLI, Config, ConfigurationError, ControlPreset, Error, FrameBuildError, MissingDependencyError, PluginAssetPolicy, ProjectManifest, SceneLoadError

Constant Summary collapse

VERSION =

Current gem version.

"1.2.0"

Class Method Summary collapse

Class Method Details

.define { ... } ⇒ Hash

Evaluate a Vizcore DSL definition block.

Yields:

  • DSL configuration block (‘audio`, `scene`, `midi_map`, etc.)

Returns:

  • (Hash)

    serialized DSL definition



54
55
56
# File 'lib/vizcore.rb', line 54

def self.define(&block)
  DSL::Engine.define(&block)
end

.features(command_available: nil) ⇒ Hash<Symbol, Boolean>

Returns optional runtime feature availability.

Parameters:

  • command_available (#call, nil) (defaults to: nil)

    optional command lookup for tests

Returns:

  • (Hash<Symbol, Boolean>)

    optional runtime feature availability



39
40
41
42
43
44
45
46
47
48
# File 'lib/vizcore.rb', line 39

def self.features(command_available: nil)
  command_available ||= method(:command_available?)
  {
    mic: feature_available? { Audio::PortAudioFFI.available? },
    midi: feature_available? { Audio::MidiInput.available? },
    ffmpeg: command_available.call("ffmpeg"),
    browser_capture: root.join("scripts", "browser_capture.mjs").file? && command_available.call("node"),
    fftw: feature_available? { Analysis::FFTProcessor.fftw_available? }
  }
end

.frontend_rootPathname

Returns absolute path to bundled frontend assets.

Returns:

  • (Pathname)

    absolute path to bundled frontend assets.



28
29
30
# File 'lib/vizcore.rb', line 28

def self.frontend_root
  root.join("frontend")
end

.plugin(name) ⇒ true

Load a Vizcore plugin by Ruby require path.

Parameters:

  • name (String, Symbol)

    require path for the plugin

Returns:

  • (true)


62
63
64
# File 'lib/vizcore.rb', line 62

def self.plugin(name)
  require name.to_s
end

.register_layer_capability(type:, aliases: [], params: {}, mappable_params: [], description: nil) ⇒ Vizcore::LayerCatalog::Capability

Register a plugin-provided layer capability for validation and docs.

Parameters:

  • type (Symbol, String)

    primary layer type

  • aliases (Array<Symbol, String>) (defaults to: [])

    supported aliases

  • params (Hash) (defaults to: {})

    layer parameter metadata

  • mappable_params (Array<Symbol, String>) (defaults to: [])

    params that can be mapped

  • description (String, nil) (defaults to: nil)

    human-readable docs text

Returns:



74
75
76
77
78
79
80
81
82
# File 'lib/vizcore.rb', line 74

def self.register_layer_capability(type:, aliases: [], params: {}, mappable_params: [], description: nil)
  LayerCatalog.register_layer_capability(
    type: type,
    aliases: aliases,
    params: params,
    mappable_params: mappable_params,
    description: description
  )
end

.register_shape(name, klass = nil, &block) ⇒ Object

Raises:

  • (ArgumentError)


730
731
732
733
734
735
736
# File 'lib/vizcore/shape.rb', line 730

def register_shape(name, klass = nil, &block)
  raise ArgumentError, "register_shape requires a class/module or block" if klass.nil? && block.nil?
  raise ArgumentError, "register_shape accepts either a class/module or block" if klass && block

  key = name.to_sym
  @shape_registry[key] = Shape::Definition.new(name: key, renderer: klass || block)
end

.resolve_shape(name) ⇒ Object



738
739
740
# File 'lib/vizcore/shape.rb', line 738

def resolve_shape(name)
  @shape_registry[name.to_sym]
end

.rootPathname

Returns absolute root path for this gem source tree.

Returns:

  • (Pathname)

    absolute root path for this gem source tree.



23
24
25
# File 'lib/vizcore.rb', line 23

def self.root
  Pathname.new(__dir__).join("..").expand_path
end

.templates_rootPathname

Returns absolute path to scaffold template files.

Returns:

  • (Pathname)

    absolute path to scaffold template files.



33
34
35
# File 'lib/vizcore.rb', line 33

def self.templates_root
  root.join("lib", "vizcore", "templates")
end