Class: Peal

Environment: Siren
Superclass: SequenceableCollection
Category: Music-EventGenerators
Instance variables: base directions position finished
Indexed variables: objects

Peals are repetitive note-generating sequences.
This implementation was written by Mark Lentczner in 1986.

Instance variables:
base the pitches i use
directions the direction of the current sub-sequence
position the current index
finished an i done?

playing

eventList

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

at: index
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

changeOrder: n bounds: range
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

change
Produce the next change in the peal

MetaClass: Peal class

examples

pealExample1
Play a simple bell peal

instance creation

new: size
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