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.

108 lines
2.7KB

  1. /*
  2. * Carla State utils
  3. * Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_STATE_UTILS_HPP_INCLUDED
  18. #define CARLA_STATE_UTILS_HPP_INCLUDED
  19. #include "LinkedList.hpp"
  20. class QDomNode;
  21. class QString;
  22. // -----------------------------------------------------------------------
  23. CARLA_BACKEND_START_NAMESPACE
  24. #if 0
  25. } // Fix editor indentation
  26. #endif
  27. // -----------------------------------------------------------------------
  28. struct StateParameter {
  29. int32_t index;
  30. const char* name;
  31. const char* symbol;
  32. float value;
  33. uint8_t midiChannel;
  34. int16_t midiCC;
  35. StateParameter() noexcept;
  36. ~StateParameter();
  37. CARLA_DECLARE_NON_COPY_STRUCT(StateParameter)
  38. };
  39. struct StateCustomData {
  40. const char* type;
  41. const char* key;
  42. const char* value;
  43. StateCustomData() noexcept;
  44. ~StateCustomData();
  45. CARLA_DECLARE_NON_COPY_STRUCT(StateCustomData)
  46. };
  47. typedef LinkedList<StateParameter*> StateParameterList;
  48. typedef LinkedList<StateCustomData*> StateCustomDataList;
  49. typedef LinkedList<StateParameter*>::Itenerator StateParameterItenerator;
  50. typedef LinkedList<StateCustomData*>::Itenerator StateCustomDataItenerator;
  51. struct SaveState {
  52. const char* type;
  53. const char* name;
  54. const char* label;
  55. const char* binary;
  56. long uniqueID;
  57. bool active;
  58. float dryWet;
  59. float volume;
  60. float balanceLeft;
  61. float balanceRight;
  62. float panning;
  63. int8_t ctrlChannel;
  64. int32_t currentProgramIndex;
  65. const char* currentProgramName;
  66. int32_t currentMidiBank;
  67. int32_t currentMidiProgram;
  68. const char* chunk;
  69. StateParameterList parameters;
  70. StateCustomDataList customData;
  71. SaveState() noexcept;
  72. ~SaveState();
  73. void reset();
  74. CARLA_DECLARE_NON_COPY_STRUCT(SaveState)
  75. };
  76. // -----------------------------------------------------------------------
  77. void fillSaveStateFromXmlNode(SaveState& saveState, const QDomNode& xmlNode);
  78. void fillXmlStringFromSaveState(QString& content, const SaveState& saveState);
  79. // -----------------------------------------------------------------------
  80. CARLA_BACKEND_END_NAMESPACE
  81. #endif // CARLA_STATE_UTILS_HPP_INCLUDED