Module: Deftones
- Defined in:
- lib/deftones.rb,
lib/deftones.rb,
lib/deftones/draw.rb,
lib/deftones/context.rb,
lib/deftones/version.rb,
lib/deftones/listener.rb,
lib/deftones/core/gain.rb,
lib/deftones/io/buffer.rb,
lib/deftones/core/clock.rb,
lib/deftones/core/delay.rb,
lib/deftones/core/param.rb,
lib/deftones/dsp/biquad.rb,
lib/deftones/event/loop.rb,
lib/deftones/event/part.rb,
lib/deftones/io/buffers.rb,
lib/deftones/music/midi.rb,
lib/deftones/music/note.rb,
lib/deftones/music/time.rb,
lib/deftones/core/effect.rb,
lib/deftones/core/signal.rb,
lib/deftones/core/source.rb,
lib/deftones/destination.rb,
lib/deftones/dsp/helpers.rb,
lib/deftones/io/recorder.rb,
lib/deftones/music/ticks.rb,
lib/deftones/analysis/fft.rb,
lib/deftones/core/emitter.rb,
lib/deftones/source/noise.rb,
lib/deftones/component/eq3.rb,
lib/deftones/component/lfo.rb,
lib/deftones/effect/chorus.rb,
lib/deftones/effect/phaser.rb,
lib/deftones/effect/reverb.rb,
lib/deftones/event/pattern.rb,
lib/deftones/source/player.rb,
lib/deftones/analysis/meter.rb,
lib/deftones/component/gate.rb,
lib/deftones/component/mono.rb,
lib/deftones/component/solo.rb,
lib/deftones/dsp/delay_line.rb,
lib/deftones/effect/tremolo.rb,
lib/deftones/effect/vibrato.rb,
lib/deftones/event/sequence.rb,
lib/deftones/source/players.rb,
lib/deftones/component/merge.rb,
lib/deftones/component/split.rb,
lib/deftones/core/audio_node.rb,
lib/deftones/core/instrument.rb,
lib/deftones/effect/auto_wah.rb,
lib/deftones/effect/freeverb.rb,
lib/deftones/event/transport.rb,
lib/deftones/music/frequency.rb,
lib/deftones/offline_context.rb,
lib/deftones/component/filter.rb,
lib/deftones/component/panner.rb,
lib/deftones/component/volume.rb,
lib/deftones/core/audio_block.rb,
lib/deftones/effect/chebyshev.rb,
lib/deftones/effect/jc_reverb.rb,
lib/deftones/event/tone_event.rb,
lib/deftones/instrument/synth.rb,
lib/deftones/analysis/analyser.rb,
lib/deftones/analysis/dc_meter.rb,
lib/deftones/analysis/waveform.rb,
lib/deftones/component/channel.rb,
lib/deftones/component/limiter.rb,
lib/deftones/component/pan_vol.rb,
lib/deftones/effect/distortion.rb,
lib/deftones/portaudio_support.rb,
lib/deftones/source/oscillator.rb,
lib/deftones/source/user_media.rb,
lib/deftones/component/envelope.rb,
lib/deftones/component/follower.rb,
lib/deftones/component/panner3d.rb,
lib/deftones/core/synced_signal.rb,
lib/deftones/effect/auto_filter.rb,
lib/deftones/effect/auto_panner.rb,
lib/deftones/effect/bit_crusher.rb,
lib/deftones/effect/pitch_shift.rb,
lib/deftones/instrument/sampler.rb,
lib/deftones/music/unit_helpers.rb,
lib/deftones/component/convolver.rb,
lib/deftones/core/signal_shapers.rb,
lib/deftones/effect/oversampling.rb,
lib/deftones/instrument/am_synth.rb,
lib/deftones/instrument/fm_synth.rb,
lib/deftones/source/grain_player.rb,
lib/deftones/component/compressor.rb,
lib/deftones/component/cross_fade.rb,
lib/deftones/core/computed_signal.rb,
lib/deftones/instrument/duo_synth.rb,
lib/deftones/music/transport_time.rb,
lib/deftones/source/am_oscillator.rb,
lib/deftones/source/fm_oscillator.rb,
lib/deftones/core/signal_operators.rb,
lib/deftones/effect/feedback_delay.rb,
lib/deftones/effect/stereo_widener.rb,
lib/deftones/instrument/mono_synth.rb,
lib/deftones/instrument/poly_synth.rb,
lib/deftones/source/fat_oscillator.rb,
lib/deftones/source/karplus_strong.rb,
lib/deftones/source/pwm_oscillator.rb,
lib/deftones/effect/ping_pong_delay.rb,
lib/deftones/instrument/metal_synth.rb,
lib/deftones/instrument/noise_synth.rb,
lib/deftones/instrument/pluck_synth.rb,
lib/deftones/source/omni_oscillator.rb,
lib/deftones/component/biquad_filter.rb,
lib/deftones/event/callback_behavior.rb,
lib/deftones/source/pulse_oscillator.rb,
lib/deftones/component/mid_side_merge.rb,
lib/deftones/component/mid_side_split.rb,
lib/deftones/effect/frequency_shifter.rb,
lib/deftones/component/multiband_split.rb,
lib/deftones/component/one_pole_filter.rb,
lib/deftones/effect/modulation_control.rb,
lib/deftones/instrument/membrane_synth.rb,
lib/deftones/source/tone_buffer_source.rb,
lib/deftones/source/tone_oscillator_node.rb,
lib/deftones/component/amplitude_envelope.rb,
lib/deftones/component/frequency_envelope.rb,
lib/deftones/core/signal_operator_methods.rb,
lib/deftones/component/lowpass_comb_filter.rb,
lib/deftones/component/mid_side_compressor.rb,
lib/deftones/component/feedback_comb_filter.rb,
lib/deftones/component/multiband_compressor.rb
Defined Under Namespace
Modules: Analysis, Component, Core, DSP, Effects, Event, IO, Instrument, Music, PortAudioSupport, Source
Classes: CodecCommandError, Context, Destination, Draw, Error, InvalidFrequencyError, InvalidNoteError, InvalidTimeError, Listener, MissingCodecBackendError, MissingMidiBackendError, MissingRealtimeBackendError, OfflineContext, UnsupportedAudioFormatError
Constant Summary
collapse
- AudioNode =
Core::AudioNode
- ToneAudioNode =
Core::AudioNode
- Effect =
Core::Effect
- Emitter =
Core::Emitter
- Gain =
Core::Gain
- Delay =
Core::Delay
- Clock =
Core::Clock
- Param =
Core::Param
- Signal =
Core::Signal
- SyncedSignal =
Core::SyncedSignal
- Abs =
Core::Abs
- Add =
Core::Add
- AudioToGain =
Core::AudioToGain
- EqualPowerGain =
Core::EqualPowerGain
- GainToAudio =
Core::GainToAudio
- GreaterThan =
Core::GreaterThan
- GreaterThanZero =
Core::GreaterThanZero
- Modulo =
Core::Modulo
- Multiply =
Core::Multiply
- Negate =
Core::Negate
- Normalize =
Core::Normalize
- Pow =
Core::Pow
- Scale =
Core::Scale
- ScaleExp =
Core::ScaleExp
- Subtract =
Core::Subtract
- WaveShaper =
Core::WaveShaper
- Zero =
Core::Zero
- Oscillator =
Source::Oscillator
- Noise =
Source::Noise
- UserMedia =
Source::UserMedia
- PulseOscillator =
Source::PulseOscillator
- FMOscillator =
Source::FMOscillator
- AMOscillator =
Source::AMOscillator
- FatOscillator =
Source::FatOscillator
- PWMOscillator =
Source::PWMOscillator
- OmniOscillator =
Source::OmniOscillator
- Player =
Source::Player
- Players =
Source::Players
- BufferSource =
Source::ToneBufferSource
- GrainPlayer =
Source::GrainPlayer
- ToneBufferSource =
Source::ToneBufferSource
- ToneOscillatorNode =
Source::ToneOscillatorNode
- Envelope =
Component::Envelope
- AmplitudeEnvelope =
Component::AmplitudeEnvelope
- FrequencyEnvelope =
Component::FrequencyEnvelope
- BiquadFilter =
Component::BiquadFilter
- FeedbackCombFilter =
Component::FeedbackCombFilter
- Filter =
Component::Filter
- Follower =
Component::Follower
- LFO =
Component::LFO
- LowpassCombFilter =
Component::LowpassCombFilter
- OnePoleFilter =
Component::OnePoleFilter
- Volume =
Component::Volume
- Panner =
Component::Panner
- Panner3D =
Component::Panner3D
- Convolver =
Component::Convolver
- PanVol =
Component::PanVol
- Solo =
Component::Solo
- Channel =
Component::Channel
- CrossFade =
Component::CrossFade
- Merge =
Component::Merge
- MidSideCompressor =
Component::MidSideCompressor
- MidSideMerge =
Component::MidSideMerge
- MidSideSplit =
Component::MidSideSplit
- Mono =
Component::Mono
- MultibandCompressor =
Component::MultibandCompressor
- MultibandSplit =
Component::MultibandSplit
- Split =
Component::Split
- EQ3 =
Component::EQ3
- Compressor =
Component::Compressor
- Limiter =
Component::Limiter
- Gate =
Component::Gate
- Analyser =
Analysis::Analyser
- Meter =
Analysis::Meter
- FFT =
Analysis::FFT
- Waveform =
Analysis::Waveform
- DCMeter =
Analysis::DCMeter
- Distortion =
Effects::Distortion
- BitCrusher =
Effects::BitCrusher
- Chebyshev =
Effects::Chebyshev
- FeedbackDelay =
Effects::FeedbackDelay
- PingPongDelay =
Effects::PingPongDelay
- Reverb =
Effects::Reverb
- Freeverb =
Effects::Freeverb
- JCReverb =
Effects::JCReverb
- Chorus =
Effects::Chorus
- Phaser =
Effects::Phaser
- Tremolo =
Effects::Tremolo
- Vibrato =
Effects::Vibrato
- AutoFilter =
Effects::AutoFilter
- AutoPanner =
Effects::AutoPanner
- AutoWah =
Effects::AutoWah
- FrequencyShifter =
Effects::FrequencyShifter
- PitchShift =
Effects::PitchShift
- StereoWidener =
Effects::StereoWidener
- Synth =
Instrument::Synth
- MonoSynth =
Instrument::MonoSynth
- FMSynth =
Instrument::FMSynth
- AMSynth =
Instrument::AMSynth
- DuoSynth =
Instrument::DuoSynth
- NoiseSynth =
Instrument::NoiseSynth
- PluckSynth =
Instrument::PluckSynth
- MembraneSynth =
Instrument::MembraneSynth
- MetalSynth =
Instrument::MetalSynth
- Sampler =
Instrument::Sampler
- PolySynth =
Instrument::PolySynth
- Buffer =
IO::Buffer
- Buffers =
IO::Buffers
- ToneAudioBuffer =
IO::Buffer
- ToneAudioBuffers =
IO::Buffers
- Recorder =
IO::Recorder
- BaseContext =
Context
- Note =
Music::Note
- Frequency =
Music::Frequency
- FrequencyClass =
Music::Frequency
- Midi =
Music::Midi
- MidiClass =
Music::Midi
- Ticks =
Music::Ticks
- TicksClass =
Music::Ticks
- Time =
Music::Time
- TimeClass =
Music::Time
- TransportTime =
Music::TransportTime
- TransportTimeClass =
Music::TransportTime
- Transport =
Event::Transport
- ToneEvent =
Event::ToneEvent
- Loop =
Event::Loop
- Part =
Event::Part
- Sequence =
Event::Sequence
- Pattern =
Event::Pattern
- Master =
Destination
- VERSION =
"1.0.0"
Class Method Summary
collapse
-
.capabilities ⇒ Object
-
.compressed_audio_available? ⇒ Boolean
(also: compressedAudioAvailable)
-
.connect_series(*nodes) ⇒ Object
(also: connectSeries)
-
.connect_signal(source, destination_node) ⇒ Object
(also: connectSignal)
-
.context ⇒ Object
-
.db_to_gain(value) ⇒ Object
(also: dbToGain)
-
.destination ⇒ Object
-
.draw ⇒ Object
-
.fan_in(destination_node, *sources) ⇒ Object
(also: fanIn)
-
.feature_supported?(feature) ⇒ Boolean
(also: featureSupported)
-
.frequency(value) ⇒ Object
-
.ftom(value) ⇒ Object
-
.gain_to_db(value) ⇒ Object
(also: gainToDb)
-
.get_context ⇒ Object
(also: getContext)
-
.get_destination ⇒ Object
(also: getDestination)
-
.get_draw ⇒ Object
(also: getDraw)
-
.get_listener ⇒ Object
(also: getListener)
-
.get_transport ⇒ Object
(also: getTransport)
-
.immediate ⇒ Object
-
.interval_to_frequency_ratio(value) ⇒ Object
(also: intervalToFrequencyRatio)
-
.is_array(value) ⇒ Object
(also: isArray)
-
.is_boolean(value) ⇒ Object
(also: isBoolean)
-
.is_defined(value) ⇒ Object
(also: isDefined)
-
.is_function(value) ⇒ Object
(also: isFunction)
-
.is_note(value) ⇒ Object
(also: isNote)
-
.is_number(value) ⇒ Object
(also: isNumber)
-
.is_object(value) ⇒ Object
(also: isObject)
-
.is_string(value) ⇒ Object
(also: isString)
-
.is_undef(value) ⇒ Object
(also: isUndef)
-
.listener ⇒ Object
-
.load_wavify! ⇒ Object
-
.loaded ⇒ Object
-
.master ⇒ Object
-
.midi(value) ⇒ Object
-
.midi_available? ⇒ Boolean
(also: midi_available)
-
.mtof(value) ⇒ Object
-
.now ⇒ Object
-
.offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block) ⇒ Object
-
.Offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block) ⇒ Object
-
.output ⇒ Object
-
.portaudio_available? ⇒ Boolean
-
.render(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, seed: nil, metadata: false, progress: nil, cancel: nil, &block) ⇒ Object
-
.render_to_file(path, duration:, format: nil, streaming: false, **options, &block) ⇒ Object
-
.reset! ⇒ Object
-
.set_context(new_context) ⇒ Object
(also: setContext)
-
.start(use_realtime: true) ⇒ Object
-
.supported?(feature = nil) ⇒ Boolean
(also: supported)
-
.supported_features ⇒ Object
(also: supportedFeatures)
-
.ticks(value, transport: self.transport) ⇒ Object
-
.time(value) ⇒ Object
-
.transport ⇒ Object
-
.transport_time(value, transport: self.transport) ⇒ Object
(also: transportTime)
-
.unsupported_features ⇒ Object
(also: unsupportedFeatures)
-
.version ⇒ Object
-
.wavify_available? ⇒ Boolean
(also: wavefile_available?)
-
.with_random_seed(seed) ⇒ Object
Class Method Details
.capabilities ⇒ Object
288
289
290
291
292
293
294
295
296
|
# File 'lib/deftones.rb', line 288
def capabilities
{
offline: true,
wav: wavify_available?,
compressed_audio: compressed_audio_available?,
realtime: portaudio_available?,
midi: midi_available?
}
end
|
.compressed_audio_available? ⇒ Boolean
Also known as:
compressedAudioAvailable
.connect_series(*nodes) ⇒ Object
Also known as:
connectSeries
320
321
322
323
|
# File 'lib/deftones.rb', line 320
def connect_series(*nodes)
nodes.each_cons(2) { |source, destination_node| source.connect(destination_node) }
nodes.last
end
|
.connect_signal(source, destination_node) ⇒ Object
Also known as:
connectSignal
335
336
337
338
|
# File 'lib/deftones.rb', line 335
def connect_signal(source, destination_node)
source.connect(destination_node)
destination_node
end
|
.context ⇒ Object
152
153
154
|
# File 'lib/deftones.rb', line 152
def context
@context ||= Context.new
end
|
.db_to_gain(value) ⇒ Object
Also known as:
dbToGain
345
346
347
|
# File 'lib/deftones.rb', line 345
def db_to_gain(value)
10.0**(value.to_f / 20.0)
end
|
.destination ⇒ Object
177
178
179
|
# File 'lib/deftones.rb', line 177
def destination
Destination.node(context: context)
end
|
.draw ⇒ Object
185
186
187
|
# File 'lib/deftones.rb', line 185
def draw
Draw.instance
end
|
.fan_in(destination_node, *sources) ⇒ Object
Also known as:
fanIn
340
341
342
343
|
# File 'lib/deftones.rb', line 340
def fan_in(destination_node, *sources)
sources.each { |source| source.connect(destination_node) }
destination_node
end
|
.feature_supported?(feature) ⇒ Boolean
Also known as:
featureSupported
308
309
310
|
# File 'lib/deftones.rb', line 308
def feature_supported?(feature)
supported?(feature)
end
|
.frequency(value) ⇒ Object
413
414
415
|
# File 'lib/deftones.rb', line 413
def frequency(value)
Music::Frequency.new(value)
end
|
.ftom(value) ⇒ Object
356
357
358
|
# File 'lib/deftones.rb', line 356
def ftom(value)
Frequency.to_midi(value)
end
|
.gain_to_db(value) ⇒ Object
Also known as:
gainToDb
349
350
351
352
353
354
|
# File 'lib/deftones.rb', line 349
def gain_to_db(value)
gain = value.to_f
return -Float::INFINITY if gain <= 0.0
20.0 * Math.log10(gain)
end
|
.get_context ⇒ Object
Also known as:
getContext
173
174
175
|
# File 'lib/deftones.rb', line 173
def get_context
context
end
|
.get_destination ⇒ Object
Also known as:
getDestination
181
182
183
|
# File 'lib/deftones.rb', line 181
def get_destination
destination
end
|
.get_draw ⇒ Object
Also known as:
getDraw
189
190
191
|
# File 'lib/deftones.rb', line 189
def get_draw
draw
end
|
.get_listener ⇒ Object
Also known as:
getListener
197
198
199
|
# File 'lib/deftones.rb', line 197
def get_listener
listener
end
|
.get_transport ⇒ Object
Also known as:
getTransport
209
210
211
|
# File 'lib/deftones.rb', line 209
def get_transport
transport
end
|
255
256
257
|
# File 'lib/deftones.rb', line 255
def immediate
now
end
|
.interval_to_frequency_ratio(value) ⇒ Object
Also known as:
intervalToFrequencyRatio
364
365
366
|
# File 'lib/deftones.rb', line 364
def interval_to_frequency_ratio(value)
2.0**(value.to_f / 12.0)
end
|
.is_array(value) ⇒ Object
Also known as:
isArray
368
369
370
|
# File 'lib/deftones.rb', line 368
def is_array(value)
value.is_a?(Array)
end
|
.is_boolean(value) ⇒ Object
Also known as:
isBoolean
372
373
374
|
# File 'lib/deftones.rb', line 372
def is_boolean(value)
value == true || value == false
end
|
.is_defined(value) ⇒ Object
Also known as:
isDefined
376
377
378
|
# File 'lib/deftones.rb', line 376
def is_defined(value)
!value.nil?
end
|
.is_function(value) ⇒ Object
Also known as:
isFunction
380
381
382
|
# File 'lib/deftones.rb', line 380
def is_function(value)
value.respond_to?(:call)
end
|
.is_note(value) ⇒ Object
Also known as:
isNote
384
385
386
387
388
389
|
# File 'lib/deftones.rb', line 384
def is_note(value)
Note.to_midi(value)
true
rescue StandardError
false
end
|
.is_number(value) ⇒ Object
Also known as:
isNumber
391
392
393
|
# File 'lib/deftones.rb', line 391
def is_number(value)
value.is_a?(Numeric)
end
|
.is_object(value) ⇒ Object
Also known as:
isObject
395
396
397
398
399
|
# File 'lib/deftones.rb', line 395
def is_object(value)
return false if value.nil? || is_array(value) || is_string(value) || is_number(value) || is_boolean(value)
true
end
|
.is_string(value) ⇒ Object
Also known as:
isString
401
402
403
|
# File 'lib/deftones.rb', line 401
def is_string(value)
value.is_a?(String)
end
|
.is_undef(value) ⇒ Object
Also known as:
isUndef
405
406
407
|
# File 'lib/deftones.rb', line 405
def is_undef(value)
value.nil?
end
|
.listener ⇒ Object
193
194
195
|
# File 'lib/deftones.rb', line 193
def listener
@listener ||= Listener.new
end
|
.load_wavify! ⇒ Object
442
443
444
445
446
447
448
449
450
451
452
453
454
|
# File 'lib/deftones.rb', line 442
def load_wavify!
return true if defined?(Wavify::Core::SampleBuffer) && defined?(Wavify::Codecs::Wav)
require "wavify/errors"
require "wavify/core/format"
require "wavify/core/duration"
require "wavify/core/sample_buffer"
require "wavify/codecs/base"
require "wavify/codecs/wav"
true
rescue LoadError
false
end
|
.loaded ⇒ Object
251
252
253
|
# File 'lib/deftones.rb', line 251
def loaded
true
end
|
.master ⇒ Object
409
410
411
|
# File 'lib/deftones.rb', line 409
def master
destination
end
|
.midi(value) ⇒ Object
417
418
419
|
# File 'lib/deftones.rb', line 417
def midi(value)
Music::Midi.new(value)
end
|
.midi_available? ⇒ Boolean
Also known as:
midi_available
.mtof(value) ⇒ Object
360
361
362
|
# File 'lib/deftones.rb', line 360
def mtof(value)
Note.to_frequency(Note.from_midi(value))
end
|
.now ⇒ Object
201
202
203
|
# File 'lib/deftones.rb', line 201
def now
context.current_time
end
|
.offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block) ⇒ Object
228
229
230
231
232
|
# File 'lib/deftones.rb', line 228
def offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2,
buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block)
render(duration: duration, sample_rate: sample_rate, channels: channels, buffer_size: buffer_size,
**render_options, &block)
end
|
.Offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block) ⇒ Object
234
235
236
237
238
|
# File 'lib/deftones.rb', line 234
def Offline(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2,
buffer_size: Context::DEFAULT_BUFFER_SIZE, **render_options, &block)
offline(duration: duration, sample_rate: sample_rate, channels: channels, buffer_size: buffer_size,
**render_options, &block)
end
|
.output ⇒ Object
160
161
162
|
# File 'lib/deftones.rb', line 160
def output
context.output
end
|
.portaudio_available? ⇒ Boolean
.render(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2, buffer_size: Context::DEFAULT_BUFFER_SIZE, seed: nil, metadata: false, progress: nil, cancel: nil, &block) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
# File 'lib/deftones.rb', line 213
def render(duration:, sample_rate: Context::DEFAULT_SAMPLE_RATE, channels: 2,
buffer_size: Context::DEFAULT_BUFFER_SIZE, seed: nil, metadata: false,
progress: nil, cancel: nil, &block)
ctx = OfflineContext.new(
duration: duration,
sample_rate: sample_rate,
channels: channels,
buffer_size: buffer_size
)
with_random_seed(seed) do
block&.call(ctx)
ctx.render(metadata: metadata, progress: progress, cancel: cancel)
end
end
|
.render_to_file(path, duration:, format: nil, streaming: false, **options, &block) ⇒ Object
240
241
242
243
244
245
246
247
248
249
|
# File 'lib/deftones.rb', line 240
def render_to_file(path, duration:, format: nil, streaming: false, **options, &block)
file_options = options.slice(:bit_depth, :dither, :dither_rng)
render_options = options.slice(:seed, :metadata, :progress, :cancel)
context_options = options.reject { |key, _| render_options.key?(key) || file_options.key?(key) }
ctx = OfflineContext.new(duration: duration, **context_options)
with_random_seed(render_options.delete(:seed)) do
block&.call(ctx)
ctx.render_to_file(path, format: format, streaming: streaming, **file_options, **render_options)
end
end
|
.reset! ⇒ Object
263
264
265
266
267
268
269
270
|
# File 'lib/deftones.rb', line 263
def reset!
@context&.stop
@context = nil
Destination.reset!
Draw.reset!
@listener = nil
@transport = nil
end
|
.set_context(new_context) ⇒ Object
Also known as:
setContext
164
165
166
167
168
169
170
171
|
# File 'lib/deftones.rb', line 164
def set_context(new_context)
raise ArgumentError, "context is required" if new_context.nil?
@context&.stop if @context && @context != new_context
@context = new_context
Destination.reset!
self
end
|
.start(use_realtime: true) ⇒ Object
156
157
158
|
# File 'lib/deftones.rb', line 156
def start(use_realtime: true)
context.start(use_realtime: use_realtime)
end
|
.supported?(feature = nil) ⇒ Boolean
Also known as:
supported
298
299
300
301
302
303
304
305
306
|
# File 'lib/deftones.rb', line 298
def supported?(feature = nil)
return true if feature.nil?
normalized = feature.to_sym
available = capabilities
raise ArgumentError, "Unknown capability: #{feature}" unless available.key?(normalized)
available.fetch(normalized)
end
|
.supported_features ⇒ Object
Also known as:
supportedFeatures
312
313
314
|
# File 'lib/deftones.rb', line 312
def supported_features
capabilities.select { |_feature, supported| supported }.keys
end
|
.ticks(value, transport: self.transport) ⇒ Object
425
426
427
|
# File 'lib/deftones.rb', line 425
def ticks(value, transport: self.transport)
Music::Ticks.new(value, transport: transport)
end
|
.time(value) ⇒ Object
421
422
423
|
# File 'lib/deftones.rb', line 421
def time(value)
Music::Time.new(value)
end
|
.transport ⇒ Object
205
206
207
|
# File 'lib/deftones.rb', line 205
def transport
@transport ||= Event::Transport.new
end
|
.transport_time(value, transport: self.transport) ⇒ Object
Also known as:
transportTime
429
430
431
|
# File 'lib/deftones.rb', line 429
def transport_time(value, transport: self.transport)
Music::TransportTime.new(value, transport: transport)
end
|
.unsupported_features ⇒ Object
Also known as:
unsupportedFeatures
316
317
318
|
# File 'lib/deftones.rb', line 316
def unsupported_features
capabilities.reject { |_feature, supported| supported }.keys
end
|
.version ⇒ Object
259
260
261
|
# File 'lib/deftones.rb', line 259
def version
VERSION
end
|
.wavify_available? ⇒ Boolean
Also known as:
wavefile_available?
276
277
278
|
# File 'lib/deftones.rb', line 276
def wavify_available?
load_wavify!
end
|
.with_random_seed(seed) ⇒ Object
433
434
435
436
437
438
439
440
|
# File 'lib/deftones.rb', line 433
def with_random_seed(seed)
return yield if seed.nil?
previous_seed = srand(seed)
yield
ensure
srand(previous_seed) unless seed.nil?
end
|