stmdelete
Stops a runner for good.
A deleted runner cannot be resumed, reset or recalled. Its handle remains valid, and observers can still read its last state.
Syntax
Initialization
irunner -- a runner handle, returned by stminstance.
Performance
ktrig -- the action happens when ktrig becomes greater than 0, that is on the first pass where it is positive after being 0 or less. A trigger that is positive on the very first pass also counts. Holding ktrig high does not repeat the action.
Deleting clears the pending request and records a delete event (kind 7). From then on, stmadvance returns status 6 and leaves the clock alone, and every other writer is ignored.
stmdelete does not free the runner. Its memory is released when the handle is removed and the last opcode using it has ended.
This opcode changes the runner, so it counts as a writer: a runner accepts writers from one instrument instance at a time. See Writers and observers.
Examples
One instrument drives a runner through transitions, a pause, a resume and a deletion. A second instrument watches it with stmonenter, stmonexit and stmevent. It uses the file stm-events.csd.
Its output is:
cycle 1: advance status 1
enter B 1, exit B 0
event 1: kind 1, 0 -> 1, overflow 0
cycle 2: advance status 3
enter B 1, exit B 1
event 2: kind 2, 1 -> 1, overflow 0
cycle 3: advance status 5
event 3: kind 5, 1 -> 1, overflow 0
cycle 4: advance status 5
cycle 5: advance status 0
event 4: kind 6, 1 -> 1, overflow 0
cycle 6: advance status 1
enter B 0, exit B 1
event 5: kind 1, 1 -> 0, overflow 0
cycle 7: advance status 6
event 6: kind 7, 0 -> 0, overflow 0
cycle 8: advance status 6
cycle 9: advance status 6
Event kinds: 1 transition, 2 self transition, 5 pause, 6 resume, 7 delete. The self transition in cycle 2 fires both the enter and the exit trigger of B. The request in cycle 4 is ignored because the runner is paused, and the one in cycle 8 because it is deleted. Pause, resume and delete appear as events but do not fire the enter and exit triggers.
See also
Credits
Author: Pasquale Mainolfi
Italy
New in Csound version 7.0
October 2026