Class: Deftones::Effects::Distortion
- Inherits:
-
Core::Effect
- Object
- Core::Effect
- Deftones::Effects::Distortion
- Includes:
- Oversampling
- Defined in:
- lib/deftones/effect/distortion.rb
Constant Summary
Constants included from Oversampling
Oversampling::OVERSAMPLE_FACTORS
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
Attributes included from Oversampling
Attributes inherited from Core::Effect
Instance Method Summary collapse
-
#initialize(amount: 0.5, oversample: 1, **options) ⇒ Distortion
constructor
A new instance of Distortion.
- #process_effect(input_buffer, _num_frames, _start_frame, _cache, channel_index: 0) ⇒ Object private
Methods included from Oversampling
#ensure_oversample_state, #process_oversampled
Methods inherited from Core::Effect
#multichannel_process?, #normalize_channel_output, #process, #process_effect_block
Constructor Details
#initialize(amount: 0.5, oversample: 1, **options) ⇒ Distortion
Returns a new instance of Distortion.
10 11 12 13 14 |
# File 'lib/deftones/effect/distortion.rb', line 10 def initialize(amount: 0.5, oversample: 1, **) super(**) @amount = amount.to_f self.oversample = oversample end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
8 9 10 |
# File 'lib/deftones/effect/distortion.rb', line 8 def amount @amount end |
Instance Method Details
#process_effect(input_buffer, _num_frames, _start_frame, _cache, channel_index: 0) ⇒ Object (private)
18 19 20 21 |
# File 'lib/deftones/effect/distortion.rb', line 18 def process_effect(input_buffer, _num_frames, _start_frame, _cache, channel_index: 0) drive = 1.0 + (@amount * 20.0) process_oversampled(input_buffer, channel_index) { |sample| DSP::Helpers.soft_clip(sample, drive) } end |