class SnapshotAPI
Provides access to patcher snapshots.
Constructors
new SnapshotAPI(varname: string);
Constructs a new instance of the SnapshotAPI
class
Parameter | Type | Description |
---|---|---|
varname | string | the 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;
Name | Type | Description |
---|---|---|
optional userpath | string | the pathname to the maxsnap file within the user Snapshots directory (default: autogenerated) |
optional index | number | the snapshot index (default: 0) |
optional name | string | the snapshot name (default: name of object) |
deletesnapshot
Delete a snapshot
deletesnapshot(index: number): void;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
exportsnapshot
Save a snapshot to a file
exportsnapshot(index: number, userpath?: string): void;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
optional userpath | string | the 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;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
Return Value | number | 1 if the snapshot at the index is embedded, 0 if not |
getnumsnapshots
Get the total number of snapshots
getnumsnapshots(): number;
Name | Type | Description |
---|---|---|
Return Value | number |
getsnapshotname
Get the name of the snapshot at a given index
getsnapshotname(index: number): string;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
Return Value | string |
importsnapshot
Load a snapshot from a file into a given slot
importsnapshot(index?: number, userpath?: string): void;
Name | Type | Description |
---|---|---|
optional index | number | the snapshot index |
optional userpath | string | the 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;
Name | Type | Description |
---|---|---|
srcIndex | number | the current snapshot index |
destIndex | number | the new snapshot index |
restore
Restore a snapshot
restore(index: number): void;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
setembedsnapshot
Set the embed state of a snapshot
setembedsnapshot(index: number, embedstate: number): void;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
embedstate | number | 1 if embedded, 0 if not |
setsnapshotname
Set the name of the snapshot at the given index
setsnapshotname(index: number, name: string): void;
Name | Type | Description |
---|---|---|
index | number | the snapshot index |
name | string | the 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;
Name | Type | Description |
---|---|---|
optional userpath | string | the pathname to the maxsnap file within in the user Snapshots directory (default: autogenerated) |
optional index | number | the snapshot index (default: 0) |
optional name | string | the snapshot name (default: name of object) |