PSdup:
Filter:
miSCellaneous_lib/Classes (extension) | Libraries > miSCellaneous > PSx stream patterns | Streams-Patterns-Events > PSx stream patterns

PSdup
ExtensionExtension

Pattern which returns last values from other patterns via PSx

Description

PSdup uses the storage functionality of other PSx patterns. To track a value stream or event stream from a pattern you'd have to wrap the pattern into a PSx.

Class Methods

.new

Creates a new PSdup object.

Arguments:

psxPat

Source pattern, must be a PSx pattern.

length

Number of output items, may be pattern or stream, defaults to inf.

bufSize

Size of buffer to store last values, defaults to 1.

copyItems

Determines if and how to copy the last items from psxPat's buffer which are either non-Sets or member of Sets. Takes Integer 0 (or false or Symbol \false), 1 (or true or Symbol \true) or 2 (or Symbol \deep). Other values are interpreted as 0. Defaults to 0.

0: original item

1: copy item

2: deepCopy item

copySets

Determines if and how to copy the last items from psxPat's buffer which are Sets. Takes Integer 0 (or false or Symbol \false), 1 (or true or Symbol \true). Other values are interpreted as 0. Defaults to 1.

0: original Set

1: copy Set

NOTE: The distinction of copying items and sets makes sense in the case of event streams. Per default Events are copied (copySets == 1), not their values (copyItems == 0). By playing Events those are used to store additional data (synth ids, msgFuncs …) which is mostly not of interest when refering to the event stream, e.g. with PSx patterns which use MemoRoutine - copied Events will not contain this additional data. If values of Events or values returned directly by the stream (being no kind of Sets) are unstructured then copying makes no sense, this is the normal case, so copyItems defaults to 0. When going to alter the ouput, you might want to set copyItems to 1 for a PSx returning simple arrays or 2 for nested arrays (deepCopy). For deepCopying Events you'd have to set copySets to 1 and copyItems to 2 (an option copySets == 2 doesn't exist as it would be contradictory in combination with copyItems < 2).
NOTE: Copy options concern copying into PSdup's buffer as well as the output of a Stream derived from the PSdup. When such a Stream is outputting copies this prevents unintended altering of items stored in the buffer of psxPat. On the other hand storing copies in PSdup's buffer prevents these from being altered unintendedly.

Instance Methods

.psxPat

Instance variable getter and setter methods.

Examples