class Sidtool::Sid

Public Class Methods

new() click to toggle source
# File lib/sidtool/sid.rb, line 3
def initialize
  @voices = [Voice.new, Voice.new, Voice.new]

  @frequency_low = @frequency_high = 0
  @pulse_low = @pulse_high = 0
  @control_register = 0
  @attack_decay = @sustain_release = 0
end

Public Instance Methods

finish_frame() click to toggle source
# File lib/sidtool/sid.rb, line 39
def finish_frame
  @voices.each(&:finish_frame)
end
poke(register, value) click to toggle source
# File lib/sidtool/sid.rb, line 12
def poke(register, value)
  if register >= 0 && register <= 6
    voice = @voices[0]
  elsif register >= 7 && register <=13
    voice = @voices[1]
    register -=7
  elsif register >= 14 && register <=20
    voice = @voices[2]
    register -=14
  end

  case register
  when 0 then voice.frequency_low = value
  when 1 then voice.frequency_high = value
  when 2 then voice.pulse_low = value
  when 3 then voice.pulse_high = value
  when 4 then voice.control_register = value
  when 5 then voice.attack_decay = value
  when 6 then voice.sustain_release = value
    # 7-20 are covered by the mapping above
  when 21 then @cutoff_frequency_low = value
  when 22 then @cutoff_frequency_high = value
  when 23 then @resonance_filter = value
  when 24 then @mode_volume = value
  end
end
stop!() click to toggle source
# File lib/sidtool/sid.rb, line 43
def stop!
  @voices.each(&:stop!)
end
synths_for_voices() click to toggle source
# File lib/sidtool/sid.rb, line 47
def synths_for_voices
  @voices.map(&:synths)
end