MCPcopy Create free account
hub / github.com/audacity/audacity / LoadUserPreset

Method LoadUserPreset

libraries/lib-vst/VSTEffectBase.cpp:298–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298OptionalMessage VSTEffectBase::LoadUserPreset(
299 const RegistryPath & group, EffectSettings &settings) const
300{
301 wxString value;
302
303 auto info = GetChunkInfo();
304
305 GetConfig(*this, PluginSettings::Private, group, wxT("UniqueID"),
306 info.pluginUniqueID, info.pluginUniqueID);
307 GetConfig(*this, PluginSettings::Private, group, wxT("Version"),
308 info.pluginVersion, info.pluginVersion);
309 GetConfig(*this, PluginSettings::Private, group, wxT("Elements"),
310 info.numElements, info.numElements);
311
312 if ( ! IsCompatible(info) )
313 {
314 return {};
315 }
316
317 if (GetConfig(*this,
318 PluginSettings::Private, group, wxT("Chunk"), value, wxEmptyString))
319 {
320 ArrayOf<char> buf{ value.length() / 4 * 3 };
321
322 int len = Base64::Decode(value, buf.get());
323 if (len)
324 {
325 callSetChunk(true, len, buf.get(), &info);
326 if (!FetchSettings(GetSettings(settings)))
327 return {};
328 }
329
330 return MakeMessageFS(
331 VSTInstance::GetSettings(settings));
332 }
333
334 wxString parms;
335 if (!GetConfig(*this,
336 PluginSettings::Private, group, wxT("Parameters"), parms, wxEmptyString))
337 {
338 return {};
339 }
340
341 CommandParameters eap;
342 if (!eap.SetParameters(parms))
343 {
344 return {};
345 }
346
347 const bool loadOK = LoadSettings(eap, settings) &&
348 FetchSettings(GetSettings(settings));
349 if (!loadOK)
350 return {};
351
352 return MakeMessageFS(
353 VSTInstance::GetSettings(settings));
354}
355

Callers

nothing calls this directly

Calls 5

GetConfigFunction · 0.85
GetSettingsFunction · 0.85
lengthMethod · 0.45
getMethod · 0.45
SetParametersMethod · 0.45

Tested by

no test coverage detected