FLsetsnap

FLsetsnap — Stores the current status of all FLTK valuators into a snapshot location.

Description

FLsetsnap stores the current status of all valuators present in the orchestra into a snapshot location (in memory).

Syntax

inumsnap, inumval FLsetsnap index [, ifn, igroup]

Initialization

inumsnap -- current number of snapshots.

inumval -- number of valuators (whose value is stored in a snapshot) present in current orchestra.

index -- a number referring unequivocally to a snapshot. Several snapshots can be stored in the same bank.

ifn (optional) -- optional argument referring to an already allocated table, to store values of a snapshot.

igroup -- (optional) an integer number referring to a snapshot-related group of widget. It allows to get/set, or to load/save the state of a subset of valuators. Default value is zero that refers to the first group. The group number is determined by the opcode FLsetSnapGroup.

[Note] Note

The igroup parameter has not been yet fully implemented in the current version of csound. Please do not rely on it yet.

Performance

The FLsetsnap opcode stores current status of all valuators present in the orchestra into a snapshot location (in memory). Any number of snapshots can be stored in the current bank. Banks are structures that only exist in memory, there are no other reference to them other that they can be accessed by FLsetsnap, FLsavesnap, FLloadsnap and FLgetsnap opcodes. Only a single bank can be present in memory.

If the optional ifn argument refers to an already allocated and valid table, the snapshot will be stored in the table instead of in the bank. So that table can be accessed from other Csound opcodes.

The index argument unequivocally refers to a determinate snapshot. If the value of index refers to a previously stored snapshot, all its old values will be replaced with current ones. If index refers to a snapshot that doesn't exist, a new snapshot will be created. If the index value is not adjacent with that of a previously created snapshot, some empty snapshots will be created. For example, if a location with index 0 contains the only and unique snapshot present in a bank and the user stores a new snapshot using index 5, all locations between 1 and 4 will automatically contain empty snapshots. Empty snapshots don't contain any data and are neutral.

FLsetsnap outputs the current number of snapshots (the inumsnap argument) and the total number of values stored in each snapshot (inumval). inumval is equal to the number of valuators present in the orchestra.

For purposes of snapshot saving, widgets can be grouped, so that snapshots affect only a defined group of widgets. The opcode FLsetSnapGroup is used to specify the group for all widgets declared after it, until the next FLsetSnapGroup statement.

See Also

FLgetsnap, FLloadsnap, FLsetSnapGroup, FLrun, FLsavesnap, FLupdate

Credits

Author: Gabriel Maldonado

New in version 4.22