ExtensionGenericGlobalControl is a placeholder for a numeric value, synchronized between the language and the server. Because it is synchronized, it may be used interchangeably in math operations, patterns and synths.
GenericGlobalControl supports the following uses (assuming g is a GenericGlobalControl):
.gui to embed the GenericGlobalControl in a crucial-library style GUI. Also, a GenericGlobalControl sends a notification to dependents when its value changes, so you can easily use it as a model in your own Model-View-Controller (MVC) scheme.g + 2 is the same as g.value + 2.Pbind(\g, g) is the same as Pbind(\g, Pfunc { g.value }).Synth(\default, [freq: g]) is the same as Synth(\default, [freq: g.asMap]).kr message to read the bus with In (optionally wrapping itself in a Lag): SinOsc.ar(g) is the same as SinOsc.ar(In.kr(g.bus, 1)).GenericGlobalControl also supports automation, by playing a control-rate synth onto its bus.
Most methods are defined in GlobalControlBase, but documented here.
GenericGlobalControl uses Events for notifications, so that additional data may be added later without breaking the argument signature, e.g.:
Dependants' update methods traditionally receive object, what ... args. GenericGlobalControl notifications pass the event to what. Within the event, the \what key holds an identifier for the type of notification.
GenericGlobalControl broadcasts the following notifications on state changes:
\value(what: \value, updateGUI: updateGUI, resync: resync, updateBus: false); use object.value to get the new value.\modelWasFreed\spec(what: \spec, updateGUI: updateGUI).\midi(what: \midi).Create a new GenericGlobalControl. The server must be booted.
| name |
The name (generally a Symbol) to identify the value in GUIs. |
| bus |
(Optional) You may provide a specific control bus -- as a Bus instance (a number is not allowed here). If If you want to use a non-default server, you must provide a Bus instance. |
| value |
The initial value: float or integer. |
| spec |
A ControlSpec (or any object responding to |
| allowGUI |
For subclasses. If true, this control may appear in GUIs. If false, it may be omitted. VoicerGlobalControl uses this flag. GenericGlobalControl does not. |
| ... extraArgs |
For subclasses. |
The lag time assigned to new GenericGlobalControls during initialization. See GenericGlobalControl: -lag.
The current default lag (float, in seconds).
Stop active automation, and release the control bus index. (Note: If automation is ongoing, the bus number will not be released until a /n_end message is received from the server indicating that the automation synth has stopped. This is to prevent the old automation synth from writing values onto a bus number that may be reassigned for another use.)
| updateGUI |
Deprecated argument. Not used. |
Get or set the control's value. Sends a \value notification.
Set the control's value. (This is the implementation of the value_.) Stops any active automation, and sends a \value notification.
| val |
The new value (float or integer). |
| updateGUI |
Internal use. Pass |
| latency |
Optional. If a float is given, this is used as OSC messaging latency for the |
| resync |
A flag, passed on in the notification, telling associated MIDI controllers whether to reset any sync information. |
A synonym for set.
| v |
The new value (float or integer). |
Sets the GenericGlobalControl's language-side value variable, without touching the control bus or notifying any dependence (e.g. GUIs). Generally internal use only.
| val |
The new value (float or integer). |
Constructs a /c_set message to update the control bus. Useful if you are building your own message bundles.
| val |
Deprecated argument. Not used. |
An array containing a /c_set message.
Get the control's value, normalized to the range 0-1.
Get or set the name.
Get the control Bus instance.
Get the bus number (integer).
Get or set the ControlSpec.
| newSpec |
A ControlSpec, or anything that responds to |
| updateGUI |
Boolean. If true, notify dependants to update the display to match the new range. |
Set the lag time to apply in the GenericGlobalControl: -kr method. New lag times apply only to new kr calls; they do not update previously-created SynthDefs (because the lag time is hardcoded).
The bus's server.
Get the flag that permits the control to be displayed, e.g., in a Voicer GUI.
Boolean.
Boolean. True if the GenericGlobalControl still exists in the server; false after it has been freed.
Returns the control bus.
Returns a mapping symbol for use in Synth argument lists. See Bus: -asMap.
Synonyms for asMap.
Returns a Pattern, which polls the control's current value for every "next" call: Pfunc { this.value }.
For convenience, returns a Stream based on the pattern from GenericGlobalControl: -asPattern -- this.asPattern.asStream.
This method is called when preparing an argument list for Synth messaging -- so, it returns the mapping string as in GenericGlobalControl: -asMap.
Returns an In reading from the control bus. If the GenericGlobalControl's GenericGlobalControl: -lag is not nil, the In will be wrapped in a Lag for smoothing.
This method is called on all inputs to UGens -- so, it returns an In reading from the control bus as in kr.
A GenericGlobalControl can maintain a Synth to "automate" the control's value. This is not exactly the same thing as automation in a DAW, because it is not based on control points pinned to a timeline. (If you need to control points, you can play an EnvGen onto the control.)
Play a Synth or other object on the bus. Generally you should use this method, because it tracks the automation player. Also, if you already have automation running and you call automate, it will automatically stop the old automation player. This way is much better for safety.
| thing |
Anything that responds to
|
| args |
Argument list. |
| target |
The target for node positioning (default is the server's defaultGroup). |
| addAction |
See Synth: *new. |
The new automation player, a Synth or crucial-library player, depending on the thing.
As a getter, returns the current automation player.
As a setter, stops any currently running automation player and sets the autoSynth variable to the new node. Normally, you will not call autoSynth_ yourself; use GenericGlobalControl: -automate instead. However, there may be rare cases in which to create an automation player manually. In those cases, use autoSynth_ for tracking. Your player should respond to free.
Stop any current automation.
"Watch" for value changes on the server's control bus. While automating, the global control's value is changing in the server; the language does not automatically synchronize (because this requires repeated server requests, and you might not need it).
watch adds the control bus to a KrBusWatcher and updates the control's value based on notifications from the bus watcher. The global control will also send \value notifications, for GUI updates.
Typical idiom: g.watch.automate({ ..... });.
| count |
Several objects might be interested in the control's "watching" status. |
Tells the global control that the caller is not interested in syncing to the server value anymore. The count of current "watch-watchers" will be decreased. When it reaches 0, the bus will be removed from the KrBusWatcher.
| count |
The number to subtract from the current count. If 0, it will hard-stop all watching. Otherwise, your client object should pass the same number that you passed earlier to |
Simply plays the thing on the control's bus (using playOnGlobalControl). No tracking is done. You should consider this a private method: use GenericGlobalControl: -automate instead.