Include bypass state in snapshots.

This commit is contained in:
Robin Davies
2024-10-06 18:04:08 -04:00
parent c9d7e18116
commit 24beb0edd9
3 changed files with 10 additions and 0 deletions
+4
View File
@@ -226,12 +226,14 @@ export class SnapshotValue {
{
let result = new SnapshotValue();
result.instanceId = item.instanceId;
result.isEnabled = item.isEnabled;
result.controlValues = ControlValue.deserializeArray(item.controlValues);
result.lv2State = item.lv2State; // we can do this, because lv2State is immutable.
result.pathProperties = {...item.pathProperties}; // clone the dictionary.
return result;
}
instanceId: number = -1;
isEnabled: boolean = true;
controlValues: ControlValue[] = ControlValue.EmptyArray;
lv2State: [boolean,any] = [false,{}];
pathProperties: {[Name: string]: string} = {};
@@ -239,6 +241,7 @@ export class SnapshotValue {
export class Snapshot {
deserialize(input: any): Snapshot {
this.values = SnapshotValue.deserializeArray(input.values);
this.isModified = input.isModified;
this.name = input.name;
this.color = input.color;
return this;
@@ -273,6 +276,7 @@ export class Snapshot {
return result;
}
name: string = "";
isModified: boolean = false;
color: string = "";
values: SnapshotValue[] = [];
};
+4
View File
@@ -228,6 +228,7 @@ void PedalboardItem::ApplySnapshotValue(SnapshotValue*snapshotValue)
this->lv2State(snapshotValue->lv2State_);
this->stateUpdateCount(this->stateUpdateCount()+1);
}
this->isEnabled(snapshotValue->isEnabled_);
}
@@ -294,6 +295,7 @@ void PedalboardItem::AddToSnapshotFromCurrentSettings(Snapshot&snapshot) const
{
SnapshotValue snapshotValue;
snapshotValue.instanceId_ = this->instanceId_;
snapshotValue.isEnabled_ = this->isEnabled_;
for (const ControlValue &value: this->controlValues_)
{
@@ -410,6 +412,7 @@ JSON_MAP_END()
JSON_MAP_BEGIN(SnapshotValue)
JSON_MAP_REFERENCE(SnapshotValue,instanceId)
JSON_MAP_REFERENCE(SnapshotValue,isEnabled)
JSON_MAP_REFERENCE(SnapshotValue,controlValues)
JSON_MAP_REFERENCE(SnapshotValue,lv2State)
JSON_MAP_REFERENCE(SnapshotValue,pathProperties)
@@ -417,6 +420,7 @@ JSON_MAP_END()
JSON_MAP_BEGIN(Snapshot)
JSON_MAP_REFERENCE(Snapshot,name)
JSON_MAP_REFERENCE(Snapshot,isModified)
JSON_MAP_REFERENCE(Snapshot,color)
JSON_MAP_REFERENCE(Snapshot,values)
JSON_MAP_END()
+2
View File
@@ -154,6 +154,7 @@ public:
class SnapshotValue {
public:
uint64_t instanceId_;
bool isEnabled_ = true;
std::vector<ControlValue> controlValues_;
Lv2PluginState lv2State_;
std::map<std::string,std::string> pathProperties_;
@@ -165,6 +166,7 @@ class Snapshot {
public:
std::string name_;
std::string color_;
bool isModified_ = true;
std::vector<SnapshotValue> values_;
DECLARE_JSON_MAP(Snapshot);