mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-09 20:29:12 +02:00
Added support to save/restore model file with presets/state
This commit is contained in:
+14
-1
@@ -8,6 +8,7 @@
|
||||
|
||||
// LV2
|
||||
#include <lv2/core/lv2.h>
|
||||
#include <lv2/core/lv2_util.h>
|
||||
#include <lv2/atom/atom.h>
|
||||
#include <lv2/log/log.h>
|
||||
#include <lv2/log/logger.h>
|
||||
@@ -15,6 +16,7 @@
|
||||
#include <lv2/atom/forge.h>
|
||||
#include <lv2/patch/patch.h>
|
||||
#include <lv2/worker/worker.h>
|
||||
#include <lv2/state/state.h>
|
||||
|
||||
#include "dsp.h"
|
||||
|
||||
@@ -54,6 +56,9 @@ namespace NAM {
|
||||
std::unique_ptr<::DSP> stagedModel;
|
||||
std::unique_ptr<::DSP> deleteModel;
|
||||
|
||||
std::string currentModelPath;
|
||||
std::string stagedModelPath;
|
||||
|
||||
std::unordered_map<std::string, double> mNAMParams = {};
|
||||
|
||||
Plugin();
|
||||
@@ -61,12 +66,18 @@ namespace NAM {
|
||||
|
||||
bool initialize(double rate, const LV2_Feature* const* features) noexcept;
|
||||
void process(uint32_t n_samples) noexcept;
|
||||
|
||||
|
||||
LV2_Atom_Forge_Ref write_set_patch(std::string filename);
|
||||
|
||||
static LV2_Worker_Status work(LV2_Handle instance, LV2_Worker_Respond_Function respond, LV2_Worker_Respond_Handle handle,
|
||||
uint32_t size, const void* data);
|
||||
static LV2_Worker_Status work_response(LV2_Handle instance, uint32_t size, const void* data);
|
||||
|
||||
static LV2_State_Status save(LV2_Handle instance, LV2_State_Store_Function store, LV2_State_Handle handle, uint32_t flags,
|
||||
const LV2_Feature* const* features);
|
||||
static LV2_State_Status restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve, LV2_State_Handle handle, uint32_t flags,
|
||||
const LV2_Feature* const* features);
|
||||
|
||||
private:
|
||||
struct URIs {
|
||||
LV2_URID atom_Object;
|
||||
@@ -75,12 +86,14 @@ namespace NAM {
|
||||
LV2_URID atom_Path;
|
||||
LV2_URID atom_URID;
|
||||
LV2_URID patch_Set;
|
||||
LV2_URID patch_Get;
|
||||
LV2_URID patch_property;
|
||||
LV2_URID patch_value;
|
||||
LV2_URID model_Path;
|
||||
};
|
||||
|
||||
URIs uris = {};
|
||||
|
||||
LV2_Atom_Forge atom_forge = {};
|
||||
|
||||
std::vector<double> dblData;
|
||||
|
||||
Reference in New Issue
Block a user