Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Presets.cpp 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Presets.cpp - Presets and Clipboard management
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #include "Presets.h"
  12. #include "../Misc/XMLwrapper.h"
  13. #include "PresetsStore.h"
  14. #include <string.h>
  15. Presets::Presets()
  16. {
  17. type[0] = 0;
  18. }
  19. Presets::~Presets()
  20. {}
  21. void Presets::setpresettype(const char *type)
  22. {
  23. strcpy(this->type, type);
  24. }
  25. void Presets::copy(PresetsStore &ps, const char *name)
  26. {
  27. XMLwrapper xml;
  28. //used only for the clipboard
  29. if(name == NULL)
  30. xml.minimal = false;
  31. char type[MAX_PRESETTYPE_SIZE];
  32. strcpy(type, this->type);
  33. //strcat(type, "n");
  34. if(name == NULL)
  35. if(strstr(type, "Plfo") != NULL)
  36. strcpy(type, "Plfo");
  37. xml.beginbranch(type);
  38. add2XML(xml);
  39. xml.endbranch();
  40. if(name == NULL)
  41. ps.copyclipboard(xml, type);
  42. else
  43. ps.copypreset(xml, type, name);
  44. }
  45. #if 0
  46. void Presets::paste(PresetsStore &ps, int npreset)
  47. {
  48. char type[MAX_PRESETTYPE_SIZE];
  49. strcpy(type, this->type);
  50. //strcat(type, "n");
  51. if(npreset == 0)
  52. if(strstr(type, "Plfo") != NULL)
  53. strcpy(type, "Plfo");
  54. XMLwrapper xml;
  55. if(npreset == 0) {
  56. if(!checkclipboardtype(ps))
  57. return;
  58. if(!ps.pasteclipboard(xml))
  59. return;
  60. } else if(!ps.pastepreset(xml, npreset))
  61. return;
  62. if(xml.enterbranch(type) == 0)
  63. return;
  64. defaults();
  65. getfromXML(&xml);
  66. xml.exitbranch();
  67. }
  68. #endif
  69. bool Presets::checkclipboardtype(PresetsStore &ps)
  70. {
  71. return ps.checkclipboardtype(type);
  72. }
  73. void Presets::deletepreset(PresetsStore &ps, int npreset)
  74. {
  75. ps.deletepreset(npreset);
  76. }