Class: Vizcore::Config
- Inherits:
-
Object
- Object
- Vizcore::Config
- Defined in:
- lib/vizcore/config.rb
Overview
Runtime configuration for CLI/server startup.
Constant Summary collapse
- DEFAULT_HOST =
Default host used by ‘vizcore start`.
"127.0.0.1"- DEFAULT_PORT =
Default HTTP/WebSocket port.
4567- DEFAULT_AUDIO_SOURCE =
Default audio source.
:mic- DEFAULT_NOISE_GATE =
Default RMS noise gate for live audio.
0.01- DEFAULT_RELOAD =
Default scene file hot reload behavior.
true- SUPPORTED_AUDIO_SOURCES =
Supported CLI audio source values.
%i[mic file dummy].freeze
Instance Attribute Summary collapse
-
#audio_device ⇒ Object
readonly
Returns the value of attribute audio_device.
-
#audio_file ⇒ Object
readonly
Returns the value of attribute audio_file.
-
#audio_source ⇒ Object
readonly
Returns the value of attribute audio_source.
-
#bpm ⇒ Object
readonly
Returns the value of attribute bpm.
-
#control_preset ⇒ Object
readonly
Returns the value of attribute control_preset.
-
#feature_file ⇒ Object
readonly
Returns the value of attribute feature_file.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#noise_gate ⇒ Object
readonly
Returns the value of attribute noise_gate.
-
#osc_port ⇒ Object
readonly
Returns the value of attribute osc_port.
-
#plugin_assets ⇒ Object
readonly
Returns the value of attribute plugin_assets.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#projector_mode ⇒ Object
readonly
Returns the value of attribute projector_mode.
-
#scene_file ⇒ Object
readonly
Returns the value of attribute scene_file.
Instance Method Summary collapse
-
#bpm_lock? ⇒ Boolean
True when BPM output should use the fixed BPM value.
-
#initialize(scene_file:, host: DEFAULT_HOST, port: DEFAULT_PORT, audio_source: DEFAULT_AUDIO_SOURCE, audio_file: nil, audio_device: nil, feature_file: nil, control_preset: nil, plugin_assets: [], noise_gate: DEFAULT_NOISE_GATE, bpm: nil, bpm_lock: false, osc_port: nil, reload: DEFAULT_RELOAD, projector_mode: false) ⇒ Config
constructor
A new instance of Config.
-
#projector? ⇒ Boolean
True when browser output should start without operator UI.
-
#reload? ⇒ Boolean
True when scene hot reload is enabled.
-
#scene_exists? ⇒ Boolean
True when the configured scene file exists.
Constructor Details
#initialize(scene_file:, host: DEFAULT_HOST, port: DEFAULT_PORT, audio_source: DEFAULT_AUDIO_SOURCE, audio_file: nil, audio_device: nil, feature_file: nil, control_preset: nil, plugin_assets: [], noise_gate: DEFAULT_NOISE_GATE, bpm: nil, bpm_lock: false, osc_port: nil, reload: DEFAULT_RELOAD, projector_mode: false) ⇒ Config
Returns a new instance of Config.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vizcore/config.rb', line 38 def initialize( scene_file:, host: DEFAULT_HOST, port: DEFAULT_PORT, audio_source: DEFAULT_AUDIO_SOURCE, audio_file: nil, audio_device: nil, feature_file: nil, control_preset: nil, plugin_assets: [], noise_gate: DEFAULT_NOISE_GATE, bpm: nil, bpm_lock: false, osc_port: nil, reload: DEFAULT_RELOAD, projector_mode: false ) @scene_file = Pathname.new(scene_file). if scene_file @host = host @port = Integer(port) @audio_source = normalize_audio_source(audio_source) @audio_file = audio_file ? Pathname.new(audio_file). : nil @audio_device = normalize_audio_device(audio_device) @feature_file = feature_file ? Pathname.new(feature_file). : nil @control_preset = control_preset ? Pathname.new(control_preset). : nil @plugin_assets = normalize_plugin_assets(plugin_assets) @noise_gate = normalize_noise_gate(noise_gate) @bpm = normalize_bpm(bpm) @bpm_lock = !!bpm_lock @osc_port = normalize_optional_port(osc_port) @reload = !!reload @projector_mode = !!projector_mode end |
Instance Attribute Details
#audio_device ⇒ Object (readonly)
Returns the value of attribute audio_device.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def audio_device @audio_device end |
#audio_file ⇒ Object (readonly)
Returns the value of attribute audio_file.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def audio_file @audio_file end |
#audio_source ⇒ Object (readonly)
Returns the value of attribute audio_source.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def audio_source @audio_source end |
#bpm ⇒ Object (readonly)
Returns the value of attribute bpm.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def bpm @bpm end |
#control_preset ⇒ Object (readonly)
Returns the value of attribute control_preset.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def control_preset @control_preset end |
#feature_file ⇒ Object (readonly)
Returns the value of attribute feature_file.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def feature_file @feature_file end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def host @host end |
#noise_gate ⇒ Object (readonly)
Returns the value of attribute noise_gate.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def noise_gate @noise_gate end |
#osc_port ⇒ Object (readonly)
Returns the value of attribute osc_port.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def osc_port @osc_port end |
#plugin_assets ⇒ Object (readonly)
Returns the value of attribute plugin_assets.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def plugin_assets @plugin_assets end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def port @port end |
#projector_mode ⇒ Object (readonly)
Returns the value of attribute projector_mode.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def projector_mode @projector_mode end |
#scene_file ⇒ Object (readonly)
Returns the value of attribute scene_file.
21 22 23 |
# File 'lib/vizcore/config.rb', line 21 def scene_file @scene_file end |
Instance Method Details
#bpm_lock? ⇒ Boolean
Returns true when BPM output should use the fixed BPM value.
88 89 90 |
# File 'lib/vizcore/config.rb', line 88 def bpm_lock? @bpm_lock end |
#projector? ⇒ Boolean
Returns true when browser output should start without operator UI.
78 79 80 |
# File 'lib/vizcore/config.rb', line 78 def projector? projector_mode end |
#reload? ⇒ Boolean
Returns true when scene hot reload is enabled.
83 84 85 |
# File 'lib/vizcore/config.rb', line 83 def reload? @reload end |
#scene_exists? ⇒ Boolean
Returns true when the configured scene file exists.
73 74 75 |
# File 'lib/vizcore/config.rb', line 73 def scene_exists? scene_file && scene_file.file? end |