PDA

View Full Version : Getting preset data from gui


olilarkin
02-26-2011, 02:04 PM
i noticed that in ableton live, without saving "aupresets" using another host, there is no host control to access an iplug au's factory presets. So I decided to add a drop down menu for selecting presets. To access the preset names and restore presets from my gui control, i had to make some iplugbase functions public (they were protected).

public:
int NPresets() { return mPresets.GetSize(); }
int GetCurrentPresetIdx() { return mCurrentPresetIdx; }
bool RestorePreset(int idx);
bool RestorePreset(const char* name);
const char* GetPresetName(int idx);
// Dump the current state as source code for a call to MakePresetFromNamedParams.
void DumpPresetSrcCode(const char* filename, const char* paramEnumNames[]);

Is this a bad idea wrt thread safety?

thanks,

oli

Xenakios
02-26-2011, 03:40 PM
i noticed that in ableton live, without saving "aupresets" using another host, there is no host control to access an iplug au's factory presets. So I decided to add a drop down menu for selecting presets. To access the preset names and restore presets from my gui control, i had to make some iplugbase functions public (they were protected).

public:
int NPresets() { return mPresets.GetSize(); }
int GetCurrentPresetIdx() { return mCurrentPresetIdx; }
bool RestorePreset(int idx);
bool RestorePreset(const char* name);
const char* GetPresetName(int idx);
// Dump the current state as source code for a call to MakePresetFromNamedParams.
void DumpPresetSrcCode(const char* filename, const char* paramEnumNames[]);

Is this a bad idea wrt thread safety?

thanks,

oli

Public, protected and private have nothing to do with threads and thread safety. It's about how locking (mutexes) is used in the code, or ensuring in some other way safe access to variables from multiple threads.

olilarkin
02-26-2011, 03:56 PM
Public, protected and private have nothing to do with threads and thread safety. It's about how locking (mutexes) is used in the code, or ensuring in some other way safe access to variables from multiple threads.

thanks, i know. sorry, my question should have been "do i need to modify these methods to lock the mutex". I looked more closely and bool RestorePreset(int idx); seems like the only one that could cause problems. SerializeParams() and UnSerializeParams() which are called from it, both lock the mutex.

cc_
02-27-2011, 02:16 AM
As I understood it AU presets can't be altered (they really are preset), so I shouldn't be possible for one instance to modify a preset while other is reading it.

Maybe this limitation is why they didn't implement them in Live? Personally I'd just tell people to use the VST version in Live as there's other limitations to the AU such as no MIDI out.