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.

122 lines
3.1KB

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