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.



1097
1098
1099
1100
1101
1102
# File 'lib/midinous/points.rb', line 1097

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.



1096
1097
1098
# File 'lib/midinous/points.rb', line 1096

def remove
  @remove
end

Instance Method Details

#play_noteObject



1117
1118
1119
1120
1121
# File 'lib/midinous/points.rb', line 1117

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,@srce.mute) unless queued_notes.find {|f| @played_note == f[0] && @srce.channel == f[1]}
end

#repeatObject



1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
# File 'lib/midinous/points.rb', line 1104

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