Old 06-13-2014, 06:56 AM   #1
thingfish47
Human being with feelings
 
Join Date: Jun 2014
Posts: 2
Default Preset parameter persistence

I am developing a plugin, and have handled all the VST 2.4 'programs and persistence' functions in the AudioEffect and AudioEffectX classes. When I save a project with my plugin, and reload it, setchunk is called, and the last set of parameters are loaded by the DAW. So far so good, but I note that other plugins will 'remember' any changes made to any of the preset parameters, and this is not happening with my plugin. Is there another function that can achieve this that I am unaware of, and therefore not handling?
thingfish47 is offline   Reply With Quote
Old 06-16-2014, 01:34 AM   #2
thingfish47
Human being with feelings
 
Join Date: Jun 2014
Posts: 2
Default

I think what I really mean here is, does Reaper itself provide persistence for plugin pre-sets (and dumping out the project file leads me to believe this is true), or is the plugin responsible for this, in which case can I get advice on where to save them with Reaper?

Either way, I would appreciate some advice.
thingfish47 is offline   Reply With Quote
Old 06-16-2014, 02:29 AM   #3
Geoff Waddington
Human being with feelings
 
Geoff Waddington's Avatar
 
Join Date: Mar 2009
Location: Dartmouth, Nova Scotia
Posts: 11,239
Default

Quote:
Originally Posted by thingfish47
I think what I really mean here is, does Reaper itself provide persistence for plugin pre-sets (and dumping out the project file leads me to believe this is true), or is the plugin responsible for this, in which case can I get advice on where to save them with Reaper?
Here is a code excerpt that shows how for control surfaces, I'm not sure if VST Presets are supported this way, but it's likely very close to this, you'll have to substitute the EuCon stuff with equivalent code for your app, note that lenSurfacePayload is passed by reference:

Code:
static WDL_HeapBuf hb;

static void SaveExtensionConfig(ProjectStateContext *context, bool isUndo, struct project_config_extension_t *reg)
{
	// can optionally not save undo chunks, up to you (if it makes sense in
	// the undo state or not, etc)
	if(isUndo)
	{
		return;
	}

	if(!pEuConApplication)
	{
		return;
	}

	void *ptrSurfacePayload = 0;
	NEuCon::uint32 lenSurfacePayload = 0;

	tERR err = pEuConApplication->GetPayloadFromSurface(ptrSurfacePayload, lenSurfacePayload);

	if( err == kERR_OK)
	{
		context->AddLine("<EuConArtist");

		cfg_encode_binary(context, ptrSurfacePayload, lenSurfacePayload); // this is implemented in WDL/projectcontext.cpp

		context->AddLine(">");

		pEuConApplication->FreePayloadBuffer(ptrSurfacePayload);
	}
}

static bool ProcessExtensionLine(const char *line, ProjectStateContext *context, bool isUndo, struct project_config_extension_t *reg)
{
	if(isUndo)
	{
		return false;
	}

	if (strcmp(line,"<EuConArtist"))
	{
		return false;
	}

	hb.Resize(0);

	cfg_decode_binary(context, &hb); // this is implemented in WDL/projectcontext.cpp

	return true;
}

static void BeginLoadProjectState(bool isUndo, struct project_config_extension_t *reg)
{
}

project_config_extension_t csurf_eucon_projectconfig = 
{ 
	ProcessExtensionLine, 
	SaveExtensionConfig, 
	BeginLoadProjectState, 
	NULL 
};
__________________
To install you need the CSI Software and Support Files
For installation instructions and documentation see the Wiki
Donate -- via PayPal to waddingtongeoff@gmail.com
Geoff Waddington is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.