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.



88
89
90
91
92
93
94
95
# File 'lib/beeps/processor.rb', line 88

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



102
103
104
105
# File 'lib/beeps/processor.rb', line 102

def each_sample(&block)
  return enum_for :each_sample unless block
  each_sample!(&block)
end

#samplesObject



109
110
111
# File 'lib/beeps/processor.rb', line 109

def samples()
  to_a
end