Class: Deftones::Effects::Chebyshev
- Inherits:
-
Core::Effect
- Object
- Core::Effect
- Deftones::Effects::Chebyshev
- Includes:
- Oversampling
- Defined in:
- lib/deftones/effect/chebyshev.rb
Constant Summary
Constants included from Oversampling
Oversampling::OVERSAMPLE_FACTORS
Instance Attribute Summary collapse
-
#order ⇒ Object
Returns the value of attribute order.
Attributes included from Oversampling
Attributes inherited from Core::Effect
Instance Method Summary collapse
- #chebyshev(value, order) ⇒ Object private
-
#initialize(order: 3, oversample: 1, **options) ⇒ Chebyshev
constructor
A new instance of Chebyshev.
- #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(order: 3, oversample: 1, **options) ⇒ Chebyshev
Returns a new instance of Chebyshev.
10 11 12 13 14 |
# File 'lib/deftones/effect/chebyshev.rb', line 10 def initialize(order: 3, oversample: 1, **) super(**) @order = [order.to_i, 1].max self.oversample = oversample end |
Instance Attribute Details
#order ⇒ Object
Returns the value of attribute order.
8 9 10 |
# File 'lib/deftones/effect/chebyshev.rb', line 8 def order @order end |
Instance Method Details
#chebyshev(value, order) ⇒ Object (private)
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/deftones/effect/chebyshev.rb', line 24 def chebyshev(value, order) return value if order == 1 previous = value current = (2.0 * value * value) - 1.0 return current if order == 2 3.upto(order) do next_value = (2.0 * value * current) - previous previous = current current = next_value end current end |
#process_effect(input_buffer, _num_frames, _start_frame, _cache, channel_index: 0) ⇒ Object (private)
18 19 20 21 22 |
# File 'lib/deftones/effect/chebyshev.rb', line 18 def process_effect(input_buffer, _num_frames, _start_frame, _cache, channel_index: 0) process_oversampled(input_buffer, channel_index) do |sample| chebyshev(sample.clamp(-1.0, 1.0), @order) end end |