G0.4: save/restore preset quanh reload khi close GUI (captureState/restoreState, memorystream link truc tiep)

This commit is contained in:
2026-08-15 20:04:56 +07:00
parent 5313d85926
commit eac7f2feb8
6 changed files with 77 additions and 1 deletions
+8
View File
@@ -9,6 +9,7 @@
#include "INativeInstrument.h"
#include <string>
#include <vector>
class Vst3Instrument : public INativeInstrument {
public:
@@ -27,6 +28,10 @@ public:
bool openGUI(void* parentWindowHandle) override;
bool reloadForGUI() override;
bool attachView(void* parentWindowHandle) override;
// G0.4: keep the preset across GUI reopen (reload() recreates the
// instance from scratch — without save/restore the plugin resets).
void captureState();
void restoreState();
void resizeView(int w, int h) override;
bool hasAttachedView() const override;
void closeGUI() override;
@@ -47,6 +52,9 @@ private:
bool hasAttachedOnce_;
bool reloading_; // guarded by InstrumentEngineManager::mu_ (set via setReloading)
uint32_t channel_ = 0;
// G0.4: serialized IComponent/IEditController state captured before reload.
std::vector<uint8_t> savedComponentState_;
std::vector<uint8_t> savedControllerState_;
};
#endif // VST3_INSTRUMENT_H