class SnapshotAPI
Provides access to patcher snapshots.
Index
Constructors
Methods
- addsnapshot(userpath, index, name)
- deletesnapshot(index, newcurrent)
- exportsnapshot(index, userpath)
- getembedsnapshot(index)
- getnumsnapshots()
- getsnapshotname(index)
- importsnapshot(index, userpath)
- movesnapshot(srcIndex, destIndex)
- restore(index, userpath)
- setembedsnapshot(index, embedstate)
- setsnapshotname(index, name)
- snapshot(userpath, index, name)
new SnapshotAPI(varname)
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 |
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;
| 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(index, newcurrent)
Delete a snapshot
deletesnapshot(index?: number, newcurrent?: number): void;
| Name | Type | Description |
|---|---|---|
| optional index | number | the snapshot index |
| optional newcurrent | number | optional index to set as the new current snapshot |
exportsnapshot(index, userpath)
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(index)
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(index)
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(index, userpath)
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(srcIndex, destIndex)
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(index, userpath)
Restore a snapshot
restore(index?: number, userpath?: string): void;
| Name | Type | Description |
|---|---|---|
| optional index | number | the snapshot index |
| optional userpath | string | optional path to a maxsnap file to restore from |
setembedsnapshot(index, embedstate)
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(index, name)
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(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;
| 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) |