Class: Deftones::Effects::Distortion

Inherits:
Core::Effect show all
Includes:
Oversampling
Defined in:
lib/deftones/effect/distortion.rb

Constant Summary

Constants included from Oversampling

Oversampling::OVERSAMPLE_FACTORS

Instance Attribute Summary collapse

Attributes included from Oversampling

#oversample

Attributes inherited from Core::Effect

#wet

Instance Method Summary collapse

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, **options)
  super(**options)
  @amount = amount.to_f
  self.oversample = oversample
end

Instance Attribute Details

#amountObject

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