Class: GotimeObject

Inherits:
Object
  • Object
show all
Defined in:
lib/melody_object/Mo_h_hc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(v) ⇒ GotimeObject

Returns a new instance of GotimeObject.



56
57
58
59
60
61
62
63
64
65
# File 'lib/melody_object/Mo_h_hc.rb', line 56

def initialize(v)
  if v.class==Fixnum
    @val=v
    @internalgranularity=v
     @curraryval=0
  else
    @gotimary=v
    @curraryval=0
  end
end

Instance Attribute Details

#curraryvalObject

Returns the value of attribute curraryval.



54
55
56
# File 'lib/melody_object/Mo_h_hc.rb', line 54

def curraryval
  @curraryval
end

#gotimaryObject

Returns the value of attribute gotimary.



53
54
55
# File 'lib/melody_object/Mo_h_hc.rb', line 53

def gotimary
  @gotimary
end

#internalgranularityObject

Returns the value of attribute internalgranularity.



51
52
53
# File 'lib/melody_object/Mo_h_hc.rb', line 51

def internalgranularity
  @internalgranularity
end

#offsetObject

Returns the value of attribute offset.



52
53
54
# File 'lib/melody_object/Mo_h_hc.rb', line 52

def offset
  @offset
end

#valObject

Returns the value of attribute val.



50
51
52
# File 'lib/melody_object/Mo_h_hc.rb', line 50

def val
  @val
end

Instance Method Details

#granularityObject



67
68
69
# File 'lib/melody_object/Mo_h_hc.rb', line 67

def granularity
  @internalgranularity#+rand(2)
end

#statusObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/melody_object/Mo_h_hc.rb', line 71

def status
 if @gotimary.nil?
  if Midistack.ticker==0
    #~ puts 'zero'
    return true 
    else
      #~ puts 'slipped'
   x=Midistack.ticker%@internalgranularity==0
   #~ if x then puts 'yeh' end
    return x
  end
 else
  #~ puts "mt:#{Midistack.ticker} os:#{@offset} cv#{@curraryval}  cvv#{@gotimary[@curraryval]}  t/f: #{Midistack.ticker-@offset==@gotimary[@curraryval]-1}"
  #~ $fyl.puts " #{@offset}, #{@curraryval}, len:#{@gotimary.length} #{@gotimary[@curraryval]}"
  #~ return Midistack.ticker-@offset==@gotimary[@curraryval]-1
 end
end