Method: Sidtool::Synth#release!

Defined in:
lib/sidtool/synth.rb

#release!Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sidtool/synth.rb', line 21

def release!
  length_of_attack_decay_sustain = (STATE.current_frame - @start_frame) / FRAMES_PER_SECOND
  if length_of_attack_decay_sustain < @attack
    @attack = length_of_attack_decay_sustain
    @decay, @sustain_length = 0, 0
  elsif length_of_attack_decay_sustain < @attack + @decay
    @decay = length_of_attack_decay_sustain - @attack
    @sustain_length = 0
  else
    @sustain_length = length_of_attack_decay_sustain - @attack - @decay
  end
end