COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 03-27-2018, 05:15 AM   #1
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 188
Default Store settings

What solution is there to store settings for the plugin in cross platform.

In windows there is a registry but in OSX ?
__________________
Audio VST plugins http://vst.saschart.com
SaschArt is offline   Reply With Quote
Old 03-27-2018, 10:17 AM   #2
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 316
Default

Are you on WDL-OL or WDL-Youlean?
Bobflip is offline   Reply With Quote
Old 03-27-2018, 10:20 AM   #3
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,111
Default

i use the win32 api/swell

you can look at the app wrapper to see how it's done

https://github.com/olilarkin/wdl-ol/...p_main.cpp#L41
__________________
VirtualCZ | pMix | Endless Series | WDL-OL | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
olilarkin is offline   Reply With Quote
Old 03-28-2018, 02:22 AM   #4
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 188
Default

Cannot find the solution there Oli.

I tried to write a file with the settings in /Library/Preferences but starting from a while, the plugin can no longer write files in this folder

From what I found NSUserDefaults can be alternative to registry entry but I have not found any code examples so far.
__________________
Audio VST plugins http://vst.saschart.com
SaschArt is offline   Reply With Quote
Old 03-30-2018, 11:49 AM   #5
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 188
Default

I tried to use NSUserDefaults but this code crash the DAW:

Code:
NSString *savedValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"preferenceName"];
Do not understand why
__________________
Audio VST plugins http://vst.saschart.com
SaschArt is offline   Reply With Quote
Old 04-02-2018, 06:29 AM   #6
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 188
Default

Solution:

Code:
	bool insertPref(const char *prefname, const char *prefvalue) {	
		NSString* nsprefname;
		NSString* nsprefvalue;
    
		nsprefname = [NSString stringWithUTF8String:prefname];
		nsprefvalue = [NSString stringWithUTF8String:prefvalue];

		NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];	  
		if (prefs) {
			[prefs setObject:nsprefvalue forKey:nsprefname];
			return true;
		}
		return false;
	}
	char *getPref(const char *prefname) { 
		NSString* nsprefname;

		nsprefname = [NSString stringWithUTF8String:prefname];

		NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
		if (prefs) {
			NSString *nsvalue = [prefs stringForKey:nsprefname];
			if (nsvalue.length>0) {
				return (char *)[nsvalue UTF8String];
			}
		}
		char *out= "";
		return out;
	  
	}
__________________
Audio VST plugins http://vst.saschart.com
SaschArt 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 06:54 PM.


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