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.

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