Class: Chaussettes::EffectChain
- Inherits:
-
Object
- Object
- Chaussettes::EffectChain
- Defined in:
- lib/chaussettes/effect_chain.rb
Overview
A chain of effects to apply
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
Instance Method Summary collapse
- #fade(in_len, stop_at = nil, out_len = nil, type: nil) ⇒ Object
- #gain(db, *opts) ⇒ Object
-
#initialize ⇒ EffectChain
constructor
A new instance of EffectChain.
- #newfile ⇒ Object
- #pad(length, position = nil) ⇒ Object
- #restart ⇒ Object
- #synth(length = nil, type = nil, &block) ⇒ Object
- #trim(*positions) ⇒ Object
- #vol(gain, type: nil, limitergain: nil) ⇒ Object
Constructor Details
#initialize ⇒ EffectChain
Returns a new instance of EffectChain.
12 13 14 |
# File 'lib/chaussettes/effect_chain.rb', line 12 def initialize @commands = [] end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
10 11 12 |
# File 'lib/chaussettes/effect_chain.rb', line 10 def commands @commands end |
Instance Method Details
#fade(in_len, stop_at = nil, out_len = nil, type: nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/chaussettes/effect_chain.rb', line 16 def fade(in_len, stop_at = nil, out_len = nil, type: nil) effect = Effect::Fade.new(in_len, stop_at, out_len, type: type) @commands.concat(effect.commands) self end |
#gain(db, *opts) ⇒ Object
22 23 24 25 26 |
# File 'lib/chaussettes/effect_chain.rb', line 22 def gain(db, *opts) effect = Effect::Gain.new(db, *opts) @commands.concat(effect.commands) self end |
#newfile ⇒ Object
28 29 30 31 |
# File 'lib/chaussettes/effect_chain.rb', line 28 def newfile @commands << 'newfile' self end |
#pad(length, position = nil) ⇒ Object
33 34 35 36 37 |
# File 'lib/chaussettes/effect_chain.rb', line 33 def pad(length, position = nil) length = "#{length}@#{position}" if position @commands << 'pad' << length self end |
#restart ⇒ Object
39 40 41 42 |
# File 'lib/chaussettes/effect_chain.rb', line 39 def restart @commands << 'restart' self end |
#synth(length = nil, type = nil, &block) ⇒ Object
44 45 46 47 48 |
# File 'lib/chaussettes/effect_chain.rb', line 44 def synth(length = nil, type = nil, &block) effect = Effect::Synth.new(length, type, &block) @commands.concat(effect.commands) self end |
#trim(*positions) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/chaussettes/effect_chain.rb', line 50 def trim(*positions) if positions.empty? raise ArgumentError, 'you must specify at least one position for trim' end @commands << 'trim' @commands.concat(positions) self end |