Environment: Siren
Peals are repetitive note-generating sequences.
Instance variables:
playing
base
directions
position
finished
play
playOn0: out durations: dur meter: mtr at: start
Play the receiver
playOn: vox
playOn: out durations: dur meter: mtr at: start
Play the receiver
accessing
Answer the element in the base collection currently mapped into the index position.
at: index put: object
currentChange
Answer the base as mapped by the current change.
finished
Answer is the peal has completed it's last change
setBase: baseSet
Initialize the base set and everything else.
size
Redone here because SequencableCollection overrides it.
private
Produce the next change in the peal by moving the element n within the range. If the element wants to move outside the range, alter it's direction and move the next element (recursively call this).
indexOfElement: n
Answer the index the anElement item (i.e. the n-th item, not the item = to n) within the receiver.
swap: index1 with: index2
We need to redefine this, since we redefined at: & at:put: to map trhrough the base collection
changing
Produce the next change in the peal
MetaClass: Peal class
examples
Play a simple bell peal
instance creation
Create a new peal on the given size with 1..size as the base set.
upon: baseSet
Create a new peal on the base set given