| 296 | } |
| 297 | |
| 298 | OptionalMessage 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 |
nothing calls this directly
no test coverage detected