class Midistack

Attributes

done[R]
echostack[R]
stack[R]
ticker[R]

Public Class Methods

done=(val) click to toggle source
# File lib/melody_object/Mo_h_hc.rb, line 109
def self.done=(val)
  @done=val

end
feed(bouncer) click to toggle source
# File lib/melody_object/Mo_h_hc.rb, line 104
def self.feed(bouncer)
 @stack.push bouncer    unless bouncer.val.nil?

end
harvestechostack() click to toggle source
# File lib/melody_object/Mo_h_hc.rb, line 114
def self.harvestechostack
  @echostack.each{|i|
  #~ puts "  cycling through #{i.val}"
   if i.inc==3
     #~ puts "    pushing to @stack #{i.val}"
     i.inc=0
     i.running=false
     @stack.push i unless i.val.nil?
   else
     i.inc+=1
   end}
end
play() click to toggle source
# File lib/melody_object/Mo_h_hc.rb, line 127
def self.play
      #~ harvestechostack
  unless @internaldone
      @stack.each {|d| 
      d.inc+=1

              if d.turned_on==false 
                d.turned_on=true
                #~ puts d.chn
                
                gaga=(d.chn==9) ? 120 : 60
                #~ puts gaga
                $midi.note_on(d.val,d.chn,gaga)
                if d.chn==0
                  e=d.uf
                  e.inc=0
                  e.turned_on=false
                  @echostack.push e if e.running
                  #~ puts "pushing to echostack #{e.val}"
                end
                 #~ $fyl.puts "#{d.val} #{d.chn} #{@ticker}"
                   #~ puts "#{d.val} #{d.chn} #{@ticker}"
                 #~ $fyl2.puts "#{d.val} #{d.chn} #{@ticker}"
                #~ puts "#{d.val} #{d.chn} #{@ticker}"
              elsif d.inc>d.leng
                $midi.note_off(d.val,d.chn,100)
                d.del=true
              end
      }
            @stack.delete_if {|d| d.del}
  
            if @done
                @internaldone=true
                #~ sleep($g)
            @stack.each {|d| $midi.note_off(d.val,d.chn,100)} 
            end
  @ticker+=1
  #~ puts "ticker:#{@ticker}"
  else
  @internaldone=false
end
#~ $fyl.puts " "
#~ puts " "
end