Class: Mixer

Inherits:
Object show all
Defined in:
lib/mixer.rb

Overview

mixes two tracks together or plays one or the other

Class Method Summary collapse

Class Method Details

.get(first, second, reduction) ⇒ Object

get volumes at a position



6
7
8
9
10
11
12
13
14
# File 'lib/mixer.rb', line 6

def self.get(first, second, reduction)
  reduction2 = reduction > 1 ? 1 : reduction
  reduction1 = reduction * 2
  reduction1 = 0 if reduction1 < 1 
  reduction1 -= 1 if reduction1 >= 1 
  f=first * (1.0 - reduction1)
  s=second * reduction2
  f+s
end