Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 29 lines (26 sloc) 0.636 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
module Archaeopteryx
  class Bassline
    def initialize(attributes)
      @mutation = attributes[:mutation]
      @drumfile = attributes[:drumfile]
      reload
    end
    def reload
      @drums = eval(File.read(@drumfile))
    end
    def mutate(measure)
      if @mutation[measure]
        reload # reloading can kill mutations!
        @drums.each {|drum| drum.mutate}
      end
    end
    def notes(beat)
      @drums.each do |drum|
        if drum.play? beat
          return drum.note
        end
      end
      [] # I can't tell if this is a bug or a feature. lispy listiness requires return empty list.
    end
  end
end


Something went wrong with that request. Please try again.