Skip to content

Commit

Permalink
better return values for live coding
Browse files Browse the repository at this point in the history
  • Loading branch information
arirusso committed Jul 3, 2011
1 parent 5c0a9f7 commit e4665df
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/diamond/arpeggiator_sequence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,58 +56,67 @@ def with_next(&block)
def add(note_messages)
@input_note_messages += [note_messages].flatten
mark_changed
true
end

# remove input note messages with the same note value
# takes a single message or an array
def remove(note_messages)
def remove(note_messages)
@input_note_messages.delete_if do |msg|
deletion_queue = [note_messages].flatten.map { |note_message| note_message.note }
deletion_queue.include?(msg.note)
end
mark_changed
true
end

# remove all input note messages
def remove_all
@input_note_messages.clear
mark_changed
true
end

# set the gate property
def gate=(num)
@gate = constrain(num, :min => 1, :max => 500)
mark_changed
@gate
end

# set the interval property
def interval=(num)
@interval = num
mark_changed
@interval
end

# set the pattern pattern_offset property
def pattern_offset=(num)
@pattern_offset = num
mark_changed
@pattern_offset
end

# set the range property
def range=(num)
@range = constrain(num, :min => 0)
mark_changed
@range
end

# set the rate property
def rate=(num)
@rate = constrain(num, :min => 0, :max => @resolution)
mark_changed
@rate
end

# set the pattern property
def pattern=(pattern)
@pattern = pattern
mark_changed
@pattern
end

# transpose everything by <em>num</em> scale degrees
Expand Down

0 comments on commit e4665df

Please sign in to comment.