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.

110 lines
2.8KB

  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 "CarlaBackend.h"
  20. #include "LinkedList.hpp"
  21. class QDomNode;
  22. class QString;
  23. // -----------------------------------------------------------------------
  24. CARLA_BACKEND_START_NAMESPACE
  25. #if 0
  26. } // Fix editor indentation
  27. #endif
  28. // -----------------------------------------------------------------------
  29. struct StateParameter {
  30. bool isInput;
  31. int32_t index;
  32. const char* name;
  33. const char* symbol;
  34. float value;
  35. uint8_t midiChannel;
  36. int16_t midiCC;
  37. StateParameter() noexcept;
  38. ~StateParameter() noexcept;
  39. CARLA_DECLARE_NON_COPY_STRUCT(StateParameter)
  40. };
  41. struct StateCustomData {
  42. const char* type;
  43. const char* key;
  44. const char* value;
  45. StateCustomData() noexcept;
  46. ~StateCustomData() noexcept;
  47. CARLA_DECLARE_NON_COPY_STRUCT(StateCustomData)
  48. };
  49. typedef LinkedList<StateParameter*> StateParameterList;
  50. typedef LinkedList<StateCustomData*> StateCustomDataList;
  51. typedef LinkedList<StateParameter*>::Itenerator StateParameterItenerator;
  52. typedef LinkedList<StateCustomData*>::Itenerator StateCustomDataItenerator;
  53. struct SaveState {
  54. const char* type;
  55. const char* name;
  56. const char* label;
  57. const char* binary;
  58. int64_t uniqueId;
  59. bool active;
  60. float dryWet;
  61. float volume;
  62. float balanceLeft;
  63. float balanceRight;
  64. float panning;
  65. int8_t ctrlChannel;
  66. int32_t currentProgramIndex;
  67. const char* currentProgramName;
  68. int32_t currentMidiBank;
  69. int32_t currentMidiProgram;
  70. const char* chunk;
  71. StateParameterList parameters;
  72. StateCustomDataList customData;
  73. SaveState() noexcept;
  74. ~SaveState() noexcept;
  75. void reset() noexcept;
  76. CARLA_DECLARE_NON_COPY_STRUCT(SaveState)
  77. };
  78. // -----------------------------------------------------------------------
  79. void fillSaveStateFromXmlNode(SaveState& saveState, const QDomNode& xmlNode);
  80. void fillXmlStringFromSaveState(QString& content, const SaveState& saveState);
  81. // -----------------------------------------------------------------------
  82. CARLA_BACKEND_END_NAMESPACE
  83. #endif // CARLA_STATE_UTILS_HPP_INCLUDED