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
# File 'lib/audio_stream/fx/a_gain.rb', line 5

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

Instance Method Details

#process(input) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/audio_stream/fx/a_gain.rb', line 9

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

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