IAudioSystemControl.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/std/string/string_view.h>
  10. #include <ACETypes.h>
  11. namespace AudioControls
  12. {
  13. //-------------------------------------------------------------------------------------------//
  14. class IAudioSystemControl
  15. {
  16. public:
  17. IAudioSystemControl() = default;
  18. IAudioSystemControl(const AZStd::string& name, CID id, TImplControlType type)
  19. : m_name(name)
  20. , m_id(id)
  21. , m_type(type)
  22. {}
  23. virtual ~IAudioSystemControl() = default;
  24. // unique id for this control
  25. CID GetId() const
  26. {
  27. return m_id;
  28. }
  29. void SetId(CID id)
  30. {
  31. m_id = id;
  32. }
  33. TImplControlType GetType() const
  34. {
  35. return m_type;
  36. }
  37. void SetType(TImplControlType type)
  38. {
  39. m_type = type;
  40. }
  41. const AZStd::string& GetName() const
  42. {
  43. return m_name;
  44. }
  45. void SetName(const AZStd::string_view name)
  46. {
  47. if (m_name != name)
  48. {
  49. m_name = name;
  50. }
  51. }
  52. bool IsPlaceholder() const
  53. {
  54. return m_isPlaceholder;
  55. }
  56. void SetPlaceholder(bool isPlaceholder)
  57. {
  58. m_isPlaceholder = isPlaceholder;
  59. }
  60. bool IsLocalized() const
  61. {
  62. return m_isLocalized;
  63. }
  64. void SetLocalized(bool isLocalized)
  65. {
  66. m_isLocalized = isLocalized;
  67. }
  68. bool IsConnected() const
  69. {
  70. return m_isConnected;
  71. }
  72. void SetConnected(bool isConnected)
  73. {
  74. m_isConnected = isConnected;
  75. }
  76. size_t ChildCount() const
  77. {
  78. return m_children.size();
  79. }
  80. void AddChild(IAudioSystemControl* pChild)
  81. {
  82. m_children.push_back(pChild);
  83. pChild->SetParent(this);
  84. }
  85. IAudioSystemControl* GetChildAt(size_t index) const
  86. {
  87. return (index < m_children.size() ? m_children[index] : nullptr);
  88. }
  89. void SetParent(IAudioSystemControl* pParent)
  90. {
  91. m_parent = pParent;
  92. }
  93. IAudioSystemControl* GetParent() const
  94. {
  95. return m_parent;
  96. }
  97. private:
  98. AZStd::vector<IAudioSystemControl*> m_children;
  99. AZStd::string m_name;
  100. IAudioSystemControl* m_parent = nullptr;
  101. CID m_id = ACE_INVALID_CID;
  102. TImplControlType m_type = AUDIO_IMPL_INVALID_TYPE;
  103. bool m_isPlaceholder = false;
  104. bool m_isLocalized = false;
  105. bool m_isConnected = false;
  106. };
  107. } // namespace AudioControls