PLser dynamic scope Pser variant
Part of: miSCellaneous
Inherits from: PLseq
Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx suite.
See also: Pser, PLseq, Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (list, repeats, offset, cutItems, envir)
Creates a new PLser object.
list - Symbol or Pser list arg.
If a Symbol is passed, list can be assigned to an envir variable later on.
This lists's elements can be dynamically replaced by Patterns or Streams.
repeats - Symbol or Pser repeats arg. Defaults to inf.
If a Symbol is passed, repeats can be assigned to an envir variable later on.
offset - Symbol or Pser offset arg. Defaults to 0.
If a Symbol is passed, offset can be assigned to an envir variable later on.
cutItems - Symbol or Boolean or Integer (0 or 1) or a Function returning Boolean or Integer.
If a Symbol is passed, cutItems can be assigned to an envir variable later on.
Determines if list items, which are Patterns or Streams themselves,
will be finished if a replacement occurs during their embedding, or if they will be replaced immediately.
The latter is the default behaviour (default value true).
For protecting whole lists from immediate replacements see PLn.
envir - Dictionary or one of the Symbols
\top, \t (topEnvironment), \current, \c (currentEnvironment).
Dictionary to be taken for variable reference. Defaults to \current.
Examples
(
s = Server.local;
Server.default = s;
s.boot;
)
(
// PLseq not used as proxy, only taken as it defaults to repeats = inf
p = Pbind(
\midinote, PLseq([PLser(\a, \r), 60, 61]),
\dur, 0.2
);
// prepare current Environment
~a = (67..70);
~r = 6;
)
x = p.play;
// replace repeats
~r = 3;
// replace array elements
~a[0] = [77, 93.5];
~a[2] = Pseq((94..96));
// replace whole array
~a = [55, 52];
x.stop;
//////////////////////
// placeholder may also get lists of event patterns
(
p = PLser(\a, 3);
~a = [
Pbind(
\midinote, Pwhite(60, 65, 3),
\dur, 0.1
),
Pbind(
\midinote, Pwhite(80, 85, 3),
\dur, 0.1
)
];
x = p.play;
)