From f9dffddcdc08b7f889ac1bf3d747963c6c619186 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Tue, 17 Oct 2023 10:22:04 +0200 Subject: [PATCH] Remove undo and incremental state as the design isn't ready yet and needs more work --- ChangeLog.md | 5 -- include/clap/ext/draft/incremental-state.h | 50 --------------- include/clap/ext/draft/undo.h | 75 ---------------------- 3 files changed, 130 deletions(-) delete mode 100644 include/clap/ext/draft/incremental-state.h delete mode 100644 include/clap/ext/draft/undo.h diff --git a/ChangeLog.md b/ChangeLog.md index 26a20f83..cce7a328 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,11 +8,6 @@ * [entry.h](include/clap/entry.h): documentation clarifications * [audio-ports-activation.h](include/clap/ext/draft/audio-ports-activation.h): specify the sample size to be used when activating the audio port. -## Draft extensions - -* [undo.h](include/clap/ext/draft/undo.h): undo support -* [incremental-state.h](include/clap/ext/draft/incremental-state.h): incremental state - # Changes in 1.1.8 * [params.h](include/clap/ext/params.h): document how persisting parameter values between sessions should be implemented diff --git a/include/clap/ext/draft/incremental-state.h b/include/clap/ext/draft/incremental-state.h deleted file mode 100644 index a62cef24..00000000 --- a/include/clap/ext/draft/incremental-state.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "../../plugin.h" - -static CLAP_CONSTEXPR const char CLAP_EXT_INCREMENTAL_STATE[] = "clap.incremental-state.draft/0"; - -// This extension is useful for the host to collect incremental changes instead of saving the plugin -// state after each changes. -// -// The typical use case is for crash recovery: -// 1. the host saves the entire project (expensive) -// 2. many things, happens and the host saves little delta operations to disk (cheap) -// 3. the application crashes -// -// Then once the application is restarted, the user can decide to recover the project which will -// work as follow: -// 1. open the last project state -// 2. apply all the deltas in sequence -// 3. project is ready and should be in the same state as it was before the crash -// -// Saving a project, can be an expensive task especially for large project and can -// cause playback performance issues. -// This is why saving deltas is interesting because it is lightweight. -// -// This interface is not meant to replace saving the entire project. -// -// If the plugin decides to implement this interface, it should then be able to encode -// the deltas in a space efficient way. -// -// The plugin can assume that the delta will be applied on the same computer as the -// one used to produce it. Meaning that it doesn't have to take care of endianness -// and can store path to files on the computer. - -typedef struct clap_plugin_incremental_state { - // [main-thread] - bool (*apply_delta)(clap_plugin_t *plugin, const char *data, size_t size); -} clap_plugin_incremental_state_t; - -typedef struct clap_host_incremental_state { - // Adds a delta, its size should be reasonably small. - // - // [main-thread] - void (*add_delta)(clap_host_t *host, const char *data, size_t size); - - // One change happened which can't be encoded as a delta, and requires - // the host to save the entire state again. - // - // [main-thread] - void (*save_is_required)(clap_host_t *host); -} clap_host_incremental_state_t; diff --git a/include/clap/ext/draft/undo.h b/include/clap/ext/draft/undo.h deleted file mode 100644 index 84204e6e..00000000 --- a/include/clap/ext/draft/undo.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include "../../plugin.h" -#include "../../string-sizes.h" - -static CLAP_CONSTEXPR const char CLAP_EXT_UNDO[] = "clap.undo.draft/0"; - -// Describes a change which can be undone or redone -typedef struct clap_undo_change_info { - // This is the unique identifier of this undo step. - // It is valid until loading a state or destroying the plugin. - clap_id change_id; - - // A short string which describes the corresponding change. - char description[CLAP_NAME_SIZE]; -} clap_undo_change_info_t; - -typedef struct clap_plugin_undo { - // returns true if an undo/redo step exists and the info were provided - // [main-thread] - bool (*get_current_undo_info)(clap_plugin_t *plugin, clap_undo_change_info_t *info); - bool (*get_current_redo_info)(clap_plugin_t *plugin, clap_undo_change_info_t *info); - - // Request the plugin to perform an undo operation (async). - // - // Returns true if the request is being processed, false otherwise. - // When returning true, the plugin **must** call clap_host_undo->after_undo_request() once the - // request is completed or failed. - // - // The plugin should only perform the operation if the current undo/redo operation matches the - // given id; this is because of the asynchronous nature of the task and to avoid race conditions - // if the plugin's undo manager lives in a different thread. - // - // Call sequence: - // 1. plugin->request_undo(change_id=X) -> returns true - // 2. later on host->begin_undo(change_id=X) - // 3. later on host->end_undo(change_id=X), host->after_undo(change_id=X, true, nullptr) - // [main-thread] - bool (*request_undo)(clap_plugin_t *plugin, clap_id change_id); - bool (*request_redo)(clap_plugin_t *plugin, clap_id change_id); -} clap_plugin_undo_t; - -typedef struct clap_host_undo { - // Marks the begining and end of a change which will lead to the creation of an undo step. - // [main-thread] - void (*begin_change)(clap_host_t *host, const clap_undo_change_info_t *info); - void (*end_change)(clap_host_t *host, const clap_undo_change_info_t *info); - - // Marks the beginning and end of processing an undo change. - // [main-thread] - void (*begin_undo)(clap_host_t *host, const clap_undo_change_info_t *info); - void (*end_undo)(clap_host_t *host, const clap_undo_change_info_t *info); - - // Marks the beginning and end of processing a redo change. - // [main-thread] - void (*begin_redo)(clap_host_t *host, const clap_undo_change_info_t *info); - void (*end_redo)(clap_host_t *host, const clap_undo_change_info_t *info); - - // A destructive change happened which makes it impossible to perform an undo. - // The entire plugin's undo/redo stack has been cleared. - // [main-thread] - void (*after_destructive_change)(clap_host_t *host); - - // Callbacks for clap_plugin_undo->request_*() - // If succeed is true, then error_msg is ignored and may be null. - // [main-thread] - void (*after_undo_request)(clap_host_t *host, - clap_id change_id, - bool succeed, - const char *error_msg); - void (*after_redo_request)(clap_host_t *host, - clap_id change_id, - bool succeed, - const char *error_msg); -} clap_host_undo_t;