diff --git a/docs/OSC_CONTROL.md b/docs/OSC_CONTROL.md index 2f542ca..c8f0b3f 100644 --- a/docs/OSC_CONTROL.md +++ b/docs/OSC_CONTROL.md @@ -28,6 +28,8 @@ Examples: /VideoShaderToys/layer-1/brightness /VideoShaderToys/VHS/intensity /VideoShaderToys/TemporalLowFPS/frameRate +/VideoShaderToys/fisheye-reproject/panDegrees +/VideoShaderToys/video-transform/pan ``` Layer keys are resolved against: @@ -41,18 +43,66 @@ Parameter keys are resolved against: - Parameter ID from `shader.json` - Parameter label from `shader.json` -Matching is exact first. If that fails, names are compared in a simplified form that ignores spaces, underscores, hyphens, and casing. For live control, prefer stable IDs where possible. +Matching is exact first. If that fails, names are compared in a simplified form that ignores spaces, underscores, hyphens, and casing. + +If multiple layers use the same shader package ID or display name, the first matching layer in the stack is controlled. Use the internal layer ID shown in the UI when you need to target one duplicate layer precisely. ## Values -The listener accepts one OSC argument per message: +The listener accepts these OSC argument types: - `f`: float +- `d`: double - `i`: integer - `s`: string - `T` / `F`: boolean true/false -Values are validated with the same shader parameter rules used by the REST API. Invalid values or unknown addresses are ignored. +Single-argument messages become scalar JSON values. Multi-argument messages become JSON arrays, which lets OSC drive `vec2` and `color` parameters. + +Examples: + +```text +/VideoShaderToys/fisheye-reproject/panDegrees 45.0 +/VideoShaderToys/fisheye-reproject/fisheyeModel "equisolid" +/VideoShaderToys/video-transform/pan 0.25 -0.5 +/VideoShaderToys/composition-guides/lineColor 1.0 0.8 0.1 1.0 +``` + +Values are validated with the same shader parameter rules used by the REST API. Invalid values or unknown addresses are ignored and reported to the native debug output. + +## Open Stage Control + +For simple scalar controls, set the widget address and target directly: + +```json +{ + "address": "/VideoShaderToys/fisheye-reproject/panDegrees", + "target": "127.0.0.1:9000", + "decimals": "2f" +} +``` + +For an XY pad controlling a `vec2` parameter, send two float arguments in `onValue`: + +```js +var x = Array.isArray(value) ? Number(value[0]) : 0; +var y = Array.isArray(value) ? Number(value[1]) : 0; +send( + '127.0.0.1:9000', + '/VideoShaderToys/video-transform/pan', + {type: 'f', value: x}, + {type: 'f', value: y} +); +``` + +For an XY pad controlling two separate scalar parameters: + +```js +var pan = Array.isArray(value) ? Number(value[0]) : 0; +var tilt = Array.isArray(value) ? Number(value[1]) : 0; +send('127.0.0.1:9000', '/VideoShaderToys/fisheye-reproject/panDegrees', {type: 'f', value: pan}); +send('127.0.0.1:9000', '/VideoShaderToys/fisheye-reproject/tiltDegrees', {type: 'f', value: tilt}); +``` ## Network