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. namespace juce {
  22. class String;
  23. class XmlElement;
  24. }
  25. CARLA_BACKEND_START_NAMESPACE
  26. // -----------------------------------------------------------------------
  27. struct StateParameter {
  28. bool isInput;
  29. int32_t index;
  30. const char* name;
  31. const char* symbol;
  32. float value;
  33. #ifndef BUILD_BRIDGE
  34. uint8_t midiChannel;
  35. int16_t midiCC;
  36. #endif
  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 StateSave {
  54. const char* type;
  55. const char* name;
  56. const char* label;
  57. const char* binary;
  58. int64_t uniqueId;
  59. #ifndef BUILD_BRIDGE
  60. bool active;
  61. float dryWet;
  62. float volume;
  63. float balanceLeft;
  64. float balanceRight;
  65. float panning;
  66. int8_t ctrlChannel;
  67. uint options;
  68. #endif
  69. int32_t currentProgramIndex;
  70. const char* currentProgramName;
  71. int32_t currentMidiBank;
  72. int32_t currentMidiProgram;
  73. const char* chunk;
  74. StateParameterList parameters;
  75. StateCustomDataList customData;
  76. StateSave() noexcept;
  77. ~StateSave() noexcept;
  78. void clear() noexcept;
  79. bool fillFromXmlElement(const juce::XmlElement* const xmlElement);
  80. juce::String toString() const;
  81. CARLA_DECLARE_NON_COPY_STRUCT(StateSave)
  82. };
  83. // -----------------------------------------------------------------------
  84. CARLA_BACKEND_END_NAMESPACE
  85. #endif // CARLA_STATE_UTILS_HPP_INCLUDED