class SnapshotAPI

Provides access to patcher snapshots.

Index

Constructors

Methods

new SnapshotAPI(varname)

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

addsnapshot(userpath, index, name)

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(index, newcurrent)

Delete a snapshot

deletesnapshot(index?: number, newcurrent?: number): void;
NameTypeDescription
optional indexnumberthe snapshot index
optional newcurrentnumberoptional index to set as the new current snapshot

exportsnapshot(index, userpath)

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(index)

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(index)

Get the name of the snapshot at a given index

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

importsnapshot(index, userpath)

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(srcIndex, destIndex)

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(index, userpath)

Restore a snapshot

restore(index?: number, userpath?: string): void;
NameTypeDescription
optional indexnumberthe snapshot index
optional userpathstringoptional path to a maxsnap file to restore from

setembedsnapshot(index, embedstate)

Set the embed state of a snapshot

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

setsnapshotname(index, name)

Set the name of the snapshot at the given index

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

snapshot(userpath, index, name)

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)