Classes | Server > Nodes | Server > Abstractions

ParGroup : AbstractGroup : Node : Object

Client-side representation of a parallel group node on the server
Source: Node.sc

Description

Parallel Groups are server-side node containers that work similar to Groups, but without ordering constraints for the contained nodes. This means that on parallel architectures the elements of a Parallel Group can be executed concurrently.

Class Methods

Creation with Immediate Instantiation on the Server

ParGroup.new(target, addAction: 'addToHead')

From superclass: AbstractGroup

Create and return a Group.

Arguments:

target

A target for this Group. If target is not a Group or Synth, it will be converted as follows: If it is a Server, it will be converted to the default_group of that server. If it is nil, to the default_group of the default Server.

addAction

one of the following Symbols:

\addToHead(the default) add at the head of the group specified by target
\addToTailadd at the tail of the group specified by target
\addAfteradd immediately after target in its server's node order
\addBeforeadd immediately before target in its server's node order
\addReplacereplace target and take its place in its server's node order

Note: A Synth is not a valid target for \addToHead and \addToTail.

Discussion:

s.boot;
g = Group.new; // add a Group at the head of the default Server's default group
h = Group.new(g, \addAfter);
s.queryAllNodes; // note the Group within the default group (ID 1)
g.free; h.free;

Convenience methods for add actions

The following convenience methods correspond to the add actions above:

ParGroup.after(aNode)

From superclass: AbstractGroup

Create and return a Group and add it immediately after aNode.

ParGroup.before(aNode)

From superclass: AbstractGroup

Create and return a Group and add it immediately before aNode.

ParGroup.head(aGroup)

From superclass: AbstractGroup

Create and return a Group. If aGroup is a Group add it at the head of that group. If it is a Server, add it at the head of the default_group of that server. If it is nil, add it at the head of the default_group of the default Server.

ParGroup.tail(aGroup)

From superclass: AbstractGroup

Create and return a Group. If aGroup is a Group add it at the tail of that group. If it is a Server, add it at the tail of the default_group of that server. If it is nil, add it at the tail of the default_group of the default Server.

ParGroup.replace(nodeToReplace)

From superclass: AbstractGroup

Create and return a Group and use it to replace nodeToReplace, taking its place in its server's node order.

Creation without Instantiation on the Server

Like with Groups, it is possible to create a a ParGroup object without immediately creating a parallel group in the server.

ParGroup.basicNew(server, nodeID)

From superclass: Node

Create and return a ParGroup object without creating a group node on the server. (This method is inherited from Node and is documented here only for convenience.)

Arguments:

server

An optional instance of Server. If nil this will default to the default Server.

nodeID

An optional node ID number. If not supplied one will be generated by the Server's NodeIDAllocator. Normally you should not need to supply an ID.

Discussion:

For a detailed discussion please refer to Group: *basicNew.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

fork {
    p = ParGroup.new;
    loop {
        (
            degree: rrand(0.0, 12.0).round(1/4),
            group: p,
            db: rrand(-30, -25),
            pan: rrand(-1.0, 1.0)
        ).play;
        0.2.wait;
    }
}