Sha256: fedf10b1c2879264ef4cf567e46a7afeffe412b77520c79519bf14a37770ed4a

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

module Clef

  class Channel

    def initialize(number)
      @number     = number
      @expression = Sequence.new([])
    end

    def play(expression)
      @expression = expression
    end

    def to_s
      @expression.to_s
    end

    def to_i
      @number
    end

    def schedule(environment)
      puts "Scheduling channel #{self.to_i} on #{environment}"
      @expression.each_with_index do |playable, time|
        if Harmony === playable
          playable.each do |note|
            environment.schedule_note_on(time, note.to_i, self.to_i, 127)
          end
        else
          environment.schedule_note_on(time, playable.to_i, self.to_i, 127)
        end
      end
    end

  end

end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teejayvanslyke-clef-0.0.0 lib/clef/channel.rb