PR(\symbol) -- PRocess prototype

A process is an Proto that defines functions needed to maintain a musical stream. The process architecture will be described in another document.

Proto({

~asPattern = #{

SynthDescLib.global.read; // other initialization may take place here too

Pbind(\degree, Pn(Plazy({ Pseq((0..7).scramble, 1) }), inf), \delta, 0.125,

\sustain, 0.16, \instrument, \default);

};

}) => PR(\simplePbind);

Event.default => PR(\simplePbind); // set the event prototype

Now, this example is a bit stupid because you could just write the Pbind and play it as is. PRs have more flexibility, though, because the pattern may be defined in terms of other functions held in the Proto. You can change the behavior of the process dramatically by changing environment variables within the Proto, even while playing. See the scwork/chucklib/startup##.rtf files for one architecture that does this. and the [ChuckExamples] helpfile for some sample usage scenarios.

PR is meant for storage only. Copies of PR Protos are made for play, and held in the [BP] storage class.

When you put a Proto into a PR, some special variables and methods are added to support features of BP. Thus, while it's possible to chuck a Proto directly into a BP, you might miss out on a few nifty toys that way.

Default methods added by PR:

~canStream: checks whether the process is ready to play by verifying that each of the environment variables named in requiredKeys has a value. (If this is absent, the BP assumes it's ready to play.)

~putAction: Automatically updates BPStreams when a new pattern is assigned. Without this, replaceable streams will not work.

You will not need to call these methods directly, but they should be there for support reasons.