class SnapshotAPI

Provides access to patcher snapshots.

Constructors

new SnapshotAPI(varname: string);

Constructs a new instance of the SnapshotAPI class

ParameterTypeDescription
varnamestringthe varname of an object to snapshot, or 'patcher' for a patcher snapshot

Methods

addsnapshot

Create a snapshot at a given index, appending to the snapshot list if the index is already occupied.

addsnapshot(userpath?: string, index?: number, name?: string): void;
NameTypeDescription
optional userpathstringthe pathname to the maxsnap file within the user Snapshots directory (default: autogenerated)
optional indexnumberthe snapshot index (default: 0)
optional namestringthe snapshot name (default: name of object)

deletesnapshot

Delete a snapshot

deletesnapshot(index: number): void;
NameTypeDescription
indexnumberthe snapshot index

exportsnapshot

Save a snapshot to a file

exportsnapshot(index: number, userpath?: string): void;
NameTypeDescription
indexnumberthe snapshot index
optional userpathstringthe pathname to the maxsnap file within in the user Snapshots directory (default: autogenerated)

getembedsnapshot

Query the 'embed' state of a snapshot

getembedsnapshot(index: number): number;
NameTypeDescription
indexnumberthe snapshot index
Return Valuenumber1 if the snapshot at the index is embedded, 0 if not

getnumsnapshots

Get the total number of snapshots

getnumsnapshots(): number;
NameTypeDescription
Return Valuenumber

getsnapshotname

Get the name of the snapshot at a given index

getsnapshotname(index: number): string;
NameTypeDescription
indexnumberthe snapshot index
Return Valuestring

importsnapshot

Load a snapshot from a file into a given slot

importsnapshot(index?: number, userpath?: string): void;
NameTypeDescription
optional indexnumberthe snapshot index
optional userpathstringthe pathname to the maxsnap file within in the user Snapshots directory

movesnapshot

Change a snapshot's index

Does nothing if the srcIndex or destIndex doesn't exist

movesnapshot(srcIndex: number, destIndex: number): void;
NameTypeDescription
srcIndexnumberthe current snapshot index
destIndexnumberthe new snapshot index

restore

Restore a snapshot

restore(index: number): void;
NameTypeDescription
indexnumberthe snapshot index

setembedsnapshot

Set the embed state of a snapshot

setembedsnapshot(index: number, embedstate: number): void;
NameTypeDescription
indexnumberthe snapshot index
embedstatenumber1 if embedded, 0 if not

setsnapshotname

Set the name of the snapshot at the given index

setsnapshotname(index: number, name: string): void;
NameTypeDescription
indexnumberthe snapshot index
namestringthe snapshot name

snapshot

Create a snapshot at a given index

Unlike SnapshotAPI.addsnapshot(), snapshot will overwrite existing snapshots

snapshot(userpath?: string, index?: number, name?: string): void;
NameTypeDescription
optional userpathstringthe pathname to the maxsnap file within in the user Snapshots directory (default: autogenerated)
optional indexnumberthe snapshot index (default: 0)
optional namestringthe snapshot name (default: name of object)