Class: DTAS::FadeFX

Inherits:
Object
  • Object
show all
Includes:
ParseTime
Defined in:
lib/dtas/fadefx.rb

Defined Under Namespace

Classes: F

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParseTime

#parse_time

Constructor Details

#initialize(args) ⇒ FadeFX

Returns a new instance of FadeFX.



11
12
13
14
15
16
17
18
# File 'lib/dtas/fadefx.rb', line 11

def initialize(args)
  args =~ /\Afade=([^,]*),([^,]*);([^,]*),([^,]*)\z/ or
    raise ArgumentError, "bad fade format"
  fades = [ $1, $2, $3, $4 ]
  %w(out_prev in_main out_main in_next).each do |iv|
    instance_variable_set("@#{iv}", parse!(fades.shift))
  end
end

Instance Attribute Details

#in_mainObject (readonly)

Returns the value of attribute in_main.



8
9
10
# File 'lib/dtas/fadefx.rb', line 8

def in_main
  @in_main
end

#in_nextObject (readonly)

Returns the value of attribute in_next.



8
9
10
# File 'lib/dtas/fadefx.rb', line 8

def in_next
  @in_next
end

#out_mainObject (readonly)

Returns the value of attribute out_main.



8
9
10
# File 'lib/dtas/fadefx.rb', line 8

def out_main
  @out_main
end

#out_prevObject (readonly)

Returns the value of attribute out_prev.



8
9
10
# File 'lib/dtas/fadefx.rb', line 8

def out_prev
  @out_prev
end

Instance Method Details

#parse!(str) ⇒ Object

q - quarter of a sine wave h - half a sine wave t - linear (‘triangular’) slope l - logarithmic p - inverted parabola default is ‘t’ (sox defaults to ‘l’, but triangular makes more sense when concatenating



27
28
29
30
31
# File 'lib/dtas/fadefx.rb', line 27

def parse!(str)
  type = "t"
  str.sub!(/\A([a-z])/, "") and type = $1
  F[type, parse_time(str)]
end