Class: Beeps::Oscillator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/beeps/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(type = :sine, samples: nil, **kwargs, &block) ⇒ Oscillator

Returns a new instance of Oscillator.



58
59
60
61
62
63
64
65
# File 'lib/beeps/processor.rb', line 58

def initialize(type = :sine, samples: nil, **kwargs, &block)
  super(**kwargs, &block)
  if samples
    self.samples = samples
  else
    self.type = type
  end
end

Instance Method Details

#each_sample(&block) ⇒ Object Also known as: each



72
73
74
# File 'lib/beeps/processor.rb', line 72

def each_sample(&block)
  block ? each_sample!(&block) : enum_for(:each_sample!)
end