-
Notifications
You must be signed in to change notification settings - Fork 1
global array
senso edited this page Jun 22, 2026
·
2 revisions
#example #array #data #advanced
Shared global array manipulation across modules.
| Module Name | global array |
| Type | mtSimple |
| Color | clArrayModuleColor |
| Source | examples/GlobalArray/ |
Demonstrates the Global Array API for sharing data across modules in a workspace. Shows how to create, read, and write global arrays of different types: float, color, string, and event.
| # | Name | Type | I/O | Callback |
|---|---|---|---|---|
| 0 | array set |
ptArray |
Input | None |
| 1 | array get |
ptArray |
Output | None |
In onProcess, on each sdkRefreshSpeedClock tick:
-
Float array (
GA-FLOAT): Sets 16 random floats, reads back index 0 -
Color array (
GA-COLOR): Sets 16 random colors, reads back index 0 -
String array (
GA-STRING): Sets 16 random strings, reads back index 0 -
Event array (
GA-EVENT): Sets entire event with 16 random values, gets entire event back
On sdkSlowClock, traces all global array names via sdkGlobalArrayGetAllNames().
// Get or create a named global array
UINT64 hash = sdkGlobalArrayGetHash("my-array-name");
// Write values
sdkGlobalArraySetValueFloat(hash, index, value);
sdkGlobalArraySetValueColor(hash, index, color);
sdkGlobalArraySetValueAnsiChar(hash, index, "text");
sdkGlobalArraySetValueEvt(hash, eventPtr);
// Read values
float val = sdkGlobalArrayGetValueFloat(hash, index);
TUsineColor col = sdkGlobalArrayGetValueColor(hash, index);
AnsiCharPtr str = sdkGlobalArrayGetValueAnsiChar(hash, index);
sdkGlobalArrayGetValueEvt(hash, eventPtr);
// Query
int size = sdkGlobalArrayGetSize(hash);
AnsiCharPtr names = sdkGlobalArrayGetAllNames();-
sdkGlobalArrayGetHash— hash-based global array identification - Multiple data types — float, color, string, event
- Cross-module data sharing — any module can read/write the same named array
-
sdkSlowClock/sdkRefreshSpeedClock— different update rates
onGetModuleInfo · onInitModule · onGetParamInfo · onProcess
- UsineObjects — Remote object access (another sharing mechanism)
- UsineChunks — Chunk-based shared data