Class: AudioStream::Fx::AGain

Inherits:
Object
  • Object
show all
Defined in:
lib/audio_stream/fx/a_gain.rb

Instance Method Summary collapse

Constructor Details

#initialize(level:) ⇒ AGain

Returns a new instance of AGain.

Parameters:



5
6
7
8
9
10
11
# File 'lib/audio_stream/fx/a_gain.rb', line 5

def initialize(level:)
  if Decibel===level
    @level = level.mag
  else
    @level = Decibel.db(level).mag
  end
end

Instance Method Details

#process(input) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/audio_stream/fx/a_gain.rb', line 13

def process(input)
  return input if @level==1.0

  streams = input.streams.map {|stream|
    stream * @level
  }
  Buffer.new(*streams)
end