Class: Tone::Synth::Base

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
lib/tone/synth.rb

Direct Known Subclasses

AM, Duo, FM, Membrane, Metal, Mono, Noise, Pluck, Poly, Simple

Instance Method Summary collapse

Constructor Details

#initialize(native, volume: 1) ⇒ Base

Returns a new instance of Base.



23
24
25
26
# File 'lib/tone/synth.rb', line 23

def initialize(native, volume: 1)
  @native = native
  `#@native.volume.value = volume`
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
# File 'lib/tone/synth.rb', line 32

def ==(other)
  volume == other.volume &&
    self.class == other.class
end

#chain(*effects) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/tone/synth.rb', line 12

def chain(*effects)
  last_node_connected = self

  effects.each do |effect|
    last_node_connected.connect(effect.to_n)
    last_node_connected = effect
  end

  last_node_connected.connect(`Tone.Master`)
end

#volumeObject



28
29
30
# File 'lib/tone/synth.rb', line 28

def volume
  `#@native.volume.value`
end