Class: Repeater

Inherits:
Object
  • Object
show all
Defined in:
lib/midinous/points.rb

Overview

A repeater handles notes that are set to repeat/arpeggiate. This logic is currently FUCKED

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(srce, count, played_note) ⇒ Repeater

Returns a new instance of Repeater.



1054
1055
1056
1057
1058
1059
# File 'lib/midinous/points.rb', line 1054

def initialize(srce,count,played_note)
	@srce   = srce
	@dur    = srce.duration
	@timer  = (count * @dur)
	@played_note = played_note
end

Instance Attribute Details

#removeObject (readonly)

Returns the value of attribute remove.



1053
1054
1055
# File 'lib/midinous/points.rb', line 1053

def remove
  @remove
end

Instance Method Details

#play_noteObject



1074
1075
1076
1077
1078
# File 'lib/midinous/points.rb', line 1074

def play_note
	queued_notes = []
	CC.queued_note_plays.each {|q| queued_notes << [q.note,q.chan]}
	CC.queued_note_plays << NoteSender.new(@played_note,@srce.channel,@srce.velocity) unless queued_notes.find {|f| @played_note == f[0] && @srce.channel == f[1]}
end

#repeatObject



1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
# File 'lib/midinous/points.rb', line 1061

def repeat
	if @timer == 0
		CC.queued_note_stops << NoteSender.new(@played_note,@srce.channel,0)
		@srce.repeating = false
		@remove = true
	end
	unless @remove == true	
		@srce.repeating = true
		play_note if @timer % @dur == 0
	end	
	@timer -= 1
end