Patch
Extends:
Patch class, contains all operators,values,links etc. manages loading and running of the whole patch
see PatchConfig
Example:
CABLES.patch=new CABLES.Patch(
{
patch:pStr,
glCanvasId:'glcanvas',
glCanvasResizeToWindow:true,
canvas:{powerPreference:"high-performance"},
prefixAssetPath:'/assets/',
prefixJsPath:'/js/',
onError:function(e){console.log(e);}
glslPrecision:'highp'
});
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
aborted: boolean |
|
public |
animFrameCallbacks: *[] |
|
public |
animFrameOps: *[] |
|
public |
cgCanvas: * |
|
public |
cgl: * |
|
public |
cgp: * |
|
public |
config: * |
|
public |
deSerialized: boolean |
|
public |
freeTimer: * |
|
public |
gui: boolean |
|
public |
loading: * |
|
public |
name: * |
|
public |
namedTriggers: {} |
|
public |
namespace: * |
|
public |
|
|
public |
ops: *[] |
|
public |
profiler: * |
|
public |
reqAnimTimeStamp: number |
|
public |
settings: {} |
|
public |
silent: * |
|
public |
storeObjNames: boolean |
|
public |
tempData: * |
|
public |
timer: * |
|
public |
vars: {} |
Private Members | ||
private |
_animReq: * |
|
private |
_crashedOps: *[] |
|
private |
_frameInterval: number |
|
private |
_frameNext: number |
|
private |
_frameNum: number |
|
private |
_frameWasdelayed: boolean |
|
private |
_isLocal: * |
|
private |
_lastFrameTime: number |
|
private |
_log: * |
|
private |
_opIdCache: {} |
|
private |
_origData: * |
|
private |
_paused: boolean |
|
private |
_renderOneFrame: boolean |
|
private |
_subpatchOpCache: {} |
|
private |
_triggerStack: *[] |
|
private |
_variableListeners: *[] |
|
private |
_variables: {} |
|
private |
_volumeListeners: *[] |
Method Summary
Public Methods | ||
public |
addOnAnimFrame(op: *) |
|
public |
addOnAnimFrameCallback(cb: *) |
|
public |
addOp(opIdentifier: string, uiAttribs: Object, id: string, fromDeserialize: boolean, opName: string): * create a new op in patch |
|
public |
clear() |
|
public |
createOp(identifier: *, id: *, opName: undefined): * |
|
public |
deSerialize(obj: *, options: *) |
|
public |
deleteOp(opid: *, tryRelink: *, reloadingOp: *) |
|
public |
deleteVar(name: *) |
|
public |
dispose() |
|
public |
emitOnAnimFrameEvent(time: *, delta: *) |
|
public |
exec(timestamp: *) |
|
public |
getAssetPath(patchId: *): string get asset path |
|
public |
getDocument(): Object returns document object of the patch could be != global document object when opening canvas ina popout window |
|
public |
getFPS(): Number current number of frames per second |
|
public |
getFilePath(filename: String): String get url/filepath for a filename this uses prefixAssetpath in exported patches |
|
public |
getFirstSubPatchOpByName(patchId: *, objName: *): boolean |
|
public |
getFrameNum(): * |
|
public |
getJsPath(): string get js path |
|
public |
getOpById(opid: *): * |
|
public |
getOpsByName(name: *): * |
|
public |
getOpsByObjName(name: *): * |
|
public |
getOpsByOpId(opid: *): * |
|
public |
getOpsByRefId(refId: *): * |
|
public |
getSubPatchOp(patchId: *, objName: *): * |
|
public |
getSubPatchOpsByName(patchId: *, objName: *): * |
|
public |
|
|
public |
getVarValue(name: *, val: *): * |
|
public |
|
|
public |
hasVar(name: String): * has variable |
|
public |
isEditorMode(): Boolean returns true if patch is opened in editor/gui mode |
|
public |
isPlaying(): * |
|
public |
isRenderingOneFrame(): * |
|
public |
link(op1: Op, port1Name: String, op2: Op, port2Name: String, lowerCase: boolean, fromDeserialize: boolean): * link two ops/ports |
|
public |
loadLib(which: *) |
|
public |
pause() pauses patch execution |
|
public |
|
|
public |
|
|
public |
|
|
public |
profile(enable: *) |
|
public |
pushTriggerStack(p: *) |
|
public |
removeOnAnimCallback(cb: *) |
|
public |
removeOnAnimFrame(op: *) |
|
public |
renderFrame(timestamp: *) |
|
public |
|
|
public |
resume() resumes patch execution |
|
public |
serialize(options: *): * |
|
public |
setVarValue(name: *, val: *, type: *): * |
|
public |
setVariable(name: String, val: Number | String | Boolean) set variable value |
|
public |
setVolume(v: Number) set volume [0-1] |
Private Methods | ||
private |
_addLink(opinid: *, opoutid: *, inName: *, outName: *): * |
|
private |
|
Public Constructors
public constructor() source
Public Members
public aborted: boolean source
public animFrameCallbacks: *[] source
public animFrameOps: *[] source
public cgCanvas: * source
public cgl: * source
public cgp: * source
public config: * source
public deSerialized: boolean source
public freeTimer: * source
public gui: boolean source
public loading: * source
public name: * source
public namedTriggers: {} source
public namespace: * source
public onOneFrameRendered: * source
public ops: *[] source
public profiler: * source
public reqAnimTimeStamp: number source
public settings: {} source
public silent: * source
public storeObjNames: boolean source
public tempData: * source
public timer: * source
public vars: {} source
Private Members
private _animReq: * source
private _crashedOps: *[] source
private _frameInterval: number source
private _frameNext: number source
private _frameNum: number source
private _frameWasdelayed: boolean source
private _isLocal: * source
private _lastFrameTime: number source
private _log: * source
private _opIdCache: {} source
private _origData: * source
private _paused: boolean source
private _renderOneFrame: boolean source
private _subpatchOpCache: {} source
private _triggerStack: *[] source
private _variableListeners: *[] source
private _variables: {} source
private _volumeListeners: *[] source
Public Methods
public addOnAnimFrame(op: *) source
Params:
Name | Type | Attribute | Description |
op | * |
public addOnAnimFrameCallback(cb: *) source
Params:
Name | Type | Attribute | Description |
cb | * |
public addOp(opIdentifier: string, uiAttribs: Object, id: string, fromDeserialize: boolean, opName: string): * source
create a new op in patch
Params:
Name | Type | Attribute | Description |
opIdentifier | string | uuid or name, e.g. Ops.Math.Sum |
|
uiAttribs | Object | Attributes |
|
id | string | ||
fromDeserialize | boolean | ||
opName | string | e.g. Ops.Math.Sum |
Return:
* |
Example:
// add invisible op
patch.addOp('Ops.Math.Sum', { showUiAttribs: false });
public clear() source
public createOp(identifier: *, id: *, opName: undefined): * source
Params:
Name | Type | Attribute | Description |
identifier | * | ||
id | * | ||
opName | undefined |
|
Return:
* |
public deSerialize(obj: *, options: *) source
Params:
Name | Type | Attribute | Description |
obj | * | ||
options | * |
public deleteOp(opid: *, tryRelink: *, reloadingOp: *) source
Params:
Name | Type | Attribute | Description |
opid | * | ||
tryRelink | * | ||
reloadingOp | * |
public deleteVar(name: *) source
Params:
Name | Type | Attribute | Description |
name | * |
public dispose() source
public emitOnAnimFrameEvent(time: *, delta: *) source
Params:
Name | Type | Attribute | Description |
time | * | ||
delta | * |
public exec(timestamp: *) source
Params:
Name | Type | Attribute | Description |
timestamp | * |
public getAssetPath(patchId: *): string source
get asset path
Params:
Name | Type | Attribute | Description |
patchId | * |
Return:
string |
public getDocument(): Object source
returns document object of the patch could be != global document object when opening canvas ina popout window
Return:
Object | document |
public getFilePath(filename: String): String source
get url/filepath for a filename this uses prefixAssetpath in exported patches
Params:
Name | Type | Attribute | Description |
filename | String |
Return:
String | url |
public getFirstSubPatchOpByName(patchId: *, objName: *): boolean source
Params:
Name | Type | Attribute | Description |
patchId | * | ||
objName | * |
Return:
boolean |
public getSubPatchOp(patchId: *, objName: *): * source
Params:
Name | Type | Attribute | Description |
patchId | * | ||
objName | * |
Return:
* |
public getSubPatchOpsByName(patchId: *, objName: *): * source
Params:
Name | Type | Attribute | Description |
patchId | * | ||
objName | * |
Return:
* |
public getVarValue(name: *, val: *): * source
Params:
Name | Type | Attribute | Description |
name | * | ||
val | * |
Return:
* |
public hasVar(name: String): * source
has variable
Params:
Name | Type | Attribute | Description |
name | String | of variable |
Return:
* |
public isEditorMode(): Boolean source
returns true if patch is opened in editor/gui mode
Return:
Boolean | editor mode |
public link(op1: Op, port1Name: String, op2: Op, port2Name: String, lowerCase: boolean, fromDeserialize: boolean): * source
link two ops/ports
Return:
* |
public loadLib(which: *) source
Params:
Name | Type | Attribute | Description |
which | * |
public popTriggerStack() source
public preRenderOps() source
public printTriggerStack() source
public profile(enable: *) source
Params:
Name | Type | Attribute | Description |
enable | * |
public pushTriggerStack(p: *) source
Params:
Name | Type | Attribute | Description |
p | * |
public removeOnAnimCallback(cb: *) source
Params:
Name | Type | Attribute | Description |
cb | * |
public removeOnAnimFrame(op: *) source
Params:
Name | Type | Attribute | Description |
op | * |
public renderFrame(timestamp: *) source
Params:
Name | Type | Attribute | Description |
timestamp | * |
public renderOneFrame() source
public setVarValue(name: *, val: *, type: *): * source
Params:
Name | Type | Attribute | Description |
name | * | ||
val | * | ||
type | * |
Return:
* |
public setVariable(name: String, val: Number | String | Boolean) source
set variable value
Params:
Name | Type | Attribute | Description |
name | String | of variable |
|
val | Number | String | Boolean | value |
public setVolume(v: Number) source
set volume [0-1]
Params:
Name | Type | Attribute | Description |
v | Number | volume |
Private Methods
private _addLink(opinid: *, opoutid: *, inName: *, outName: *): * source
Params:
Name | Type | Attribute | Description |
opinid | * | ||
opoutid | * | ||
inName | * | ||
outName | * |
Return:
* |