How to include a string in a preset | For RackAFX Power Users | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How to include a string in a preset
Avatar
Member
Members
May 31, 2021 - 5:19 pm
Member Since: April 29, 2020
Forum Posts: 22
sp_UserOfflineSmall Offline

I want to save a preset including a path to a sound file, something like a sample. How do I manage this?

Avatar
Admin
June 2, 2021 - 7:45 am
Member Since: January 1, 2020
Forum Posts: 107
sp_UserOfflineSmall Offline

Hi Marc. 

Is your DAW already allowing you to save presets or are you looking to implement a custom method? I've just implemented something of a preset manager. Based off that, this is what I would recommend.

Create/update a text file with the address of all the samples you want stored on separate lines.

Create a parameter to select the current sample so the DAW can save/recall that state.

On initialization and "PluginCore::guiParameterChanged" - open the text file, iterate through to the correct line based off the parameter state, get the path, close the text file, load the sample.

You might then want to add some options to add to/overwrite to that list which is possible.

Maybe add some code after your 'load sample' parameter to auto-update the text file at the current parameter position.

It's possible to create a menu list that will display/load items from that text file as well. 

I use this code to get to the Appdata folder on any Windows computer. Think it makes sense to store there.

char out[MAX_PATH];    ///https://stackoverflow.com/questions/36049010/how-to-get-appdata-path-as-stdstring
(SHGetSpecialFolderPathA(NULL, out, CSIDL_APPDATA, 0)); // //WIN ONLY 

Using -iostream- an -fstream- for all of that, it's well documented.  The above code also needs a shlobj.h include.

 

Hope anything there helps,

Jim

Avatar
Member
Members
June 4, 2021 - 12:42 pm
Member Since: April 29, 2020
Forum Posts: 22
sp_UserOfflineSmall Offline

Hi Jim.

This is funny, because I was thinking of doing exactly the same thing before I read your post: writing a text file with all the path informations. AppData is also my choice for Windows, and /Users/<my user>/Library/Application\ Support/<my company>/Presets_for_myPlugin.txt for Mac.

I was wondering if it was easy to extend the normal preset-writing/reading so that the paths are in it. I did it in VST2.4, remembering that it was not trivial.

The advantages of writing a text file:

- you can edit it later

- you can save a whole bunch of presets, a bank, which is not possible in Audio Units

Now I will look if I can use the command from the DAW to trigger this. I think that should be easy.

Thank you,

Marc

Avatar
Admin
June 9, 2021 - 12:35 pm
Member Since: January 1, 2020
Forum Posts: 107
sp_UserOfflineSmall Offline

Hey Marc,

Thanks for responding with the mac code. I'm still using win7 but plan to branch out soon.

I'm not entirely sure if what you had would be possible with a normal .VST3preset file. I use Ableton 10 which currently doesn't handle them well, and Reaper which just goes with it's own format. So I figured it'd be easiest to not bother with it/roll my own.

PluginCore::guiParameterChanged is a very powerful place to do most of the text and parameter updating stuff. Happy to provide any additional help there. 

Cheers,

Jim

Avatar
Admin
June 14, 2021 - 1:39 pm
Member Since: January 28, 2017
Forum Posts: 706
sp_UserOfflineSmall Offline

Hey guys I am coming back online now that all of the SynthLab stuff is done and ready for the book to be in print (should be a few days from now).

One thing I build into the PluginParameter object from day 1 was the ability to store additional information in a Parameter object (this came from something similar in VSTGUI that was very flaky to get to work). These are called "Aux Parameter Attributes" and I use them all the time for GUI customization, but they can also be used for storing tect strings. 

See:

http://aspikplugins.com/sdkdoc.....873bc06ece

There is also a setAuxAttribute( ) method.

In a nutshell, you can automatically store a wide variety of common datatypes, see:

http://aspikplugins.com/sdkdoc.....ibute.html

In addition, I added the ability to get/set a void* allowing you to cloak many things and store/retrieve them via void pointer cloaking and un-cloaking. You could, for instance, store an additional text string this way, such as a path. 

Will 

Avatar
Member
Members
August 17, 2022 - 7:30 am
Member Since: April 29, 2020
Forum Posts: 22
sp_UserOfflineSmall Offline

marclingk said
Hi Jim.

This is funny, because I was thinking of doing exactly the same thing before I read your post: writing a text file with all the path informations. AppData is also my choice for Windows, and /Users//Library/Application\ Support//Presets_for_myPlugin.txt for Mac.

I was wondering if it was easy to extend the normal preset-writing/reading so that the paths are in it. I did it in VST2.4, remembering that it was not trivial.

The advantages of writing a text file:

- you can edit it later

- you can save a whole bunch of presets, a bank, which is not possible in Audio Units

Now I will look if I can use the command from the DAW to trigger this. I think that should be easy.

Thank you,

Marc  

jim said
Hi Marc. 

Is your DAW already allowing you to save presets or are you looking to implement a custom method? I've just implemented something of a preset manager. Based off that, this is what I would recommend.

Create/update a text file with the address of all the samples you want stored on separate lines.

Create a parameter to select the current sample so the DAW can save/recall that state.

On initialization and "PluginCore::guiParameterChanged" - open the text file, iterate through to the correct line based off the parameter state, get the path, close the text file, load the sample.

You might then want to add some options to add to/overwrite to that list which is possible.

Maybe add some code after your 'load sample' parameter to auto-update the text file at the current parameter position.

It's possible to create a menu list that will display/load items from that text file as well. 

I use this code to get to the Appdata folder on any Windows computer. Think it makes sense to store there.

char out[MAX_PATH];    ///https://stackoverflow.com/questions/36049010/how-to-get-appdata-path-as-stdstring
(SHGetSpecialFolderPathA(NULL, out, CSIDL_APPDATA, 0)); // //WIN ONLY 

Using -iostream- an -fstream- for all of that, it's well documented.  The above code also needs a shlobj.h include.

 

Hope anything there helps,

Jim  

jim said
Hi Marc. 

Is your DAW already allowing you to save presets or are you looking to implement a custom method? I've just implemented something of a preset manager. Based off that, this is what I would recommend.

Create/update a text file with the address of all the samples you want stored on separate lines.

Create a parameter to select the current sample so the DAW can save/recall that state.

On initialization and "PluginCore::guiParameterChanged" - open the text file, iterate through to the correct line based off the parameter state, get the path, close the text file, load the sample.

You might then want to add some options to add to/overwrite to that list which is possible.

Maybe add some code after your 'load sample' parameter to auto-update the text file at the current parameter position.

It's possible to create a menu list that will display/load items from that text file as well. 

I use this code to get to the Appdata folder on any Windows computer. Think it makes sense to store there.

char out[MAX_PATH];    ///https://stackoverflow.com/questions/36049010/how-to-get-appdata-path-as-stdstring
(SHGetSpecialFolderPathA(NULL, out, CSIDL_APPDATA, 0)); // //WIN ONLY 

Using -iostream- an -fstream- for all of that, it's well documented.  The above code also needs a shlobj.h include.

 

Hope anything there helps,

Jim  

jim said
Hi Marc. 

Is your DAW already allowing you to save presets or are you looking to implement a custom method? I've just implemented something of a preset manager. Based off that, this is what I would recommend.

Create/update a text file with the address of all the samples you want stored on separate lines.

Create a parameter to select the current sample so the DAW can save/recall that state.

On initialization and "PluginCore::guiParameterChanged" - open the text file, iterate through to the correct line based off the parameter state, get the path, close the text file, load the sample.

You might then want to add some options to add to/overwrite to that list which is possible.

Maybe add some code after your 'load sample' parameter to auto-update the text file at the current parameter position.

It's possible to create a menu list that will display/load items from that text file as well. 

I use this code to get to the Appdata folder on any Windows computer. Think it makes sense to store there.

char out[MAX_PATH];    ///https://stackoverflow.com/questions/36049010/how-to-get-appdata-path-as-stdstring
(SHGetSpecialFolderPathA(NULL, out, CSIDL_APPDATA, 0)); // //WIN ONLY 

Using -iostream- an -fstream- for all of that, it's well documented.  The above code also needs a shlobj.h include.

 

Hope anything there helps,

Jim  

jim said
Hi Marc. 

Is your DAW already allowing you to save presets or are you looking to implement a custom method? I've just implemented something of a preset manager. Based off that, this is what I would recommend.

Create/update a text file with the address of all the samples you want stored on separate lines.

Create a parameter to select the current sample so the DAW can save/recall that state.

On initialization and "PluginCore::guiParameterChanged" - open the text file, iterate through to the correct line based off the parameter state, get the path, close the text file, load the sample.

You might then want to add some options to add to/overwrite to that list which is possible.

Maybe add some code after your 'load sample' parameter to auto-update the text file at the current parameter position.

It's possible to create a menu list that will display/load items from that text file as well. 

I use this code to get to the Appdata folder on any Windows computer. Think it makes sense to store there.

char out[MAX_PATH];    ///https://stackoverflow.com/questions/36049010/how-to-get-appdata-path-as-stdstring
(SHGetSpecialFolderPathA(NULL, out, CSIDL_APPDATA, 0)); // //WIN ONLY 

Using -iostream- an -fstream- for all of that, it's well documented.  The above code also needs a shlobj.h include.

 

Hope anything there helps,

Jim  

Hi Jim, after all I came to the solution to write my own CSV file to save all the presets. For a more elegant solution I wasn't clever enough.

Thanks for your effort and hav a nice day!

Marc

Forum Timezone: America/New_York

Most Users Ever Online: 294

Currently Online:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 2

Members: 795

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 862

Posts: 3400

Moderators: W Pirkle: 706