Opcodes
cabbageAraGetUpdateEvent
Returns the type of the most recent ARA lifecycle event together with a trigger that is 1 for a single k-cycle whenever the ARA model data changes.
Syntax
Section titled “Syntax”event:S, trig:k = cabbageAraGetUpdateEvent()res:CabbageStrTrig = cabbageAraGetUpdateEvent()Performance
Section titled “Performance”- SEvent — the name of the most recent ARA event as a string, for example
"audioSourceAddedToDocument"or"regionSequencePropertiesUpdated"(k-rate) - kTrig — fires
1for a single k-cycle whenever the shared ARA document model data has been refreshed;0otherwise - res:CabbageStrTrig — the built-in trigger struct form:
res.valholds SEvent andres.trigmirrors kTrig
Description
Section titled “Description”This opcode pairs the edge trigger of cabbageAraGetUpdate with the name of the event that caused it. The trigger fires on every refresh of the shared ARA document model, while SEvent tells you which lifecycle change produced it. Typical event names include:
audioSourceAddedToDocument,audioSourceRemovedFromDocumentaudioSourcePropertiesUpdated,audioModificationPropertiesUpdatedplaybackRegionAddedToRegionSequence,playbackRegionRemovedFromRegionSequencemusicalContextAddedToDocument,regionSequenceAddedToDocumentdocumentPropertiesUpdated,beginEditing,endEditingdocumentWillDestroy
The same information is available through cabbageAraGet "lastEvent"; this opcode simply returns it directly, so no second query is needed inside the triggered block.
Only instruments running inside a host with ARA support see non-empty events. Outside an ARA session the string stays empty and the trigger never fires.
Example
Section titled “Example”instr 1 event:CabbageStrTrig = cabbageAraGetUpdateEvent() printf("ARA event: %s\n", event.trig, event.val)endinThe struct form compiles the two outputs into a single variable:
instr 1 res:CabbageStrTrig = cabbageAraGetUpdateEvent() printf("ARA event: %s\n", res.trig, res.val)endin