/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #pragma once #include #include #include #include #include namespace AudioControls { class CATLControlsModel; //-------------------------------------------------------------------------------------------// struct SRawConnectionData { SRawConnectionData(XmlNodeRef node, bool isValid) : m_xmlNode(node) , m_isValid(isValid) {} XmlNodeRef m_xmlNode; // indicates if the connection is valid for the currently loaded middleware bool m_isValid; }; using TXmlNodeList = AZStd::vector; //-------------------------------------------------------------------------------------------// class CATLControl { friend class CAudioControlsLoader; friend class CAudioControlsWriter; friend class CUndoControlModified; public: CATLControl() = default; CATLControl(const AZStd::string& controlName, CID id, EACEControlType type, CATLControlsModel* atlControlsModel); ~CATLControl(); CID GetId() const; AZStd::string GetName() const; CATLControl* GetParent() const; AZStd::string GetScope() const; EACEControlType GetType() const; bool HasScope() const; bool IsAutoLoad() const; void SetAutoLoad(bool isAutoLoad); void SetName(const AZStd::string_view name); void SetParent(CATLControl* parent); void SetScope(const AZStd::string_view scope); size_t ChildCount() const { return m_children.size(); } CATLControl* GetChild(size_t index) const { return (index < m_children.size() ? m_children[index] : nullptr); } void AddChild(CATLControl* childControl) { if (childControl) { m_children.push_back(childControl); } } void RemoveChild(CATLControl* childControl) { if (childControl) { m_children.erase(AZStd::remove(m_children.begin(), m_children.end(), childControl), m_children.end()); } } size_t ConnectionCount() const; TConnectionPtr GetConnectionAt(size_t index) const; TConnectionPtr GetConnection(CID id) const; TConnectionPtr GetConnection(IAudioSystemControl* middlewareControl) const; void AddConnection(TConnectionPtr connection); void RemoveConnection(TConnectionPtr connection); void RemoveConnection(IAudioSystemControl* middlewareControl); void ClearConnections(); void ReloadConnections(); bool IsFullyConnected() const; void SignalControlAboutToBeModified(); void SignalControlModified(); void SignalConnectionAdded(IAudioSystemControl* middlewareControl); void SignalConnectionRemoved(IAudioSystemControl* middlewareControl); private: void SetId(CID id); void SetType(EACEControlType type); CID m_id = ACE_INVALID_CID; EACEControlType m_type = eACET_TRIGGER; AZStd::string m_name; AZStd::string m_scope; AZStd::vector m_connectedControls; AZStd::vector m_children; CATLControlsModel* m_atlControlsModel = nullptr; CATLControl* m_parent = nullptr; bool m_isAutoLoad = true; // All the raw connection nodes. Used for reloading the data when switching middleware. TXmlNodeList m_connectionNodes; }; } // namespace AudioControls