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.



62
63
64
65
66
67
68
69
# File 'lib/beeps/processor.rb', line 62

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



76
77
78
# File 'lib/beeps/processor.rb', line 76

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