Class:            ConditionalDuration

Environment:      Siren
Superclass:         Siren.MusicMagnitude
Category:         Music-Models-Implementation

Instances of ConditionalDuration are duration times where the value is a block.
The accessing protocol allows them to be spawned as co-processes in schedulers.
The valueAt: and waitUntil: methods allow flexible conditional scheduling.
ConditionalDurations can be made dependents of other objects using the until: instance creation message.

See the class examples.

updating

update: anAspect with: aValue
   Respond to a change in the receiver's model

accessing

valueAt: anArg
   Answer the result of passing the argument to the receiver's block.

wait
   Cycle the receiver until the argument fulfills the receiver's block.

waitUntil: anArg
   Cycle the receiver until the argument fulfills the receiver's block.

private

species
   Answer Duration.

converting

mostGeneral
   It is an error to try this here--we implement what's ok for CDs

arithmetic

* aValue
   Answer that it is an error to attempt arithmetic with this magnitude.

+ aDuration
   Answer the sum of the receiver and the argument--the composition of two blocks

- aValue
   Answer that it is an error to attempt arithmetic with this magnitude.

/ aValue
   Answer that it is an error to attempt arithmetic with this magnitude.

MetaClass:         ConditionalDuration class

instance creation

on: aModel until: boolBlock
   Answer a new conditional duration whose value is the given block

randomBetween: lo and: hi
   Answer a new conditional duration whose value is between lo and hi (given in seconds)

until: boolBlock
   Answer a new conditional duration whose value is the given block

examples

example
   Print a simple message to the transcript demonstrating the various types.

exampleWithRands
   Demonstrate the random duration