From 24beb0edd9d3448f49d6129b9941bc2c3071f38f Mon Sep 17 00:00:00 2001 From: Robin Davies Date: Sun, 6 Oct 2024 18:04:08 -0400 Subject: [PATCH] Include bypass state in snapshots. --- react/src/Pedalboard.tsx | 4 ++++ src/Pedalboard.cpp | 4 ++++ src/Pedalboard.hpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/react/src/Pedalboard.tsx b/react/src/Pedalboard.tsx index 5a8d010..414d060 100644 --- a/react/src/Pedalboard.tsx +++ b/react/src/Pedalboard.tsx @@ -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[] = []; }; diff --git a/src/Pedalboard.cpp b/src/Pedalboard.cpp index 0e24eb3..6a27f1c 100644 --- a/src/Pedalboard.cpp +++ b/src/Pedalboard.cpp @@ -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() diff --git a/src/Pedalboard.hpp b/src/Pedalboard.hpp index a538692..579dc2f 100644 --- a/src/Pedalboard.hpp +++ b/src/Pedalboard.hpp @@ -154,6 +154,7 @@ public: class SnapshotValue { public: uint64_t instanceId_; + bool isEnabled_ = true; std::vector controlValues_; Lv2PluginState lv2State_; std::map pathProperties_; @@ -165,6 +166,7 @@ class Snapshot { public: std::string name_; std::string color_; + bool isModified_ = true; std::vector values_; DECLARE_JSON_MAP(Snapshot);